diff options
Diffstat (limited to 'tests/basic/test_keypress.cpp')
-rw-r--r-- | tests/basic/test_keypress.cpp | 96 |
1 files changed, 48 insertions, 48 deletions
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); } |