Panics · P03 Layout: panes and splits meet stale ids, lagging sizes and mid-drag changes without a panic

This commit is contained in:
ZacharyZhang-NY committed 2026-10-06 16:21:39 -04:00
1 parent f46cc4e7c3
commit 2347edeed6
5 files changed
+214 -31

No files matched your search

+6 -1
View File
@@ -22,7 +22,7 @@ fn shortest(heights: &[Pixels]) -> usize {
heights
.iter()
.enumerate()
.min_by(|a, b| a.1.partial_cmp(b.1).expect("heights are finite"))
.min_by(|a, b| f32::from(*a.1).total_cmp(&f32::from(*b.1)))
.map(|(ix, _)| ix)
.expect("at least one column")
}
@@ -182,6 +182,11 @@ mod tests {
use super::{columns_for, fit, shortest};
#[test]
fn a_nan_height_never_stops_the_shortest_column() {
assert_eq!(shortest(&[px(f32::NAN), px(4.0), px(2.0)]), 2);
}
#[test]
fn what_fits_sits_centered() {
assert_eq!(fit(px(100.0), px(3.0), px(2.0)), (20, px(1.0)));