From 36f5e777d977de4f633480dde26affade776876a Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 18 Nov 2026 16:55:51 -0800 Subject: [PATCH] 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. --- .../src/panels/tests_brush_libraries.rs | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/crates/ui-egui/src/panels/tests_brush_libraries.rs b/crates/ui-egui/src/panels/tests_brush_libraries.rs index b47fa7feda..6d6e6bf0c0 100644 --- a/crates/ui-egui/src/panels/tests_brush_libraries.rs +++ b/crates/ui-egui/src/panels/tests_brush_libraries.rs @@ -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 = vectorcraft_brush::library(&app.session.doc().unwrap().doc).into_iter().map(|b| b.name).collect(); app.run("brush.delete", json!({ "names": all })).unwrap();