From bd2a18c9cab01cf08e4ed6486d2e3a4a92040ded Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 18 Nov 2026 19:12:08 -0800 Subject: [PATCH] Symbols: the same-frame Shift and Alt test checks that each action took effect shift_or_alt_let_go_after_the_release_in_the_same_frame_still_counts checked only that the rectangle stayed ordinary art, which also holds when the click does nothing. It now checks that New Symbol (button and menu) makes the symbol and that Redefine Symbol changes Dot's art. --- crates/ui-egui/src/panels/symbols.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/crates/ui-egui/src/panels/symbols.rs b/crates/ui-egui/src/panels/symbols.rs index 84c138b8a8..b348373edb 100644 --- a/crates/ui-egui/src/panels/symbols.rs +++ b/crates/ui-egui/src/panels/symbols.rs @@ -1040,20 +1040,27 @@ mod tests { crate::theme::install_fonts(&ctx); ctx }; + let made = ["Leaf", "Dot", "New Symbol"]; let (mut app, _) = leaf_dot_and_rect(); click_button_then(&mut app, "New Symbol", egui::Modifiers::SHIFT, let_go()); crate::dialogs::confirm(&mut app).unwrap(); + assert_eq!(symbols(&mut app), made, "New Symbol button with Shift makes the symbol"); assert_eq!(art(&app, "New Symbol"), (0, 1), "New Symbol button with Shift: the rectangle stays ordinary art"); let (mut app, _) = leaf_dot_and_rect(); click_button_then(&mut app, "New Symbol", egui::Modifiers::SHIFT | egui::Modifiers::ALT, let_go()); assert_eq!(dialog_kind(&app), None, "Alt skips Symbol Options"); + assert_eq!(symbols(&mut app), made, "New Symbol button with Shift and Alt makes the symbol"); assert_eq!(art(&app, "New Symbol"), (0, 1), "New Symbol button with Shift and Alt: the rectangle stays ordinary art"); let (mut app, _) = leaf_dot_and_rect(); click_menu_held_then(&menu_ctx(), &mut app, "New Symbol…", egui::Modifiers::SHIFT, let_go()); crate::dialogs::confirm(&mut app).unwrap(); + assert_eq!(symbols(&mut app), made, "New Symbol… with Shift makes the symbol"); assert_eq!(art(&app, "New Symbol"), (0, 1), "New Symbol… with Shift: the rectangle stays ordinary art"); let (mut app, _) = leaf_dot_and_rect(); + let dot_art = |app: &VectorcraftApp| app.session.active().unwrap().doc.symbols.iter().find(|s| s.name == "Dot").map(|s| s.art.clone()); + let before = dot_art(&app); click_menu_held_then(&menu_ctx(), &mut app, "Redefine Symbol", egui::Modifiers::SHIFT, let_go()); + assert_ne!(dot_art(&app), before, "Redefine Symbol with Shift redefines Dot"); assert_eq!(art(&app, "Dot"), (0, 1), "Redefine Symbol with Shift: the rectangle stays ordinary art"); let mut app = leaf_and_dot(); click_button_then(&mut app, "Delete Symbol", egui::Modifiers::ALT, let_go());