Skip to content

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

Layers panel fx drag test: measure the drop target before the mutable drag borrow (#1719)

MarekSpodBiedry6ba14192868f
diff --git a/crates/ui-egui/src/fx_drag_tests.rs b/crates/ui-egui/src/fx_drag_tests.rs
index 7c214efa1..a2f2f7ca6 100644
--- a/crates/ui-egui/src/fx_drag_tests.rs
+++ b/crates/ui-egui/src/fx_drag_tests.rs
@@ -69,14 +69,16 @@ fn dragging_effects_onto_a_layer_moves_them_and_alt_copies() {
// ⌥-drag one effect row onto `b`: just that effect is copied.
let from = effect_row(&h, a, "Color Overlay").center();
- drag(&mut h, from, row(&h, b).row.center(), Modifiers::ALT);
+ let to = row(&h, b).row.center();
+ drag(&mut h, from, to, Modifiers::ALT);
assert_eq!(effects(&h, a), ["Drop Shadow", "Color Overlay"]);
assert_eq!(effects(&h, b), ["Color Overlay"]);
assert_eq!(h.state().session.active().unwrap().history.past_len(), steps + 1, "one history step");
// Drag the fx badge onto `b`: all of `a`'s effects move there, replacing `b`'s.
let badge = row(&h, a).indicators.into_iter().find(|(k, _)| *k == Indicator::Fx).unwrap().1;
- drag(&mut h, badge.center(), row(&h, b).row.center(), Modifiers::NONE);
+ let to = row(&h, b).row.center();
+ drag(&mut h, badge.center(), to, Modifiers::NONE);
assert!(effects(&h, a).is_empty(), "the effects moved off `a`");
assert_eq!(effects(&h, b), ["Drop Shadow", "Color Overlay"]);
// The drag moved effects, not the layer: `b` is still above `a`.