diff options
author | QMK Bot <hello@qmk.fm> | 2022-06-05 11:15:11 +0200 |
---|---|---|
committer | QMK Bot <hello@qmk.fm> | 2022-06-05 11:15:11 +0200 |
commit | d6402fe9fb01efae5c4952c1a3c07cd128e81eea (patch) | |
tree | 810fef1fc2ce6c7067d5c0daa0d90a09ef94b223 | |
parent | 08c556b78b9dc672a2aa2388bbd3fdf408e3ce98 (diff) | |
parent | 95d20e6d8bb1ffaf3024af793daf789ee0b75727 (diff) |
Merge remote-tracking branch 'origin/master' into develop
28 files changed, 683 insertions, 298 deletions
diff --git a/quantum/process_keycode/process_unicode_common.c b/quantum/process_keycode/process_unicode_common.c index 652becbc9a..6cb2ba8dbb 100644 --- a/quantum/process_keycode/process_unicode_common.c +++ b/quantum/process_keycode/process_unicode_common.c @@ -95,6 +95,7 @@ __attribute__((weak)) void unicode_input_start(void) { unicode_saved_mods = get_mods(); // Save current mods clear_mods(); // Unregister mods to start from a clean state + clear_weak_mods(); switch (unicode_config.input_mode) { case UC_MAC: diff --git a/quantum/quantum.c b/quantum/quantum.c index 4efcc6bd8f..d1cfb5fbe0 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c @@ -289,6 +289,9 @@ bool process_record_quantum(keyrecord_t *record) { #ifdef TAP_DANCE_ENABLE process_tap_dance(keycode, record) && #endif +#ifdef CAPS_WORD_ENABLE + process_caps_word(keycode, record) && +#endif #if defined(UNICODE_COMMON_ENABLE) process_unicode_common(keycode, record) && #endif @@ -304,9 +307,6 @@ bool process_record_quantum(keyrecord_t *record) { #ifdef DYNAMIC_TAPPING_TERM_ENABLE process_dynamic_tapping_term(keycode, record) && #endif -#ifdef CAPS_WORD_ENABLE - process_caps_word(keycode, record) && -#endif #ifdef SPACE_CADET_ENABLE process_space_cadet(keycode, record) && #endif diff --git a/tests/auto_shift/test_auto_shift.cpp b/tests/auto_shift/test_auto_shift.cpp index a19b5dfa82..a83f436c33 100644 --- a/tests/auto_shift/test_auto_shift.cpp +++ b/tests/auto_shift/test_auto_shift.cpp @@ -34,14 +34,14 @@ TEST_F(AutoShift, key_release_before_timeout) { set_keymap({regular_key}); /* Press regular key */ - EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); + EXPECT_NO_REPORT(driver); regular_key.press(); run_one_scan_loop(); testing::Mock::VerifyAndClearExpectations(&driver); /* Release regular key */ - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_A))); - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); + EXPECT_REPORT(driver, (KC_A)); + EXPECT_EMPTY_REPORT(driver); regular_key.release(); run_one_scan_loop(); testing::Mock::VerifyAndClearExpectations(&driver); @@ -55,16 +55,16 @@ TEST_F(AutoShift, key_release_after_timeout) { set_keymap({regular_key}); /* Press regular key */ - EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); + EXPECT_NO_REPORT(driver); regular_key.press(); idle_for(AUTO_SHIFT_TIMEOUT); testing::Mock::VerifyAndClearExpectations(&driver); /* Release regular key */ - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LSFT, KC_A))); - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LSFT))); - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); + EXPECT_REPORT(driver, (KC_LSFT, KC_A)); + EXPECT_REPORT(driver, (KC_LSFT)); + EXPECT_EMPTY_REPORT(driver); regular_key.release(); run_one_scan_loop(); testing::Mock::VerifyAndClearExpectations(&driver); -}
\ No newline at end of file +} diff --git a/tests/basic/test_action_layer.cpp b/tests/basic/test_action_layer.cpp index fe5c729f7c..fa339a3375 100644 --- a/tests/basic/test_action_layer.cpp +++ b/tests/basic/test_action_layer.cpp @@ -131,12 +131,12 @@ TEST_F(ActionLayer, MomentaryLayerDoesNothing) { set_keymap({layer_key}); /* Press and release MO, nothing should happen. */ - EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); + EXPECT_NO_REPORT(driver); layer_key.press(); run_one_scan_loop(); testing::Mock::VerifyAndClearExpectations(&driver); - EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); + EXPECT_NO_REPORT(driver); layer_key.release(); run_one_scan_loop(); testing::Mock::VerifyAndClearExpectations(&driver); @@ -151,28 +151,28 @@ TEST_F(ActionLayer, MomentaryLayerWithKeypress) { set_keymap({layer_key, regular_key, KeymapKey{1, 1, 0, KC_B}}); /* Press MO. */ - EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); + EXPECT_NO_REPORT(driver); layer_key.press(); run_one_scan_loop(); EXPECT_TRUE(layer_state_is(1)); testing::Mock::VerifyAndClearExpectations(&driver); /* Press key on layer 1 */ - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_B))).Times(1); + EXPECT_REPORT(driver, (KC_B)).Times(1); regular_key.press(); run_one_scan_loop(); EXPECT_TRUE(layer_state_is(1)); testing::Mock::VerifyAndClearExpectations(&driver); /* Release key on layer 1 */ - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())).Times(1); + EXPECT_EMPTY_REPORT(driver); regular_key.release(); run_one_scan_loop(); EXPECT_TRUE(layer_state_is(1)); testing::Mock::VerifyAndClearExpectations(&driver); /* Release MO */ - EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); + EXPECT_NO_REPORT(driver); layer_key.release(); run_one_scan_loop(); EXPECT_TRUE(layer_state_is(0)); @@ -188,14 +188,14 @@ TEST_F(ActionLayer, ToggleLayerDoesNothing) { set_keymap({layer_key}); /* Press TG. Layer state should not change as it's applied on release. */ - EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); + EXPECT_NO_REPORT(driver); layer_key.press(); run_one_scan_loop(); EXPECT_TRUE(layer_state_is(1)); testing::Mock::VerifyAndClearExpectations(&driver); /* Release TG. */ - EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); + EXPECT_NO_REPORT(driver); layer_key.release(); run_one_scan_loop(); EXPECT_TRUE(layer_state_is(1)); @@ -212,26 +212,26 @@ TEST_F(ActionLayer, ToggleLayerUpAndDown) { set_keymap({toggle_layer_1_on_layer_0, toggle_layer_0_on_layer_1}); /* Toggle Layer 1. */ - EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); + EXPECT_NO_REPORT(driver); toggle_layer_1_on_layer_0.press(); run_one_scan_loop(); EXPECT_TRUE(layer_state_is(1)); testing::Mock::VerifyAndClearExpectations(&driver); - EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); + EXPECT_NO_REPORT(driver); toggle_layer_1_on_layer_0.release(); run_one_scan_loop(); EXPECT_TRUE(layer_state_is(1)); testing::Mock::VerifyAndClearExpectations(&driver); /* Toggle Layer 0. */ - EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); + EXPECT_NO_REPORT(driver); toggle_layer_0_on_layer_1.press(); run_one_scan_loop(); EXPECT_TRUE(layer_state_is(0)); testing::Mock::VerifyAndClearExpectations(&driver); - EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); + EXPECT_NO_REPORT(driver); toggle_layer_0_on_layer_1.release(); run_one_scan_loop(); EXPECT_TRUE(layer_state_is(0)); @@ -247,13 +247,13 @@ TEST_F(ActionLayer, LayerTapToggleDoesNothing) { set_keymap({layer_key}); /* Press and release TT. */ - EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); + EXPECT_NO_REPORT(driver); layer_key.press(); run_one_scan_loop(); EXPECT_TRUE(layer_state_is(1)); testing::Mock::VerifyAndClearExpectations(&driver); - EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); + EXPECT_NO_REPORT(driver); layer_key.release(); run_one_scan_loop(); EXPECT_TRUE(layer_state_is(0)); @@ -271,25 +271,25 @@ TEST_F(ActionLayer, LayerTapToggleWithKeypress) { set_keymap({layer_key, regular_key, KeymapKey{1, 1, 0, KC_B}}); /* Press TT. */ - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())).Times(0); + EXPECT_NO_REPORT(driver); layer_key.press(); run_one_scan_loop(); EXPECT_TRUE(layer_state_is(1)); testing::Mock::VerifyAndClearExpectations(&driver); - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_B))).Times(1); + EXPECT_REPORT(driver, (KC_B)).Times(1); regular_key.press(); run_one_scan_loop(); EXPECT_TRUE(layer_state_is(1)); testing::Mock::VerifyAndClearExpectations(&driver); - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())).Times(1); + EXPECT_EMPTY_REPORT(driver); regular_key.release(); run_one_scan_loop(); EXPECT_TRUE(layer_state_is(1)); testing::Mock::VerifyAndClearExpectations(&driver); - EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); + EXPECT_NO_REPORT(driver); layer_key.release(); run_one_scan_loop(); EXPECT_TRUE(layer_state_is(0)); @@ -307,7 +307,7 @@ TEST_F(ActionLayer, LayerTapToggleWithToggleWithKeypress) { set_keymap({layer_key, regular_key, KeymapKey{1, 1, 0, KC_B}}); /* Tap TT five times . */ - EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); + EXPECT_NO_REPORT(driver); layer_key.press(); run_one_scan_loop(); @@ -346,13 +346,13 @@ TEST_F(ActionLayer, LayerTapToggleWithToggleWithKeypress) { testing::Mock::VerifyAndClearExpectations(&driver); - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_B))).Times(1); + EXPECT_REPORT(driver, (KC_B)).Times(1); regular_key.press(); run_one_scan_loop(); EXPECT_TRUE(layer_state_is(1)); testing::Mock::VerifyAndClearExpectations(&driver); - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())).Times(1); + EXPECT_EMPTY_REPORT(driver); regular_key.release(); run_one_scan_loop(); EXPECT_TRUE(layer_state_is(1)); @@ -370,7 +370,7 @@ TEST_F(ActionLayer, LayerTapReleasedBeforeKeypressReleaseWithModifiers) { set_keymap({layer_0_key_0, layer_1_key_1}); /* Press layer tap and wait for tapping term to switch to layer 1 */ - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())).Times(0); + EXPECT_NO_REPORT(driver); layer_0_key_0.press(); idle_for(TAPPING_TERM); EXPECT_TRUE(layer_state_is(0)); @@ -378,23 +378,23 @@ TEST_F(ActionLayer, LayerTapReleasedBeforeKeypressReleaseWithModifiers) { /* Press key with layer 1 mapping, result basically expected * altough more reports are send then necessary. */ - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_RALT))).Times(1); - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_RALT, KC_9))).Times(1); + EXPECT_REPORT(driver, (KC_RALT)).Times(1); + EXPECT_REPORT(driver, (KC_RALT, KC_9)).Times(1); layer_1_key_1.press(); run_one_scan_loop(); EXPECT_TRUE(layer_state_is(1)); testing::Mock::VerifyAndClearExpectations(&driver); /* Release layer tap key, no report is send because key is still held. */ - EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); + EXPECT_NO_REPORT(driver); layer_0_key_0.release(); run_one_scan_loop(); EXPECT_TRUE(layer_state_is(0)); testing::Mock::VerifyAndClearExpectations(&driver); /* Unregister keycode and modifier. */ - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_RALT))).Times(1); - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())).Times(1); + EXPECT_REPORT(driver, (KC_RALT)).Times(1); + EXPECT_EMPTY_REPORT(driver); layer_1_key_1.release(); run_one_scan_loop(); EXPECT_TRUE(layer_state_is(0)); diff --git a/tests/basic/test_keypress.cpp b/tests/basic/test_keypress.cpp index 044fc29378..bb68ced557 100644 --- a/tests/basic/test_keypress.cpp +++ b/tests/basic/test_keypress.cpp @@ -24,7 +24,7 @@ class KeyPress : public TestFixture {}; TEST_F(KeyPress, SendKeyboardIsNotCalledWhenNoKeyIsPressed) { TestDriver driver; - EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); + EXPECT_NO_REPORT(driver); keyboard_task(); } @@ -35,11 +35,11 @@ TEST_F(KeyPress, CorrectKeyIsReportedWhenPressed) { set_keymap({key}); key.press(); - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(key.report_code))); + EXPECT_REPORT(driver, (key.report_code)); keyboard_task(); key.release(); - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); + EXPECT_EMPTY_REPORT(driver); keyboard_task(); } @@ -50,7 +50,7 @@ TEST_F(KeyPress, ANonMappedKeyDoesNothing) { set_keymap({key}); key.press(); - EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); + EXPECT_NO_REPORT(driver); keyboard_task(); keyboard_task(); } @@ -66,19 +66,19 @@ TEST_F(KeyPress, CorrectKeysAreReportedWhenTwoKeysArePressed) { key_c.press(); // Note that QMK only processes one key at a time // See issue #1476 for more information - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(key_b.report_code))); + EXPECT_REPORT(driver, (key_b.report_code)); keyboard_task(); - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(key_b.report_code, key_c.report_code))); + EXPECT_REPORT(driver, (key_b.report_code, key_c.report_code)); keyboard_task(); key_b.release(); key_c.release(); // Note that the first key released is the first one in the matrix order - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(key_c.report_code))); + EXPECT_REPORT(driver, (key_c.report_code)); keyboard_task(); - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); + EXPECT_EMPTY_REPORT(driver); keyboard_task(); } @@ -94,17 +94,17 @@ TEST_F(KeyPress, LeftShiftIsReportedCorrectly) { // Unfortunately modifiers are also processed in the wrong order // See issue #1476 for more information - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(key_a.report_code))); + EXPECT_REPORT(driver, (key_a.report_code)); keyboard_task(); - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(key_a.report_code, key_lsft.report_code))); + EXPECT_REPORT(driver, (key_a.report_code, key_lsft.report_code)); keyboard_task(); key_a.release(); - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(key_lsft.report_code))); + EXPECT_REPORT(driver, (key_lsft.report_code)); keyboard_task(); key_lsft.release(); - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); + EXPECT_EMPTY_REPORT(driver); keyboard_task(); } @@ -120,19 +120,19 @@ TEST_F(KeyPress, PressLeftShiftAndControl) { // Unfortunately modifiers are also processed in the wrong order // See issue #1476 for more information - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(key_lsft.report_code))); + EXPECT_REPORT(driver, (key_lsft.report_code)); keyboard_task(); - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(key_lsft.report_code, key_lctrl.report_code))); + EXPECT_REPORT(driver, (key_lsft.report_code, key_lctrl.report_code)); keyboard_task(); key_lsft.release(); key_lctrl.release(); - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(key_lctrl.report_code))); + EXPECT_REPORT(driver, (key_lctrl.report_code)); keyboard_task(); - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); + EXPECT_EMPTY_REPORT(driver); keyboard_task(); } @@ -147,19 +147,19 @@ TEST_F(KeyPress, LeftAndRightShiftCanBePressedAtTheSameTime) { key_rsft.press(); // Unfortunately modifiers are also processed in the wrong order // See issue #1476 for more information - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(key_lsft.report_code))); + EXPECT_REPORT(driver, (key_lsft.report_code)); keyboard_task(); - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(key_lsft.report_code, key_rsft.report_code))); + EXPECT_REPORT(driver, (key_lsft.report_code, key_rsft.report_code)); keyboard_task(); key_lsft.release(); key_rsft.release(); - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(key_rsft.report_code))); + EXPECT_REPORT(driver, (key_rsft.report_code)); keyboard_task(); - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); + EXPECT_EMPTY_REPORT(driver); keyboard_task(); } @@ -175,13 +175,13 @@ TEST_F(KeyPress, RightShiftLeftControlAndCharWithTheSameKey) { // The underlying cause is that we use only one bit to represent the right hand // modifiers. combo_key.press(); - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_RIGHT_SHIFT, KC_RIGHT_CTRL))); - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_RIGHT_SHIFT, KC_RIGHT_CTRL, KC_O))); + EXPECT_REPORT(driver, (KC_RIGHT_SHIFT, KC_RIGHT_CTRL)); + EXPECT_REPORT(driver, (KC_RIGHT_SHIFT, KC_RIGHT_CTRL, KC_O)); keyboard_task(); combo_key.release(); - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_RIGHT_SHIFT, KC_RIGHT_CTRL))); - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); + EXPECT_REPORT(driver, (KC_RIGHT_SHIFT, KC_RIGHT_CTRL)); + EXPECT_EMPTY_REPORT(driver); keyboard_task(); } @@ -194,24 +194,24 @@ TEST_F(KeyPress, PressPlusEqualReleaseBeforePress) { set_keymap({key_plus, key_eql}); key_plus.press(); - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT))); - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT, KC_EQUAL))); + EXPECT_REPORT(driver, (KC_LEFT_SHIFT)); + EXPECT_REPORT(driver, (KC_LEFT_SHIFT, KC_EQUAL)); run_one_scan_loop(); testing::Mock::VerifyAndClearExpectations(&driver); key_plus.release(); - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT))); - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); + EXPECT_REPORT(driver, (KC_LEFT_SHIFT)); + EXPECT_EMPTY_REPORT(driver); run_one_scan_loop(); testing::Mock::VerifyAndClearExpectations(&driver); key_eql.press(); - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(key_eql.report_code))); + EXPECT_REPORT(driver, (key_eql.report_code)); run_one_scan_loop(); testing::Mock::VerifyAndClearExpectations(&driver); key_eql.release(); - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); + EXPECT_EMPTY_REPORT(driver); run_one_scan_loop(); testing::Mock::VerifyAndClearExpectations(&driver); } @@ -225,25 +225,25 @@ TEST_F(KeyPress, PressPlusEqualDontReleaseBeforePress) { set_keymap({key_plus, key_eql}); key_plus.press(); - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT))); - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT, KC_EQUAL))); + EXPECT_REPORT(driver, (KC_LEFT_SHIFT)); + EXPECT_REPORT(driver, (KC_LEFT_SHIFT, KC_EQUAL)); run_one_scan_loop(); testing::Mock::VerifyAndClearExpectations(&driver); key_eql.press(); - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_EQUAL))); + EXPECT_EMPTY_REPORT(driver); + EXPECT_REPORT(driver, (KC_EQUAL)); run_one_scan_loop(); testing::Mock::VerifyAndClearExpectations(&driver); key_plus.release(); // BUG: Should really still return KC_EQUAL, but this is fine too - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())).Times(1); + EXPECT_EMPTY_REPORT(driver); run_one_scan_loop(); testing::Mock::VerifyAndClearExpectations(&driver); key_eql.release(); - EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); + EXPECT_NO_REPORT(driver); run_one_scan_loop(); testing::Mock::VerifyAndClearExpectations(&driver); } @@ -257,24 +257,24 @@ TEST_F(KeyPress, PressEqualPlusReleaseBeforePress) { set_keymap({key_plus, key_eql}); key_eql.press(); - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_EQUAL))); + EXPECT_REPORT(driver, (KC_EQUAL)); run_one_scan_loop(); testing::Mock::VerifyAndClearExpectations(&driver); key_eql.release(); - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); + EXPECT_EMPTY_REPORT(driver); run_one_scan_loop(); testing::Mock::VerifyAndClearExpectations(&driver); key_plus.press(); - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT))); - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT, KC_EQUAL))); + EXPECT_REPORT(driver, (KC_LEFT_SHIFT)); + EXPECT_REPORT(driver, (KC_LEFT_SHIFT, KC_EQUAL)); run_one_scan_loop(); testing::Mock::VerifyAndClearExpectations(&driver); key_plus.release(); - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT))); - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); + EXPECT_REPORT(driver, (KC_LEFT_SHIFT)); + EXPECT_EMPTY_REPORT(driver); run_one_scan_loop(); testing::Mock::VerifyAndClearExpectations(&driver); } @@ -288,27 +288,27 @@ TEST_F(KeyPress, PressEqualPlusDontReleaseBeforePress) { set_keymap({key_plus, key_eql}); key_eql.press(); - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_EQUAL))); + EXPECT_REPORT(driver, (KC_EQUAL)); run_one_scan_loop(); testing::Mock::VerifyAndClearExpectations(&driver); key_plus.press(); // BUG: The sequence is a bit strange, but it works, the end result is that // KC_PLUS is sent - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT, KC_EQUAL))); - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT))); - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT, KC_EQUAL))); + EXPECT_REPORT(driver, (KC_LEFT_SHIFT, KC_EQUAL)); + EXPECT_REPORT(driver, (KC_LEFT_SHIFT)); + EXPECT_REPORT(driver, (KC_LEFT_SHIFT, KC_EQUAL)); run_one_scan_loop(); testing::Mock::VerifyAndClearExpectations(&driver); key_eql.release(); // I guess it's fine to still report shift here - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT))); + EXPECT_REPORT(driver, (KC_LEFT_SHIFT)); run_one_scan_loop(); testing::Mock::VerifyAndClearExpectations(&driver); key_plus.release(); - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); + EXPECT_EMPTY_REPORT(driver); run_one_scan_loop(); testing::Mock::VerifyAndClearExpectations(&driver); } diff --git a/tests/basic/test_one_shot_keys.cpp b/tests/basic/test_one_shot_keys.cpp index 43fc3e1ba3..bb14221140 100644 --- a/tests/basic/test_one_shot_keys.cpp +++ b/tests/basic/test_one_shot_keys.cpp @@ -31,7 +31,7 @@ TEST_F(OneShot, OSMWithoutAdditionalKeypressDoesNothing) { set_keymap({osm_key}); /* Press and release OSM key*/ - EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); + EXPECT_NO_REPORT(driver); osm_key.press(); run_one_scan_loop(); osm_key.release(); @@ -39,7 +39,7 @@ TEST_F(OneShot, OSMWithoutAdditionalKeypressDoesNothing) { testing::Mock::VerifyAndClearExpectations(&driver); /* OSM are added when an actual report is send */ - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(osm_key.report_code))); + EXPECT_REPORT(driver, (osm_key.report_code)); send_keyboard_report(); testing::Mock::VerifyAndClearExpectations(&driver); @@ -57,7 +57,7 @@ TEST_P(OneShotParametrizedTestFixture, OSMExpiredDoesNothing) { set_keymap({osm_key, regular_key}); /* Press and release OSM */ - EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); + EXPECT_NO_REPORT(driver); osm_key.press(); run_one_scan_loop(); osm_key.release(); @@ -65,13 +65,13 @@ TEST_P(OneShotParametrizedTestFixture, OSMExpiredDoesNothing) { testing::Mock::VerifyAndClearExpectations(&driver); /* Press regular key */ - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(regular_key.report_code))).Times(1); + EXPECT_REPORT(driver, (regular_key.report_code)).Times(1); regular_key.press(); run_one_scan_loop(); testing::Mock::VerifyAndClearExpectations(&driver); /* Release regular key */ - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); + EXPECT_EMPTY_REPORT(driver); regular_key.release(); run_one_scan_loop(); testing::Mock::VerifyAndClearExpectations(&driver); @@ -87,7 +87,7 @@ TEST_P(OneShotParametrizedTestFixture, OSMWithAdditionalKeypress) { set_keymap({osm_key, regular_key}); /* Press and release OSM */ - EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); + EXPECT_NO_REPORT(driver); osm_key.press(); run_one_scan_loop(); osm_key.release(); @@ -95,13 +95,13 @@ TEST_P(OneShotParametrizedTestFixture, OSMWithAdditionalKeypress) { testing::Mock::VerifyAndClearExpectations(&driver); /* Press regular key */ - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(osm_key.report_code, regular_key.report_code))).Times(1); + EXPECT_REPORT(driver, (osm_key.report_code, regular_key.report_code)).Times(1); regular_key.press(); run_one_scan_loop(); testing::Mock::VerifyAndClearExpectations(&driver); /* Release regular key */ - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); + EXPECT_EMPTY_REPORT(driver); regular_key.release(); run_one_scan_loop(); testing::Mock::VerifyAndClearExpectations(&driver); @@ -117,26 +117,26 @@ TEST_P(OneShotParametrizedTestFixture, OSMAsRegularModifierWithAdditionalKeypres set_keymap({osm_key, regular_key}); /* Press OSM */ - EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); + EXPECT_NO_REPORT(driver); osm_key.press(); run_one_scan_loop(); testing::Mock::VerifyAndClearExpectations(&driver); /* Press regular key */ - EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); + EXPECT_NO_REPORT(driver); regular_key.press(); run_one_scan_loop(); testing::Mock::VerifyAndClearExpectations(&driver); /* Release regular key */ - EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); + EXPECT_NO_REPORT(driver); regular_key.release(); run_one_scan_loop(); testing::Mock::VerifyAndClearExpectations(&driver); /* Release OSM */ - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(regular_key.report_code, osm_key.report_code))).Times(1); - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())).Times(1); + EXPECT_REPORT(driver, (regular_key.report_code, osm_key.report_code)).Times(1); + EXPECT_EMPTY_REPORT(driver); osm_key.release(); run_one_scan_loop(); testing::Mock::VerifyAndClearExpectations(&driver); @@ -169,26 +169,26 @@ TEST_F(OneShot, OSLWithAdditionalKeypress) { set_keymap({osl_key, regular_key}); /* Press OSL key */ - EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); + EXPECT_NO_REPORT(driver); osl_key.press(); run_one_scan_loop(); testing::Mock::VerifyAndClearExpectations(&driver); /* Release OSL key */ - EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); + EXPECT_NO_REPORT(driver); osl_key.release(); run_one_scan_loop(); testing::Mock::VerifyAndClearExpectations(&driver); /* Press regular key */ - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(regular_key.report_code))).Times(1); - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); + EXPECT_REPORT(driver, (regular_key.report_code)).Times(1); + EXPECT_EMPTY_REPORT(driver); regular_key.press(); run_one_scan_loop(); testing::Mock::VerifyAndClearExpectations(&driver); /* Release regular key */ - EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); + EXPECT_NO_REPORT(driver); regular_key.release(); run_one_scan_loop(); testing::Mock::VerifyAndClearExpectations(&driver); diff --git a/tests/basic/test_tapping.cpp b/tests/basic/test_tapping.cpp index e4a7e4a9f3..6ff9cfe22b 100644 --- a/tests/basic/test_tapping.cpp +++ b/tests/basic/test_tapping.cpp @@ -34,15 +34,15 @@ TEST_F(Tapping, TapA_SHFT_T_KeyReportsKey) { // Tapping keys does nothing on press key_shift_hold_p_tap.press(); - EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); + EXPECT_NO_REPORT(driver); run_one_scan_loop(); // First we get the key press key_shift_hold_p_tap.release(); - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_P))); + EXPECT_REPORT(driver, (KC_P)); // Then the release - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); + EXPECT_EMPTY_REPORT(driver); run_one_scan_loop(); } @@ -56,13 +56,13 @@ TEST_F(Tapping, HoldA_SHFT_T_KeyReportsShift) { mod_tap_hold_key.press(); // Tapping keys does nothing on press - EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); + EXPECT_NO_REPORT(driver); idle_for(TAPPING_TERM); - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LSFT))); + EXPECT_REPORT(driver, (KC_LSFT)); run_one_scan_loop(); - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); + EXPECT_EMPTY_REPORT(driver); mod_tap_hold_key.release(); run_one_scan_loop(); } @@ -77,36 +77,36 @@ TEST_F(Tapping, ANewTapWithinTappingTermIsBuggy) { // Tapping keys does nothing on press key_shift_hold_p_tap.press(); - EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); + EXPECT_NO_REPORT(driver); run_one_scan_loop(); key_shift_hold_p_tap.release(); // First we get the key press - EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_P))); |