()
| 551 | } |
| 552 | #[test] |
| 553 | fn test_oneshot_released_timeout() { |
| 554 | use crate::handlers; |
| 555 | //use crate::debug_handlers; |
| 556 | use crate::premade; |
| 557 | |
| 558 | let mut keyboard = Keyboard::new(KeyOutCatcher::new()); |
| 559 | keyboard.add_handler(premade::one_shot_shift(0, 1000)); |
| 560 | keyboard.add_handler(Box::new(handlers::USBKeyboard::new())); |
| 561 | |
| 562 | keyboard.add_keypress(KeyCode::RShift, 0); |
| 563 | keyboard.handle_keys().unwrap(); |
| 564 | check_output(&keyboard, &[&[KeyCode::LShift]]); //note that the one shots always output the L variants |
| 565 | keyboard.output.clear(); |
| 566 | assert!(keyboard.output.state().modifier(Shift)); |
| 567 | |
| 568 | keyboard.add_timeout(1000); |
| 569 | keyboard.handle_keys().unwrap(); |
| 570 | check_output(&keyboard, &[&[KeyCode::LShift]]); //note that the one shots always output the L variants |
| 571 | keyboard.output.clear(); |
| 572 | assert!(keyboard.output.state().modifier(Shift)); |
| 573 | |
| 574 | keyboard.add_keyrelease(KeyCode::RShift, 0); |
| 575 | keyboard.handle_keys().unwrap(); |
| 576 | check_output(&keyboard, &[&[KeyCode::LShift]]); //note that the one shots always output the L variants |
| 577 | keyboard.output.clear(); |
| 578 | |
| 579 | keyboard.add_timeout(1000); |
| 580 | keyboard.handle_keys().unwrap(); |
| 581 | assert!(!keyboard.output.state().modifier(Shift)); |
| 582 | check_output(&keyboard, &[&[]]); //note that the one shots always output the L variants |
| 583 | } |
| 584 | |
| 585 | #[test] |
| 586 | fn test_abort() { |
nothing calls this directly
no test coverage detected