diff options
| author | Nick Brassel <nick@tzarc.org> | 2021-11-23 09:54:04 +1100 |
|---|---|---|
| committer | Nick Brassel <nick@tzarc.org> | 2021-11-23 09:54:04 +1100 |
| commit | 7746aefe94cc4cd492bfafdef73d95d073f0603b (patch) | |
| tree | 42c6daae724c74f7e21422f3fec4dc384c0e1f5d /tests/basic/test_tapping.cpp | |
| parent | b6054c0206609f3755f71d819643644d250288b0 (diff) | |
| download | qmk_firmware-7746aefe94cc4cd492bfafdef73d95d073f0603b.tar.gz qmk_firmware-7746aefe94cc4cd492bfafdef73d95d073f0603b.zip | |
Revert "[Tests] Increase QMK test coverage (#13789)"
This reverts commit b6054c0206609f3755f71d819643644d250288b0.
Diffstat (limited to 'tests/basic/test_tapping.cpp')
| -rw-r--r-- | tests/basic/test_tapping.cpp | 48 |
1 files changed, 11 insertions, 37 deletions
diff --git a/tests/basic/test_tapping.cpp b/tests/basic/test_tapping.cpp index 181b7ca89..88ab97eb6 100644 --- a/tests/basic/test_tapping.cpp +++ b/tests/basic/test_tapping.cpp | |||
| @@ -14,11 +14,8 @@ | |||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | #include "keyboard_report_util.hpp" | ||
| 18 | #include "keycode.h" | ||
| 19 | #include "test_common.hpp" | 17 | #include "test_common.hpp" |
| 20 | #include "action_tapping.h" | 18 | #include "action_tapping.h" |
| 21 | #include "test_keymap_key.hpp" | ||
| 22 | 19 | ||
| 23 | using testing::_; | 20 | using testing::_; |
| 24 | using testing::InSequence; | 21 | using testing::InSequence; |
| @@ -28,19 +25,14 @@ class Tapping : public TestFixture {}; | |||
| 28 | TEST_F(Tapping, TapA_SHFT_T_KeyReportsKey) { | 25 | TEST_F(Tapping, TapA_SHFT_T_KeyReportsKey) { |
| 29 | TestDriver driver; | 26 | TestDriver driver; |
| 30 | InSequence s; | 27 | InSequence s; |
| 31 | auto key_shift_hold_p_tap = KeymapKey(0, 7, 0, SFT_T(KC_P)); | ||
| 32 | |||
| 33 | set_keymap({key_shift_hold_p_tap}); | ||
| 34 | 28 | ||
| 29 | press_key(7, 0); | ||
| 35 | // Tapping keys does nothing on press | 30 | // Tapping keys does nothing on press |
| 36 | key_shift_hold_p_tap.press(); | ||
| 37 | EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); | 31 | EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); |
| 38 | run_one_scan_loop(); | 32 | run_one_scan_loop(); |
| 39 | 33 | release_key(7, 0); | |
| 40 | // First we get the key press | 34 | // First we get the key press |
| 41 | key_shift_hold_p_tap.release(); | ||
| 42 | EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_P))); | 35 | EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_P))); |
| 43 | |||
| 44 | // Then the release | 36 | // Then the release |
| 45 | EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); | 37 | EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); |
| 46 | run_one_scan_loop(); | 38 | run_one_scan_loop(); |
| @@ -49,38 +41,25 @@ TEST_F(Tapping, TapA_SHFT_T_KeyReportsKey) { | |||
| 49 | TEST_F(Tapping, HoldA_SHFT_T_KeyReportsShift) { | 41 | TEST_F(Tapping, HoldA_SHFT_T_KeyReportsShift) { |
| 50 | TestDriver driver; | 42 | TestDriver driver; |
| 51 | InSequence s; | 43 | InSequence s; |
| 52 | auto mod_tap_hold_key = KeymapKey(0, 7, 0, SFT_T(KC_P)); | ||
| 53 | |||
| 54 | set_keymap({mod_tap_hold_key}); | ||
| 55 | |||
| 56 | mod_tap_hold_key.press(); | ||
| 57 | 44 | ||
| 45 | press_key(7, 0); | ||
| 58 | // Tapping keys does nothing on press | 46 | // Tapping keys does nothing on press |
| 59 | EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); | 47 | EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); |
| 60 | idle_for(TAPPING_TERM); | 48 | idle_for(TAPPING_TERM); |
| 61 | |||
| 62 | EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT))); | 49 | EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT))); |
| 63 | run_one_scan_loop(); | 50 | run_one_scan_loop(); |
| 64 | |||
| 65 | EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); | ||
| 66 | mod_tap_hold_key.release(); | ||
| 67 | run_one_scan_loop(); | ||
| 68 | } | 51 | } |
| 69 | 52 | ||
| 70 | TEST_F(Tapping, ANewTapWithinTappingTermIsBuggy) { | 53 | TEST_F(Tapping, ANewTapWithinTappingTermIsBuggy) { |
| 71 | // See issue #1478 for more information | 54 | // See issue #1478 for more information |
| 72 | TestDriver driver; | 55 | TestDriver driver; |
| 73 | InSequence s; | 56 | InSequence s; |
| 74 | auto key_shift_hold_p_tap = KeymapKey(0, 7, 0, SFT_T(KC_P)); | ||
| 75 | |||
| 76 | set_keymap({key_shift_hold_p_tap}); | ||
| 77 | 57 | ||
| 58 | press_key(7, 0); | ||
| 78 | // Tapping keys does nothing on press | 59 | // Tapping keys does nothing on press |
| 79 | key_shift_hold_p_tap.press(); | ||
| 80 | EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); | 60 | EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); |
| 81 | run_one_scan_loop(); | 61 | run_one_scan_loop(); |
| 82 | key_shift_hold_p_tap.release(); | 62 | release_key(7, 0); |
| 83 | |||
| 84 | // First we get the key press | 63 | // First we get the key press |
| 85 | EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_P))); | 64 | EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_P))); |
| 86 | // Then the release | 65 | // Then the release |
| @@ -88,20 +67,19 @@ TEST_F(Tapping, ANewTapWithinTappingTermIsBuggy) { | |||
| 88 | run_one_scan_loop(); | 67 | run_one_scan_loop(); |
| 89 | 68 | ||
| 90 | // This sends KC_P, even if it should do nothing | 69 | // This sends KC_P, even if it should do nothing |
| 91 | key_shift_hold_p_tap.press(); | 70 | press_key(7, 0); |
| 92 | // This test should not succed if everything works correctly | 71 | // This test should not succed if everything works correctly |
| 93 | EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_P))); | 72 | EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_P))); |
| 94 | run_one_scan_loop(); | 73 | run_one_scan_loop(); |
| 95 | 74 | release_key(7, 0); | |
| 96 | key_shift_hold_p_tap.release(); | ||
| 97 | EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); | 75 | EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); |
| 98 | idle_for(TAPPING_TERM + 1); | 76 | idle_for(TAPPING_TERM + 1); |
| 99 | 77 | ||
| 100 | // On the other hand, nothing is sent if we are outside the tapping term | 78 | // On the other hand, nothing is sent if we are outside the tapping term |
| 101 | key_shift_hold_p_tap.press(); | 79 | press_key(7, 0); |
| 102 | EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); | 80 | EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); |
| 103 | run_one_scan_loop(); | 81 | run_one_scan_loop(); |
| 104 | key_shift_hold_p_tap.release(); | 82 | release_key(7, 0); |
| 105 | 83 | ||
| 106 | // First we get the key press | 84 | // First we get the key press |
| 107 | EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_P))); | 85 | EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_P))); |
| @@ -112,12 +90,8 @@ TEST_F(Tapping, ANewTapWithinTappingTermIsBuggy) { | |||
| 112 | // Now we are geting into strange territory, as the hold registers too early here | 90 | // Now we are geting into strange territory, as the hold registers too early here |
| 113 | // But the stranges part is: | 91 | // But the stranges part is: |
| 114 | // If TAPPING_TERM + 1 above is changed to TAPPING_TERM or TAPPING_TERM + 2 it doesn't | 92 | // If TAPPING_TERM + 1 above is changed to TAPPING_TERM or TAPPING_TERM + 2 it doesn't |
| 115 | key_shift_hold_p_tap.press(); | 93 | press_key(7, 0); |
| 116 | // Shouldn't be called here really | 94 | // Shouldn't be called here really |
| 117 | EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT))).Times(1); | 95 | EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT))).Times(1); |
| 118 | idle_for(TAPPING_TERM); | 96 | idle_for(TAPPING_TERM); |
| 119 | 97 | } | |
| 120 | EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); | ||
| 121 | key_shift_hold_p_tap.release(); | ||
| 122 | run_one_scan_loop(); | ||
| 123 | } \ No newline at end of file | ||
