mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-24 11:23:43 +01:00
Tests: "vectorize" finds the image trace commands after the labels that hold "trace"
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.
This commit is contained in:
1 parent
c5e318772f
commit
0ee9ffcd45
1 file changed
+6
-1
@@ -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");
|
||||
|
||||
Reference in new issue
Block a user