Skip to content

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

Help search test: take the first Levels result and move the cursor to the end

Higgs325848237d76170a1
diff --git a/crates/ui-egui/src/menu_nav_tests.rs b/crates/ui-egui/src/menu_nav_tests.rs
index 659a794b3..ebe89db42 100644
--- a/crates/ui-egui/src/menu_nav_tests.rs
+++ b/crates/ui-egui/src/menu_nav_tests.rs
@@ -284,10 +284,13 @@ fn help_search_keeps_the_arrows_and_space_that_edit_it() {
key(&mut h, egui::Key::ArrowLeft);
typing(&mut h, "e");
assert_eq!(text(&h), "levels", "← moved the cursor");
+ // The cursor sits at `leve|ls`: two → take it to the end.
key(&mut h, egui::Key::ArrowRight);
assert!(h.query_by_label_contains("About PhotoCraft").is_some(), "→ keeps Help open");
+ key(&mut h, egui::Key::ArrowRight);
// The pointer resting on a result lights it; a space typed then is text, not a click.
- let levels = h.get_by_label_contains("› Levels").rect().center();
+ // "levels" finds both Image › Adjustments › Levels… and the Levels adjustment layer.
+ let levels = h.get_all_by_label_contains("› Levels").next().expect("a Levels result").rect().center();
h.hover_at(levels);
h.run_steps(3);
assert!(Nav::current(&h.ctx).highlighted(0).is_some(), "a result is lit");