From 5c3ef10941735f60fd7591c4efa49dddb1575dfe Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 06:01:40 -0800 Subject: [PATCH] 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. --- apps/vectorcraft/src/window_frame.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/vectorcraft/src/window_frame.rs b/apps/vectorcraft/src/window_frame.rs index fb62a91eac..8f92ffbe44 100644 --- a/apps/vectorcraft/src/window_frame.rs +++ b/apps/vectorcraft/src/window_frame.rs @@ -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");