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

Function test_unicode_while_depressed

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

Source from the content-addressed store, hash-verified

126 }
127 #[test]
128 fn test_unicode_while_depressed() {
129 use crate::key_codes::KeyCode::*;
130 let mut keyboard = Keyboard::new(KeyOutCatcher::new());
131 keyboard.add_handler(Box::new(UnicodeKeyboard {}));
132 keyboard.add_handler(Box::new(USBKeyboard::new()));
133 keyboard.output.state().unicode_mode = UnicodeSendMode::WinCompose;
134 keyboard.add_keypress(A, 0);
135 keyboard.handle_keys().unwrap();
136 dbg!(&keyboard.output.reports);
137 check_output(&keyboard, &[&[A]]);
138 keyboard.output.clear();
139 keyboard.add_keypress(0x3B4u32, 0);
140 keyboard.handle_keys().unwrap();
141 check_output(&keyboard, &[&[A]]);
142 keyboard.add_keyrelease(0x3B4, 0);
143 keyboard.output.clear();
144 keyboard.handle_keys().unwrap();
145 check_output(
146 &keyboard,
147 &[&[RAlt], &[U], &[Kp3], &[B], &[Kp4], &[Enter], &[], &[A]],
148 );
149 keyboard.add_keyrelease(A, 0);
150 keyboard.output.clear();
151 keyboard.handle_keys().unwrap();
152 check_output(&keyboard, &[&[]]);
153 assert!(keyboard.events.is_empty());
154 }
155}

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected