mirror of
https://github.com/storytold/materialcraft.git
synced 2026-11-19 22:10:53 +01:00
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.
This commit is contained in:
1 parent
dea0b0f6e2
commit
0a2a2e294e
1 file changed
+7
-4
@@ -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());
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user