From 8967dbe5f3e45ffd7293e9eadca3a3010678b5cd Mon Sep 17 00:00:00 2001 From: RickiNano <81099017+RickiNano@users.noreply.github.com> Date: Fri, 6 Nov 2026 17:42:37 +0100 Subject: [PATCH] Single-line marquee tests: the dropped piece keeps its pixels (#11368) The two no-op drag tests now drop an unmoved floating piece at the press; check that its pixels are still where they were, not only the selection. --- crates/ui-egui/src/single_line_marquee_move_tests.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crates/ui-egui/src/single_line_marquee_move_tests.rs b/crates/ui-egui/src/single_line_marquee_move_tests.rs index 633e0b4220..1f6037cc82 100644 --- a/crates/ui-egui/src/single_line_marquee_move_tests.rs +++ b/crates/ui-egui/src/single_line_marquee_move_tests.rs @@ -50,6 +50,12 @@ fn steps(app: &PhotocraftApp) -> usize { app.session.active().unwrap().history.entries().len() } +/// The active layer's pixel at `(x, y)`. +fn pixel(app: &PhotocraftApp, x: i32, y: i32) -> [f32; 4] { + let st = app.session.active().unwrap(); + st.doc.layer(st.active_layer.unwrap()).unwrap().surface().unwrap().rgba(x, y) +} + /// Rows 150 and 250 (New, then ⇧ adds). fn two_rows(app: &mut PhotocraftApp) { click(app, Tool::SingleRowMarquee, [300.0, 250.5], Modifiers::NONE); @@ -173,6 +179,7 @@ fn a_drag_snapped_back_to_its_start_leaves_the_selection() { drag(&mut app, Tool::SingleRowMarquee, [200.0, 200.5], [200.0, 202.5], Modifiers::NONE); assert!(!floats(&app), "the press dropped the piece where it was (#11368)"); assert_eq!(bounds(&app), Rect::new(100, 150, 300, 250)); + assert_eq!(pixel(&app, 200, 200), [1.0, 0.0, 0.0, 1.0], "the dropped pixels are where they were"); } /// A drag from inside that goes away and comes back to the press is not a click either: the @@ -211,6 +218,7 @@ fn a_drag_that_returns_to_its_start_leaves_the_selection() { out_and_back(&mut app, Tool::SingleRowMarquee, [200.0, 200.5]); assert!(!floats(&app), "the press dropped the piece where it was (#11368)"); assert_eq!(bounds(&app), Rect::new(100, 150, 300, 250)); + assert_eq!(pixel(&app, 200, 200), [1.0, 0.0, 0.0, 1.0], "the dropped pixels are where they were"); } /// A click whose release drifts under a pixel from the press (a zoomed-in hand jitter) is still a