From 0a2a2e294ea65d1804591e3aa09132fd4f2d037d Mon Sep 17 00:00:00 2001 From: chasse20 Date: Wed, 18 Nov 2026 20:52:59 +0000 Subject: [PATCH] Auto: Dispose of shortcut test output and exercise modifier changes Consume the headless egui frame with drop_without_applying_deltas so its initial font texture can be discarded safely in debug builds. Send an explicit Alt transition between key events so the existing Levels assertion detects a matcher that uses the frame's final modifiers. Preserve the repeat assertion. --- crates/ui-egui/src/node_shortcuts.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/crates/ui-egui/src/node_shortcuts.rs b/crates/ui-egui/src/node_shortcuts.rs index 6ee6bff..f597ac8 100644 --- a/crates/ui-egui/src/node_shortcuts.rs +++ b/crates/ui-egui/src/node_shortcuts.rs @@ -78,12 +78,15 @@ mod tests { let event = |modifiers, repeat| Event::Key { key, physical_key: None, pressed: true, repeat, modifiers }; let plain = event(egui::Modifiers::NONE, false); let alt = event(egui::Modifiers::ALT, false); - let raw = egui::RawInput { events: vec![plain, alt], ..Default::default() }; + let raw = egui::RawInput { events: vec![plain, Event::ModifiersChanged(egui::Modifiers::ALT), alt], ..Default::default() }; let shortcuts = [("node:blur".to_owned(), "Alt+B".to_owned()), ("node:levels".to_owned(), "B".to_owned())].into(); - let _ = egui::Context::default().run_ui(raw, |ui| { - assert_eq!(ui.input(|input| pressed(&shortcuts, input, Platform::Windows)), Some("node:levels")); - }); + egui::Context::default() + .run_ui(raw, |ui| { + assert_eq!(ui.input(|input| pressed(&shortcuts, input, Platform::Windows)), Some("node:levels")); + }) + .drop_without_applying_deltas(); + assert!(event_chord(&event(egui::Modifiers::ALT, true), Platform::Windows).is_none()); } }