MCPcopy Create free account
hub / github.com/TyberiusPrime/KeyToKey / test_unicode_keyboard_linux

Function test_unicode_keyboard_linux

src/handlers/unicodekeyboard.rs:78–105  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

76 use no_std_compat::prelude::v1::*;
77 #[test]
78 fn test_unicode_keyboard_linux() {
79 use crate::key_codes::KeyCode::*;
80 let ub = UnicodeKeyboard {};
81 let mut keyboard = Keyboard::new(KeyOutCatcher::new());
82 keyboard.add_handler(Box::new(ub));
83 keyboard.output.state().unicode_mode = UnicodeSendMode::Linux;
84 //no output on press
85 keyboard.add_keypress(0x00E4u32, 0);
86 keyboard.handle_keys().unwrap();
87 assert!(keyboard.output.reports.len() == 0);
88 assert!(keyboard.events.is_empty()); // we eat the keypress though
89 keyboard.add_keyrelease(0x00E4, 0);
90 keyboard.handle_keys().unwrap();
91 check_output(
92 &keyboard,
93 &[
94 &[U, LShift, LCtrl],
95 &[],
96 &[E],
97 &[],
98 &[Kp4],
99 &[],
100 &[Enter],
101 &[],
102 ],
103 );
104 assert!(keyboard.events.is_empty()); // we eat the keypress though
105 }
106 #[test]
107 fn test_unicode_keyboard_wincompose() {
108 use crate::key_codes::KeyCode::*;

Callers

nothing calls this directly

Calls 6

check_outputFunction · 0.85
add_handlerMethod · 0.80
stateMethod · 0.80
add_keypressMethod · 0.80
handle_keysMethod · 0.80
add_keyreleaseMethod · 0.80

Tested by

no test coverage detected