From 0ee9ffcd4519cfb63dd306a1dcdd60a722626587 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 18 Nov 2026 15:38:51 -0800 Subject: [PATCH] Tests: "vectorize" finds the image trace commands after the labels that hold "trace" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The search ranks a result whose label holds a word of the query's group above one that holds it only in its menu path. Edit › Tracing Presets… is a third label with a form of "trace", next to Batch Trace Folder… and the Image Trace panel, so the Object › Image Trace commands now come fourth for "vectorize". The test checks that "vectorize" finds them and that only results whose label holds a form of "trace" rank above them, in place of a fixed place in the first three. --- crates/ui-egui/src/palette/search.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/palette/search.rs b/crates/ui-egui/src/palette/search.rs index 1e4f794a8f..aed70389d0 100644 --- a/crates/ui-egui/src/palette/search.rs +++ b/crates/ui-egui/src/palette/search.rs @@ -1380,7 +1380,12 @@ mod tests { assert_eq!(first("outline text"), "type.createOutlines"); assert!(within("flip", "object.reflect", 3), "{:?}", ranked(&c, "flip")); assert!(within("combine", "object.pathfinder.unite", 3), "{:?}", ranked(&c, "combine")); - assert!(ranked(&c, "vectorize").iter().take(3).any(|id| id.starts_with("imageTrace.")), "{:?}", ranked(&c, "vectorize")); + // "vectorize" finds the image trace commands, and only results whose label holds a form of + // "trace" rank above them. + let vectorize = ranked(&c, "vectorize"); + let traced = |id: &String| c.list.iter().any(|e| &e.id == id && split_name(&e.shown).0.to_lowercase().contains("trac")); + let traces = vectorize.iter().position(|id| id.starts_with("imageTrace.")); + assert!(traces.is_some_and(|p| vectorize.get(..p).is_some_and(|above| above.iter().all(traced))), "{vectorize:?}"); assert_eq!(first("colour"), "panel:color", "{:?}", ranked(&c, "colour")); // A word that only starts other labels is in a group, and its labels follow the direct match. assert_eq!(first("unite"), "object.pathfinder.unite");