Window frame: the DPI test asserts edge relationships, not written-out pixels

CI's test-lint step rejected the 500 % case of
the_frame_limit_grows_with_the_monitor_dpi, which compared the clamped
rect with a tuple of numbers. The test now checks that only the bottom
edge moves and that it hangs below the work area by the same border the
top edge hangs above the monitor.
This commit is contained in:
dotCooCoo committed 2026-12-05 06:01:40 -08:00
1 parent f5a11b9bba
commit 5c3ef10941
1 file changed
+5 -1
+5 -1
View File
@@ -481,7 +481,11 @@ mod tests {
let (monitor, work) = ((0, 0, 3840, 2160), (0, 0, 3840, 2000));
let rect = (-40, -40, 3880, 2200);
assert_eq!(clamped_rect(rect, monitor, work), None, "100 %");
assert_eq!(super::clamped_rect(rect, monitor, work, frame_limit(480)), Some((-40, -40, 3880, 2040)), "500 %");
let Some(clamped) = super::clamped_rect(rect, monitor, work, frame_limit(480)) else {
panic!("500 %: the maximized frame is not clamped");
};
assert_eq!((clamped.0, clamped.1, clamped.2), (rect.0, rect.1, rect.2), "500 %: only the bottom edge moves");
assert_eq!(clamped.3 - work.3, monitor.1 - rect.1, "500 %: the bottom border hangs below the work area as the top one above the monitor");
assert_eq!(super::clamped_rect((-8, -8, 1928 + 40, 1088), (0, 0, 1920, 1080), (0, 0, 1920, 1046), frame_limit(96)), None, "past the limit");
assert_eq!(frame_limit(0), frame_limit(96), "an unknown DPI counts as 100 %");
assert!(frame_limit(u32::MAX) > frame_limit(480), "no overflow");