Skip to content

PhotoCraft: An open-source, photo editor written by scratch in pure Rust

Tests: set the Move tool's Auto-Select target to Layer in the layout_perf clicks (#4056) (#4548)

Fabio Lissi137d7c2df14b
diff --git a/crates/ui-egui/tests/layout_perf.rs b/crates/ui-egui/tests/layout_perf.rs
index 502390c97..fb17833e1 100644
--- a/crates/ui-egui/tests/layout_perf.rs
+++ b/crates/ui-egui/tests/layout_perf.rs
@@ -132,6 +132,9 @@ fn auto_select_moves_the_layer_under_the_pointer() {
actual_pixels(&mut h);
h.state_mut().ui.tool = Tool::Move;
h.state_mut().ui.tool_options.move_auto_select = true;
+ // The default target is Group (#4056); these layers sit in groups, and the test is about the
+ // layer under the pointer.
+ h.state_mut().ui.tool_options.move_target = "layer".into();
h.state_mut().run("layer.select", json!({"layer": k.pixel.0})).expect("select");
h.run_steps(2);
let (pixel_before, text_before) = (bounds(&h, k.pixel), bounds(&h, k.text));
@@ -150,6 +153,7 @@ fn a_move_tool_click_selects_without_moving() {
let (mut h, k) = app();
h.state_mut().ui.tool = Tool::Move;
h.state_mut().ui.tool_options.move_auto_select = true;
+ h.state_mut().ui.tool_options.move_target = "layer".into();
for id in [k.text, k.shape, k.pixel, k.text] {
let before = (bounds(&h, id), h.state().session.active().expect("doc").history.entries().len());
let p = screen(&h, point_on(&h, id));