Brushes: library test clicks Decorative after Pressure Sensitive

The Decorative click ran frames up to 3.5 s, and the Pressure
Sensitive click that followed started again at 3.0 s, so egui
panicked with "Time shouldn't move backwards". The Decorative case
now runs last, at 4.0 s.
This commit is contained in:
dotCooCoo
2026-11-18 16:55:51 -08:00
parent bf4c7955d1
commit 36f5e777d9
@@ -235,17 +235,6 @@ fn the_window_menu_and_the_brushes_panel_open_brush_libraries() {
click(&mut app, &ctx, "Circuit Trace", Modifiers::NONE, 2.0);
assert!(has(&app, "Circuit Trace") && !has(&app, "Bus Lines"));
assert_eq!(undo_len(&app), undo + 1);
let r = app.run("window.brushLibrary", json!({"library": "Decorative"})).unwrap();
assert_eq!((r["open"].as_str(), r["count"].as_u64()), (Some("decorative"), Some(4)));
let path = app.run("shape.line", json!({"x1": 10, "y1": 100, "x2": 180, "y2": 100})).unwrap()["id"].as_u64().unwrap();
let undo = undo_len(&app);
click(&mut app, &ctx, "Leaf Vine", Modifiers::NONE, 3.0);
assert!(has(&app, "Leaf Vine") && !has(&app, "Lantern String"));
assert_eq!(undo_len(&app), undo + 1);
assert_eq!(
app.session.doc().unwrap().doc.node(vectorcraft_doc::NodeId(path)).unwrap().appearance.stroke().unwrap().brush.as_deref(),
Some("Leaf Vine")
);
let r = app.run("window.brushLibrary", json!({"library": "Pressure Sensitive"})).unwrap();
assert_eq!((r["open"].as_str(), r["count"].as_u64()), (Some("pressure-sensitive"), Some(4)));
let path = app.run("shape.line", json!({"x1": 10, "y1": 100, "x2": 180, "y2": 100})).unwrap()["id"].as_u64().unwrap();
@@ -257,6 +246,17 @@ fn the_window_menu_and_the_brushes_panel_open_brush_libraries() {
app.session.doc().unwrap().doc.node(vectorcraft_doc::NodeId(path)).unwrap().appearance.stroke().unwrap().brush.as_deref(),
Some("Flex Ribbon")
);
let r = app.run("window.brushLibrary", json!({"library": "Decorative"})).unwrap();
assert_eq!((r["open"].as_str(), r["count"].as_u64()), (Some("decorative"), Some(4)));
let path = app.run("shape.line", json!({"x1": 10, "y1": 100, "x2": 180, "y2": 100})).unwrap()["id"].as_u64().unwrap();
let undo = undo_len(&app);
click(&mut app, &ctx, "Leaf Vine", Modifiers::NONE, 4.0);
assert!(has(&app, "Leaf Vine") && !has(&app, "Lantern String"));
assert_eq!(undo_len(&app), undo + 1);
assert_eq!(
app.session.doc().unwrap().doc.node(vectorcraft_doc::NodeId(path)).unwrap().appearance.stroke().unwrap().brush.as_deref(),
Some("Leaf Vine")
);
// Without brushes there is nothing to save.
let all: Vec<String> = vectorcraft_brush::library(&app.session.doc().unwrap().doc).into_iter().map(|b| b.name).collect();
app.run("brush.delete", json!({ "names": all })).unwrap();