mirror of
https://github.com/storytold/photocraft.git
synced 2026-11-12 21:23:02 +00:00
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.
This commit is contained in:
1 parent
69d43fb71c
commit
8967dbe5f3
1 file changed
+8
@@ -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
|
||||
|
||||
Reference in new issue
Block a user