diff options
| author | John <Johnlrigoni@gmail.com> | 2025-02-16 03:50:42 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-16 20:50:42 +1100 |
| commit | b69bf4b885cd8d597c29f0af64a3faf2aafa54ce (patch) | |
| tree | 311b18a488548551fe1003a9296972a4d0f1dafb | |
| parent | 3ab2b3b6e2ac85c8bc00b81911d73f060e616228 (diff) | |
Retro Tapping Re-Write; Key Roll Fix (#23641)
| -rw-r--r-- | quantum/action.c | 50 | ||||
| -rw-r--r-- | tests/tap_hold_configurations/retro_tapping/test_key_roll.cpp | 408 |
2 files changed, 446 insertions, 12 deletions
diff --git a/quantum/action.c b/quantum/action.c index 395340d9d7..be85192d25 100644 --- a/quantum/action.c +++ b/quantum/action.c | |||
| @@ -47,7 +47,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 47 | int tp_buttons; | 47 | int tp_buttons; |
| 48 | 48 | ||
| 49 | #if defined(RETRO_TAPPING) || defined(RETRO_TAPPING_PER_KEY) || (defined(AUTO_SHIFT_ENABLE) && defined(RETRO_SHIFT)) | 49 | #if defined(RETRO_TAPPING) || defined(RETRO_TAPPING_PER_KEY) || (defined(AUTO_SHIFT_ENABLE) && defined(RETRO_SHIFT)) |
| 50 | int retro_tapping_counter = 0; | 50 | bool retro_tap_primed = false; |
| 51 | uint16_t retro_tap_curr_key = 0; | ||
| 52 | # if !(defined(AUTO_SHIFT_ENABLE) && defined(RETRO_SHIFT)) | ||
| 53 | uint8_t retro_tap_curr_mods = 0; | ||
| 54 | uint8_t retro_tap_next_mods = 0; | ||
| 55 | # endif | ||
| 51 | #endif | 56 | #endif |
| 52 | 57 | ||
| 53 | #if defined(AUTO_SHIFT_ENABLE) && defined(RETRO_SHIFT) && !defined(NO_ACTION_TAPPING) | 58 | #if defined(AUTO_SHIFT_ENABLE) && defined(RETRO_SHIFT) && !defined(NO_ACTION_TAPPING) |
| @@ -77,7 +82,13 @@ void action_exec(keyevent_t event) { | |||
| 77 | debug_event(event); | 82 | debug_event(event); |
| 78 | ac_dprintf("\n"); | 83 | ac_dprintf("\n"); |
| 79 | #if defined(RETRO_TAPPING) || defined(RETRO_TAPPING_PER_KEY) || (defined(AUTO_SHIFT_ENABLE) && defined(RETRO_SHIFT)) | 84 | #if defined(RETRO_TAPPING) || defined(RETRO_TAPPING_PER_KEY) || (defined(AUTO_SHIFT_ENABLE) && defined(RETRO_SHIFT)) |
| 80 | retro_tapping_counter++; | 85 | uint16_t event_keycode = get_event_keycode(event, false); |
| 86 | if (event.pressed) { | ||
| 87 | retro_tap_primed = false; | ||
| 88 | retro_tap_curr_key = event_keycode; | ||
| 89 | } else if (retro_tap_curr_key == event_keycode) { | ||
| 90 | retro_tap_primed = true; | ||
| 91 | } | ||
| 81 | #endif | 92 | #endif |
| 82 | } | 93 | } |
| 83 | 94 | ||
| @@ -531,7 +542,8 @@ void process_action(keyrecord_t *record, action_t action) { | |||
| 531 | # if defined(RETRO_TAPPING) && defined(DUMMY_MOD_NEUTRALIZER_KEYCODE) | 542 | # if defined(RETRO_TAPPING) && defined(DUMMY_MOD_NEUTRALIZER_KEYCODE) |
| 532 | // Send a dummy keycode to neutralize flashing modifiers | 543 | // Send a dummy keycode to neutralize flashing modifiers |
| 533 | // if the key was held and then released with no interruptions. | 544 | // if the key was held and then released with no interruptions. |
| 534 | if (retro_tapping_counter == 2) { | 545 | uint16_t ev_kc = get_event_keycode(event, false); |
| 546 | if (retro_tap_primed && retro_tap_curr_key == ev_kc) { | ||
| 535 | neutralize_flashing_modifiers(get_mods()); | 547 | neutralize_flashing_modifiers(get_mods()); |
| 536 | } | 548 | } |
| 537 | # endif | 549 | # endif |
| @@ -829,30 +841,44 @@ void process_action(keyrecord_t *record, action_t action) { | |||
| 829 | 841 | ||
| 830 | #ifndef NO_ACTION_TAPPING | 842 | #ifndef NO_ACTION_TAPPING |
| 831 | # if defined(RETRO_TAPPING) || defined(RETRO_TAPPING_PER_KEY) || (defined(AUTO_SHIFT_ENABLE) && defined(RETRO_SHIFT)) | 843 | # if defined(RETRO_TAPPING) || defined(RETRO_TAPPING_PER_KEY) || (defined(AUTO_SHIFT_ENABLE) && defined(RETRO_SHIFT)) |
| 832 | if (!is_tap_action(action)) { | 844 | if (is_tap_action(action)) { |
| 833 | retro_tapping_counter = 0; | ||
| 834 | } else { | ||
| 835 | if (event.pressed) { | 845 | if (event.pressed) { |
| 836 | if (tap_count > 0) { | 846 | if (tap_count > 0) { |
| 837 | retro_tapping_counter = 0; | 847 | retro_tap_primed = false; |
| 848 | } else { | ||
| 849 | # if !(defined(AUTO_SHIFT_ENABLE) && defined(RETRO_SHIFT)) | ||
| 850 | retro_tap_curr_mods = retro_tap_next_mods; | ||
| 851 | retro_tap_next_mods = get_mods(); | ||
| 852 | # endif | ||
| 838 | } | 853 | } |
| 839 | } else { | 854 | } else { |
| 855 | uint16_t event_keycode = get_event_keycode(event, false); | ||
| 856 | # if !(defined(AUTO_SHIFT_ENABLE) && defined(RETRO_SHIFT)) | ||
| 857 | uint8_t curr_mods = get_mods(); | ||
| 858 | # endif | ||
| 840 | if (tap_count > 0) { | 859 | if (tap_count > 0) { |
| 841 | retro_tapping_counter = 0; | 860 | retro_tap_primed = false; |
| 842 | } else { | 861 | } else if (retro_tap_curr_key == event_keycode) { |
| 843 | if ( | 862 | if ( |
| 844 | # ifdef RETRO_TAPPING_PER_KEY | 863 | # ifdef RETRO_TAPPING_PER_KEY |
| 845 | get_retro_tapping(get_event_keycode(record->event, false), record) && | 864 | get_retro_tapping(event_keycode, record) && |
| 846 | # endif | 865 | # endif |
| 847 | retro_tapping_counter == 2) { | 866 | retro_tap_primed) { |
| 848 | # if defined(AUTO_SHIFT_ENABLE) && defined(RETRO_SHIFT) | 867 | # if defined(AUTO_SHIFT_ENABLE) && defined(RETRO_SHIFT) |
| 849 | process_auto_shift(action.layer_tap.code, record); | 868 | process_auto_shift(action.layer_tap.code, record); |
| 850 | # else | 869 | # else |
| 870 | register_mods(retro_tap_curr_mods); | ||
| 871 | wait_ms(TAP_CODE_DELAY); | ||
| 851 | tap_code(action.layer_tap.code); | 872 | tap_code(action.layer_tap.code); |
| 873 | wait_ms(TAP_CODE_DELAY); | ||
| 874 | unregister_mods(retro_tap_curr_mods); | ||
| 852 | # endif | 875 | # endif |
| 853 | } | 876 | } |
| 854 | retro_tapping_counter = 0; | 877 | retro_tap_primed = false; |
| 855 | } | 878 | } |
| 879 | # if !(defined(AUTO_SHIFT_ENABLE) && defined(RETRO_SHIFT)) | ||
| 880 | retro_tap_next_mods = curr_mods; | ||
| 881 | # endif | ||
| 856 | } | 882 | } |
| 857 | } | 883 | } |
| 858 | # endif | 884 | # endif |
diff --git a/tests/tap_hold_configurations/retro_tapping/test_key_roll.cpp b/tests/tap_hold_configurations/retro_tapping/test_key_roll.cpp new file mode 100644 index 0000000000..afcbde9937 --- /dev/null +++ b/tests/tap_hold_configurations/retro_tapping/test_key_roll.cpp | |||
| @@ -0,0 +1,408 @@ | |||
| 1 | /* Copyright 2024 John Rigoni | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 3 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #include "keyboard_report_util.hpp" | ||
| 18 | #include "keycode.h" | ||
| 19 | #include "keycodes.h" | ||
| 20 | #include "test_common.hpp" | ||
| 21 | #include "action_tapping.h" | ||
| 22 | #include "test_keymap_key.hpp" | ||
| 23 | |||
| 24 | using testing::_; | ||
| 25 | using testing::InSequence; | ||
| 26 | |||
| 27 | class RetroTapKeyRoll : public TestFixture {}; | ||
| 28 | |||
| 29 | TEST_F(RetroTapKeyRoll, regular_to_left_gui_mod_over_tap_term) { | ||
| 30 | TestDriver driver; | ||
| 31 | InSequence s; | ||
| 32 | auto mod_tap_hold_key = KeymapKey(0, 1, 0, LGUI_T(KC_P)); | ||
| 33 | auto regular_key = KeymapKey(0, 2, 0, KC_B); | ||
| 34 | |||
| 35 | set_keymap({mod_tap_hold_key, regular_key}); | ||
| 36 | |||
| 37 | EXPECT_REPORT(driver, (KC_B)); | ||
| 38 | regular_key.press(); | ||
| 39 | run_one_scan_loop(); | ||
| 40 | VERIFY_AND_CLEAR(driver); | ||
| 41 | |||
| 42 | EXPECT_NO_REPORT(driver); | ||
| 43 | mod_tap_hold_key.press(); | ||
| 44 | idle_for(TAPPING_TERM); | ||
| 45 | VERIFY_AND_CLEAR(driver); | ||
| 46 | |||
| 47 | EXPECT_REPORT(driver, (KC_B, KC_LEFT_GUI)); | ||
| 48 | run_one_scan_loop(); | ||
| 49 | VERIFY_AND_CLEAR(driver); | ||
| 50 | |||
| 51 | EXPECT_REPORT(driver, (KC_LEFT_GUI)); | ||
| 52 | regular_key.release(); | ||
| 53 | run_one_scan_loop(); | ||
| 54 | VERIFY_AND_CLEAR(driver); | ||
| 55 | |||
| 56 | EXPECT_REPORT(driver, (KC_LEFT_GUI, DUMMY_MOD_NEUTRALIZER_KEYCODE)); | ||
| 57 | EXPECT_REPORT(driver, (KC_LEFT_GUI)); | ||
| 58 | EXPECT_EMPTY_REPORT(driver); | ||
| 59 | EXPECT_REPORT(driver, (KC_P)); | ||
| 60 | EXPECT_EMPTY_REPORT(driver); | ||
| 61 | mod_tap_hold_key.release(); | ||
| 62 | run_one_scan_loop(); | ||
| 63 | VERIFY_AND_CLEAR(driver); | ||
| 64 | } | ||
| 65 | |||
| 66 | TEST_F(RetroTapKeyRoll, regular_to_mod_over_tap_term) { | ||
| 67 | TestDriver driver; | ||
| 68 | InSequence s; | ||
| 69 | auto mod_tap_hold_key = KeymapKey(0, 1, 0, SFT_T(KC_A)); | ||
| 70 | auto regular_key = KeymapKey(0, 2, 0, KC_B); | ||
| 71 | |||
| 72 | set_keymap({mod_tap_hold_key, regular_key}); | ||
| 73 | |||
| 74 | EXPECT_REPORT(driver, (KC_B)); | ||
| 75 | regular_key.press(); | ||
| 76 | run_one_scan_loop(); | ||
| 77 | VERIFY_AND_CLEAR(driver); | ||
| 78 | |||
| 79 | EXPECT_REPORT(driver, (KC_B, KC_LEFT_SHIFT)); | ||
| 80 | mod_tap_hold_key.press(); | ||
| 81 | idle_for(TAPPING_TERM); | ||
| 82 | run_one_scan_loop(); | ||
| 83 | VERIFY_AND_CLEAR(driver); | ||
| 84 | |||
| 85 | EXPECT_REPORT(driver, (KC_LEFT_SHIFT)); | ||
| 86 | regular_key.release(); | ||
| 87 | run_one_scan_loop(); | ||
| 88 | VERIFY_AND_CLEAR(driver); | ||
| 89 | |||
| 90 | EXPECT_EMPTY_REPORT(driver); | ||
| 91 | EXPECT_REPORT(driver, (KC_A)); | ||
| 92 | EXPECT_EMPTY_REPORT(driver); | ||
| 93 | mod_tap_hold_key.release(); | ||
| 94 | run_one_scan_loop(); | ||
| 95 | VERIFY_AND_CLEAR(driver); | ||
| 96 | } | ||
| 97 | |||
| 98 | TEST_F(RetroTapKeyRoll, regular_to_mod_under_tap_term) { | ||
| 99 | TestDriver driver; | ||
| 100 | InSequence s; | ||
| 101 | auto mod_tap_hold_key = KeymapKey(0, 1, 0, SFT_T(KC_A)); | ||
| 102 | auto regular_key = KeymapKey(0, 2, 0, KC_B); | ||
| 103 | |||
| 104 | set_keymap({mod_tap_hold_key, regular_key}); | ||
| 105 | |||
| 106 | EXPECT_REPORT(driver, (KC_B)); | ||
| 107 | regular_key.press(); | ||
| 108 | run_one_scan_loop(); | ||
| 109 | VERIFY_AND_CLEAR(driver); | ||
| 110 | |||
| 111 | EXPECT_NO_REPORT(driver); | ||
| 112 | mod_tap_hold_key.press(); | ||
| 113 | run_one_scan_loop(); | ||
| 114 | VERIFY_AND_CLEAR(driver); | ||
| 115 | |||
| 116 | EXPECT_EMPTY_REPORT(driver); | ||
| 117 | regular_key.release(); | ||
| 118 | run_one_scan_loop(); | ||
| 119 | VERIFY_AND_CLEAR(driver); | ||
| 120 | |||
| 121 | EXPECT_REPORT(driver, (KC_A)); | ||
| 122 | EXPECT_EMPTY_REPORT(driver); | ||
| 123 | mod_tap_hold_key.release(); | ||
| 124 | run_one_scan_loop(); | ||
| 125 | VERIFY_AND_CLEAR(driver); | ||
| 126 | } | ||
| 127 | |||
| 128 | TEST_F(RetroTapKeyRoll, mod_under_tap_term_to_regular) { | ||
| 129 | TestDriver driver; | ||
| 130 | InSequence s; | ||
| 131 | auto mod_tap_hold_key = KeymapKey(0, 1, 0, LGUI_T(KC_P)); | ||
| 132 | auto regular_key = KeymapKey(0, 2, 0, KC_B); | ||
| 133 | |||
| 134 | set_keymap({mod_tap_hold_key, regular_key}); | ||
| 135 | |||
| 136 | EXPECT_NO_REPORT(driver); | ||
| 137 | mod_tap_hold_key.press(); | ||
| 138 | run_one_scan_loop(); | ||
| 139 | VERIFY_AND_CLEAR(driver); | ||
| 140 | |||
| 141 | EXPECT_NO_REPORT(driver); | ||
| 142 | regular_key.press(); | ||
| 143 | run_one_scan_loop(); | ||
| 144 | VERIFY_AND_CLEAR(driver); | ||
| 145 | |||
| 146 | EXPECT_REPORT(driver, (KC_P)); | ||
| 147 | EXPECT_REPORT(driver, (KC_B, KC_P)); | ||
| 148 | EXPECT_REPORT(driver, (KC_B)); | ||
| 149 | mod_tap_hold_key.release(); | ||
| 150 | run_one_scan_loop(); | ||
| 151 | VERIFY_AND_CLEAR(driver); | ||
| 152 | |||
| 153 | EXPECT_EMPTY_REPORT(driver); | ||
| 154 | regular_key.release(); | ||
| 155 | run_one_scan_loop(); | ||
| 156 | VERIFY_AND_CLEAR(driver); | ||
| 157 | } | ||
| 158 | |||
| 159 | TEST_F(RetroTapKeyRoll, mod_over_tap_term_to_regular) { | ||
| 160 | TestDriver driver; | ||
| 161 | InSequence s; | ||
| 162 | auto mod_tap_hold_key = KeymapKey(0, 1, 0, SFT_T(KC_A)); | ||
| 163 | auto regular_key = KeymapKey(0, 2, 0, KC_B); | ||
| 164 | |||
| 165 | set_keymap({mod_tap_hold_key, regular_key}); | ||
| 166 | |||
| 167 | EXPECT_REPORT(driver, (KC_LEFT_SHIFT)); | ||
| 168 | mod_tap_hold_key.press(); | ||
| 169 | idle_for(TAPPING_TERM); | ||
| 170 | run_one_scan_loop(); | ||
| 171 | VERIFY_AND_CLEAR(driver); | ||
| 172 | |||
| 173 | EXPECT_REPORT(driver, (KC_LEFT_SHIFT, KC_B)); | ||
| 174 | regular_key.press(); | ||
| 175 | run_one_scan_loop(); | ||
| 176 | VERIFY_AND_CLEAR(driver); | ||
| 177 | |||
| 178 | EXPECT_REPORT(driver, (KC_B)); | ||
| 179 | mod_tap_hold_key.release(); | ||
| 180 | run_one_scan_loop(); | ||
| 181 | VERIFY_AND_CLEAR(driver); | ||
| 182 | |||
| 183 | EXPECT_EMPTY_REPORT(driver); | ||
| 184 | regular_key.release(); | ||
| 185 | run_one_scan_loop(); | ||
| 186 | VERIFY_AND_CLEAR(driver); | ||
| 187 | } | ||
| 188 | |||
| 189 | TEST_F(RetroTapKeyRoll, mod_under_tap_term_to_mod_under_tap_term) { | ||
| 190 | TestDriver driver; | ||
| 191 | InSequence s; | ||
| 192 | auto mod_tap_hold_gui = KeymapKey(0, 1, 0, LGUI_T(KC_P)); | ||
| 193 | auto mod_tap_hold_lshft = KeymapKey(0, 2, 0, SFT_T(KC_A)); | ||
| 194 | |||
| 195 | set_keymap({mod_tap_hold_gui, mod_tap_hold_lshft}); | ||
| 196 | |||
| 197 | EXPECT_NO_REPORT(driver); | ||
| 198 | mod_tap_hold_lshft.press(); | ||
| 199 | run_one_scan_loop(); | ||
| 200 | VERIFY_AND_CLEAR(driver); | ||
| 201 | |||
| 202 | EXPECT_NO_REPORT(driver); | ||
| 203 | mod_tap_hold_gui.press(); | ||
| 204 | run_one_scan_loop(); | ||
| 205 | VERIFY_AND_CLEAR(driver); | ||
| 206 | |||
| 207 | EXPECT_REPORT(driver, (KC_A)); | ||
| 208 | EXPECT_EMPTY_REPORT(driver); | ||
| 209 | mod_tap_hold_lshft.release(); | ||
| 210 | run_one_scan_loop(); | ||
| 211 | VERIFY_AND_CLEAR(driver); | ||
| 212 | |||
| 213 | EXPECT_REPORT(driver, (KC_P)); | ||
| 214 | EXPECT_EMPTY_REPORT(driver); | ||
| 215 | mod_tap_hold_gui.release(); | ||
| 216 | run_one_scan_loop(); | ||
| 217 | VERIFY_AND_CLEAR(driver); | ||
| 218 | } | ||
| 219 | |||
| 220 | TEST_F(RetroTapKeyRoll, mod_over_tap_term_to_mod_under_tap_term) { | ||
| 221 | TestDriver driver; | ||
| 222 | InSequence s; | ||
| 223 | auto mod_tap_hold_gui = KeymapKey(0, 1, 0, LGUI_T(KC_P)); | ||
| 224 | auto mod_tap_hold_lshft = KeymapKey(0, 2, 0, SFT_T(KC_A)); | ||
| 225 | |||
| 226 | set_keymap({mod_tap_hold_gui, mod_tap_hold_lshft}); | ||
| 227 | |||
| 228 | EXPECT_REPORT(driver, (KC_LEFT_SHIFT)); | ||
| 229 | mod_tap_hold_lshft.press(); | ||
| 230 | idle_for(TAPPING_TERM); | ||
| 231 | run_one_scan_loop(); | ||
| 232 | VERIFY_AND_CLEAR(driver); | ||
| 233 | |||
| 234 | EXPECT_NO_REPORT(driver); | ||
| 235 | mod_tap_hold_gui.press(); | ||
| 236 | run_one_scan_loop(); | ||
| 237 | VERIFY_AND_CLEAR(driver); | ||
| 238 | |||
| 239 | EXPECT_NO_REPORT(driver); | ||
| 240 | mod_tap_hold_lshft.release(); | ||
| 241 | run_one_scan_loop(); | ||
| 242 | VERIFY_AND_CLEAR(driver); | ||
| 243 | |||
| 244 | EXPECT_REPORT(driver, (KC_LEFT_SHIFT, KC_P)); | ||
| 245 | EXPECT_REPORT(driver, (KC_P)); | ||
| 246 | EXPECT_EMPTY_REPORT(driver); | ||
| 247 | mod_tap_hold_gui.release(); | ||
| 248 | run_one_scan_loop(); | ||
| 249 | VERIFY_AND_CLEAR(driver); | ||
| 250 | } | ||
| 251 | |||
| 252 | TEST_F(RetroTapKeyRoll, mod_under_tap_term_to_mod_over_tap_term) { | ||
| 253 | TestDriver driver; | ||
| 254 | InSequence s; | ||
| 255 | auto mod_tap_hold_gui = KeymapKey(0, 1, 0, LGUI_T(KC_P)); | ||
| 256 | auto mod_tap_hold_lshft = KeymapKey(0, 2, 0, SFT_T(KC_A)); | ||
| 257 | |||
| 258 | set_keymap({mod_tap_hold_gui, mod_tap_hold_lshft}); | ||
| 259 | |||
| 260 | EXPECT_NO_REPORT(driver); | ||
| 261 | mod_tap_hold_lshft.press(); | ||
| 262 | run_one_scan_loop(); | ||
| 263 | VERIFY_AND_CLEAR(driver); | ||
| 264 | |||
| 265 | EXPECT_REPORT(driver, (KC_LEFT_SHIFT)); | ||
| 266 | EXPECT_REPORT(driver, (KC_LEFT_SHIFT, KC_LEFT_GUI)); | ||
| 267 | mod_tap_hold_gui.press(); | ||
| 268 | idle_for(TAPPING_TERM); | ||
| 269 | run_one_scan_loop(); | ||
| 270 | VERIFY_AND_CLEAR(driver); | ||
| 271 | |||
| 272 | EXPECT_REPORT(driver, (KC_LEFT_GUI)); | ||
| 273 | mod_tap_hold_lshft.release(); | ||
| 274 | run_one_scan_loop(); | ||
| 275 | VERIFY_AND_CLEAR(driver); | ||
| 276 | |||
| 277 | EXPECT_REPORT(driver, (KC_LEFT_GUI, DUMMY_MOD_NEUTRALIZER_KEYCODE)); | ||
| 278 | EXPECT_REPORT(driver, (KC_LEFT_GUI)); | ||
| 279 | EXPECT_EMPTY_REPORT(driver); | ||
| 280 | EXPECT_REPORT(driver, (KC_LEFT_SHIFT)); | ||
| 281 | EXPECT_REPORT(driver, (KC_P, KC_LEFT_SHIFT)); | ||
| 282 | EXPECT_REPORT(driver, (KC_LEFT_SHIFT)); | ||
| 283 | EXPECT_EMPTY_REPORT(driver); | ||
| 284 | mod_tap_hold_gui.release(); | ||
| 285 | run_one_scan_loop(); | ||
| 286 | VERIFY_AND_CLEAR(driver); | ||
| 287 | } | ||
| 288 | |||
| 289 | TEST_F(RetroTapKeyRoll, mod_under_tap_term_to_mod_over_tap_term_offset) { | ||
| 290 | TestDriver driver; | ||
| 291 | InSequence s; | ||
| 292 | auto mod_tap_hold_gui = KeymapKey(0, 1, 0, LGUI_T(KC_P)); | ||
| 293 | auto mod_tap_hold_lshft = KeymapKey(0, 2, 0, SFT_T(KC_A)); | ||
| 294 | |||
| 295 | set_keymap({mod_tap_hold_gui, mod_tap_hold_lshft}); | ||
| 296 | |||
| 297 | EXPECT_NO_REPORT(driver); | ||
| 298 | mod_tap_hold_lshft.press(); | ||
| 299 | run_one_scan_loop(); | ||
| 300 | VERIFY_AND_CLEAR(driver); | ||
| 301 | |||
| 302 | EXPECT_NO_REPORT(driver); | ||
| 303 | mod_tap_hold_gui.press(); | ||
| 304 | run_one_scan_loop(); | ||
| 305 | VERIFY_AND_CLEAR(driver); | ||
| 306 | |||
| 307 | EXPECT_REPORT(driver, (KC_A)); | ||
| 308 | EXPECT_EMPTY_REPORT(driver); | ||
| 309 | mod_tap_hold_lshft.release(); | ||
| 310 | run_one_scan_loop(); | ||
| 311 | VERIFY_AND_CLEAR(driver); | ||
| 312 | |||
| 313 | EXPECT_REPORT(driver, (KC_LEFT_GUI)); | ||
| 314 | EXPECT_REPORT(driver, (KC_LEFT_GUI, DUMMY_MOD_NEUTRALIZER_KEYCODE)); | ||
| 315 | EXPECT_REPORT(driver, (KC_LEFT_GUI)); | ||
| 316 | EXPECT_EMPTY_REPORT(driver); | ||
| 317 | EXPECT_REPORT(driver, (KC_P)); | ||
| 318 | EXPECT_EMPTY_REPORT(driver); | ||
| 319 | idle_for(TAPPING_TERM); | ||
| 320 | mod_tap_hold_gui.release(); | ||
| 321 | run_one_scan_loop(); | ||
| 322 | VERIFY_AND_CLEAR(driver); | ||
| 323 | } | ||
| 324 | |||
| 325 | TEST_F(RetroTapKeyRoll, mod_over_tap_term_to_mod_over_tap_term) { | ||
| 326 | TestDriver driver; | ||
| 327 | InSequence s; | ||
| 328 | auto mod_tap_hold_gui = KeymapKey(0, 1, 0, LGUI_T(KC_P)); | ||
| 329 | auto mod_tap_hold_lshft = KeymapKey(0, 2, 0, SFT_T(KC_A)); | ||
| 330 | |||
| 331 | set_keymap({mod_tap_hold_gui, mod_tap_hold_lshft}); | ||
| 332 | |||
| 333 | EXPECT_REPORT(driver, (KC_LEFT_SHIFT)); | ||
| 334 | mod_tap_hold_lshft.press(); | ||
| 335 | idle_for(TAPPING_TERM); | ||
| 336 | run_one_scan_loop(); | ||
| 337 | VERIFY_AND_CLEAR(driver); | ||
| 338 | |||
| 339 | EXPECT_REPORT(driver, (KC_LEFT_SHIFT, KC_LEFT_GUI)); | ||
| 340 | mod_tap_hold_gui.press(); | ||
| 341 | idle_for(TAPPING_TERM); | ||
| 342 | run_one_scan_loop(); | ||
| 343 | VERIFY_AND_CLEAR(driver); | ||
| 344 | |||
| 345 | EXPECT_REPORT(driver, (KC_LEFT_GUI)); | ||
| 346 | mod_tap_hold_lshft.release(); | ||
| 347 | run_one_scan_loop(); | ||
| 348 | VERIFY_AND_CLEAR(driver); | ||
| 349 | |||
| 350 | EXPECT_REPORT(driver, (KC_LEFT_GUI, DUMMY_MOD_NEUTRALIZER_KEYCODE)); | ||
| 351 | EXPECT_REPORT(driver, (KC_LEFT_GUI)); | ||
| 352 | EXPECT_EMPTY_REPORT(driver); | ||
| 353 | EXPECT_REPORT(driver, (KC_LEFT_SHIFT)); | ||
| 354 | EXPECT_REPORT(driver, (KC_P, KC_LEFT_SHIFT)); | ||
| 355 | EXPECT_REPORT(driver, (KC_LEFT_SHIFT)); | ||
| 356 | EXPECT_EMPTY_REPORT(driver); | ||
| 357 | mod_tap_hold_gui.release(); | ||
| 358 | run_one_scan_loop(); | ||
| 359 | VERIFY_AND_CLEAR(driver); | ||
| 360 | } | ||
| 361 | |||
| 362 | TEST_F(RetroTapKeyRoll, mod_to_mod_to_mod) { | ||
| 363 | TestDriver driver; | ||
| 364 | InSequence s; | ||
| 365 | auto mod_tap_hold_lalt = KeymapKey(0, 1, 0, LALT_T(KC_R)); | ||
| 366 | auto mod_tap_hold_lshft = KeymapKey(0, 2, 0, SFT_T(KC_A)); | ||
| 367 | auto mod_tap_hold_lctrl = KeymapKey(0, 3, 0, LCTL_T(KC_C)); | ||
| 368 | |||
| 369 | set_keymap({mod_tap_hold_lalt, mod_tap_hold_lshft, mod_tap_hold_lctrl}); | ||
| 370 | |||
| 371 | EXPECT_REPORT(driver, (KC_LEFT_ALT)); | ||
| 372 | mod_tap_hold_lalt.press(); | ||
| 373 | idle_for(TAPPING_TERM); | ||
| 374 | run_one_scan_loop(); | ||
| 375 | VERIFY_AND_CLEAR(driver); | ||
| 376 | |||
| 377 | EXPECT_REPORT(driver, (KC_LEFT_SHIFT, KC_LEFT_ALT)); | ||
| 378 | mod_tap_hold_lshft.press(); | ||
| 379 | idle_for(TAPPING_TERM); | ||
| 380 | run_one_scan_loop(); | ||
| 381 | VERIFY_AND_CLEAR(driver); | ||
| 382 | |||
| 383 | EXPECT_REPORT(driver, (KC_LEFT_SHIFT)); | ||
| 384 | mod_tap_hold_lalt.release(); | ||
| 385 | run_one_scan_loop(); | ||
| 386 | VERIFY_AND_CLEAR(driver); | ||
| 387 | |||
| 388 | EXPECT_REPORT(driver, (KC_LEFT_CTRL, KC_LEFT_SHIFT)); | ||
| 389 | EXPECT_NO_REPORT(driver); | ||
| 390 | mod_tap_hold_lctrl.press(); | ||
| 391 | idle_for(TAPPING_TERM); | ||
| 392 | run_one_scan_loop(); | ||
| 393 | VERIFY_AND_CLEAR(driver); | ||
| 394 | |||
| 395 | EXPECT_REPORT(driver, (KC_LEFT_CTRL)); | ||
| 396 | mod_tap_hold_lshft.release(); | ||
| 397 | run_one_scan_loop(); | ||
| 398 | VERIFY_AND_CLEAR(driver); | ||
| 399 | |||
| 400 | EXPECT_EMPTY_REPORT(driver); | ||
| 401 | EXPECT_REPORT(driver, (KC_LEFT_SHIFT)); | ||
| 402 | EXPECT_REPORT(driver, (KC_C, KC_LEFT_SHIFT)); | ||
| 403 | EXPECT_REPORT(driver, (KC_LEFT_SHIFT)); | ||
| 404 | EXPECT_EMPTY_REPORT(driver); | ||
| 405 | mod_tap_hold_lctrl.release(); | ||
| 406 | run_one_scan_loop(); | ||
| 407 | VERIFY_AND_CLEAR(driver); | ||
| 408 | } | ||
