Skip to content

LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust

Keep selection test independent of the visible list's mutable borrow

Nigel Ihza Firdausy3af5280ea6cc
diff --git a/crates/ui-egui/src/panels/presets.rs b/crates/ui-egui/src/panels/presets.rs
index 165c194ce..e2e97dfa9 100644
--- a/crates/ui-egui/src/panels/presets.rs
+++ b/crates/ui-egui/src/panels/presets.rs
@@ -289,7 +289,8 @@ mod tests {
let pid = "lc.golden-hour";
session.execute("preset.apply", &json!({"id": pid})).unwrap();
let state = AppliedPreset::new(&session, pid.into(), 100.0);
- let other = session.visible().iter().copied().find(|id| Some(*id) != session.active()).unwrap();
+ let active = session.active();
+ let other = session.visible().iter().copied().find(|id| Some(*id) != active).unwrap();
session.execute("library.select", &json!({"ids": [other.0]})).unwrap();
assert!(!state.is_current(&session), "the preset belongs to the earlier selection");
}