tests: Add AutomatedEvent::KeyUp

This commit is contained in:
Kamil Jarosz 2024-03-22 19:03:52 +01:00 committed by Adrian Wielgosik
parent be5eaaec6e
commit bc9aa18d6f
3 changed files with 8 additions and 0 deletions

View File

@ -230,6 +230,10 @@ impl TestRunner {
key_code: KeyCode::from_u8(*key_code).expect("Invalid keycode in test"),
key_char: None,
},
AutomatedEvent::KeyUp { key_code } => PlayerEvent::KeyUp {
key_code: KeyCode::from_u8(*key_code).expect("Invalid keycode in test"),
key_char: None,
},
AutomatedEvent::TextInput { codepoint } => PlayerEvent::TextInput {
codepoint: *codepoint,
},

View File

@ -65,6 +65,9 @@ pub enum AutomatedEvent {
/// Press a key
KeyDown { key_code: u8 },
/// Release a key
KeyUp { key_code: u8 },
/// Input a character code
TextInput { codepoint: char },

View File

@ -96,6 +96,7 @@ impl InputInjector {
AutomatedEvent::Wait => break,
AutomatedEvent::MouseMove { .. }
| AutomatedEvent::KeyDown { .. }
| AutomatedEvent::KeyUp { .. }
| AutomatedEvent::TextInput { .. }
| AutomatedEvent::TextControl { .. }
| AutomatedEvent::SetClipboardText { .. } => {}