diff options
| author | precondition <57645186+precondition@users.noreply.github.com> | 2022-12-12 22:16:12 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-12 22:16:12 +0100 |
| commit | 454edf68d1035cfabbcd3e4a7b7e9768085e17e5 (patch) | |
| tree | f83c66b54b6ce14e94336305e517732334407b5f /tests | |
| parent | 008f1312bbddd281378b680f723a01d135f7e948 (diff) | |
Tests that caps word stays active after use of OSL (#19303)
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/caps_word/test_caps_word.cpp | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/tests/caps_word/test_caps_word.cpp b/tests/caps_word/test_caps_word.cpp index 3d0735d8c2..e5ecbb844e 100644 --- a/tests/caps_word/test_caps_word.cpp +++ b/tests/caps_word/test_caps_word.cpp | |||
| @@ -591,6 +591,57 @@ INSTANTIATE_TEST_CASE_P( | |||
| 591 | ), | 591 | ), |
| 592 | CapsWordDoubleTapShiftParams::GetName | 592 | CapsWordDoubleTapShiftParams::GetName |
| 593 | ); | 593 | ); |
| 594 | // clang-format on | ||
| 595 | 594 | ||
| 595 | // Tests that holding a OSL keeps caps word active and shifts keys on the layer that need to be shifted. | ||
| 596 | TEST_F(CapsWord, IgnoresOSLHold) { | ||
| 597 | TestDriver driver; | ||
| 598 | KeymapKey key_a(0, 0, 0, KC_A); | ||
| 599 | KeymapKey key_osl(0, 1, 0, OSL(1)); | ||
| 600 | KeymapKey key_b(1, 0, 0, KC_B); | ||
| 601 | set_keymap({key_a, key_osl, key_b}); | ||
| 602 | |||
| 603 | // Allow any number of reports with no keys or only modifiers. | ||
| 604 | // clang-format off | ||
| 605 | EXPECT_CALL(driver, send_keyboard_mock(AnyOf( | ||
| 606 | KeyboardReport(), | ||
| 607 | KeyboardReport(KC_LSFT)))) | ||
| 608 | .Times(AnyNumber()); | ||
| 609 | |||
| 610 | EXPECT_REPORT(driver, (KC_LSFT, KC_B)); | ||
| 611 | caps_word_on(); | ||
| 612 | |||
| 613 | key_osl.press(); | ||
| 614 | run_one_scan_loop(); | ||
| 615 | tap_key(key_b); | ||
| 616 | key_osl.release(); | ||
| 617 | run_one_scan_loop(); | ||
| 618 | |||
| 619 | testing::Mock::VerifyAndClearExpectations(&driver); | ||
| 620 | } | ||
| 621 | |||
| 622 | // Tests that tapping a OSL keeps caps word active and shifts keys on the layer that need to be shifted. | ||
| 623 | TEST_F(CapsWord, IgnoresOSLTap) { | ||
| 624 | TestDriver driver; | ||
| 625 | KeymapKey key_a(0, 0, 0, KC_A); | ||
| 626 | KeymapKey key_osl(0, 1, 0, OSL(1)); | ||
| 627 | KeymapKey key_b(1, 0, 0, KC_B); | ||
| 628 | set_keymap({key_a, key_osl, key_b}); | ||
| 629 | |||
| 630 | // Allow any number of reports with no keys or only modifiers. | ||
| 631 | // clang-format off | ||
| 632 | EXPECT_CALL(driver, send_keyboard_mock(AnyOf( | ||
| 633 | KeyboardReport(), | ||
| 634 | KeyboardReport(KC_LSFT)))) | ||
| 635 | .Times(AnyNumber()); | ||
| 636 | |||
| 637 | EXPECT_REPORT(driver, (KC_LSFT, KC_B)); | ||
| 638 | caps_word_on(); | ||
| 639 | |||
| 640 | tap_key(key_osl); | ||
| 641 | tap_key(key_b); | ||
| 642 | run_one_scan_loop(); | ||
| 643 | |||
| 644 | testing::Mock::VerifyAndClearExpectations(&driver); | ||
| 645 | } | ||
| 646 | // clang-format on | ||
| 596 | } // namespace | 647 | } // namespace |
