summaryrefslogtreecommitdiff
path: root/tests/basic/test_tapping.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/basic/test_tapping.cpp')
-rw-r--r--tests/basic/test_tapping.cpp69
1 files changed, 69 insertions, 0 deletions
diff --git a/tests/basic/test_tapping.cpp b/tests/basic/test_tapping.cpp
index 6ff9cfe22b..faf9b9fe91 100644
--- a/tests/basic/test_tapping.cpp
+++ b/tests/basic/test_tapping.cpp
@@ -121,3 +121,72 @@ TEST_F(Tapping, ANewTapWithinTappingTermIsBuggy) {
121 key_shift_hold_p_tap.release(); 121 key_shift_hold_p_tap.release();
122 run_one_scan_loop(); 122 run_one_scan_loop();
123} 123}
124
125TEST_F(Tapping, TapA_CTL_T_KeyWhileReleasingShift) {
126 TestDriver driver;
127 InSequence s;
128 auto shift_key = KeymapKey(0, 7, 0, KC_LSFT);
129 auto mod_tap_hold_key = KeymapKey(0, 8, 0, CTL_T(KC_P));
130
131 set_keymap({shift_key, mod_tap_hold_key});
132
133 shift_key.press();
134 // Shift is reported
135 EXPECT_REPORT(driver, (KC_LSFT));
136 run_one_scan_loop();
137 testing::Mock::VerifyAndClearExpectations(&driver);
138
139 mod_tap_hold_key.press();
140 // Tapping keys does nothing on press
141 EXPECT_NO_REPORT(driver);
142 run_one_scan_loop();
143
144 shift_key.release();
145 // Releasing shift is delayed while tapping is in progress
146 EXPECT_NO_REPORT(driver);
147 run_one_scan_loop();
148 testing::Mock::VerifyAndClearExpectations(&driver);
149
150 mod_tap_hold_key.release();
151 // Releasing mod-tap key reports the tap and releases shift
152 EXPECT_REPORT(driver, (KC_LSFT, KC_P));
153 EXPECT_REPORT(driver, (KC_P));
154 EXPECT_EMPTY_REPORT(driver);
155 run_one_scan_loop();
156 testing::Mock::VerifyAndClearExpectations(&driver);
157}
158
159TEST_F(Tapping, TapA_CTL_T_KeyWhileReleasingLayer) {
160 TestDriver driver;
161 InSequence s;
162 auto layer_key = KeymapKey(0, 7, 0, MO(1));
163 auto trans_key = KeymapKey(1, 7, 0, KC_TRNS);
164 auto mod_tap_hold_key0 = KeymapKey(0, 8, 0, CTL_T(KC_P));
165 auto mod_tap_hold_key1 = KeymapKey(1, 8, 0, CTL_T(KC_Q));
166
167 set_keymap({layer_key, trans_key, mod_tap_hold_key0, mod_tap_hold_key1});
168
169 layer_key.press();
170 // Pressing the layer key does nothing
171 EXPECT_NO_REPORT(driver);
172 run_one_scan_loop();
173
174 mod_tap_hold_key1.press();
175 // Tapping layer 1 mod-tap key does nothing on press
176 EXPECT_NO_REPORT(driver);
177 run_one_scan_loop();
178
179 layer_key.release();
180 // Releasing layer is delayed while tapping is in progress
181 EXPECT_NO_REPORT(driver);
182 run_one_scan_loop();
183 testing::Mock::VerifyAndClearExpectations(&driver);
184
185 mod_tap_hold_key1.release();
186 // Releasing mod-tap key reports the tap of the layer 1 key
187 // If delayed layer release is broken, this reports the layer 0 key
188 EXPECT_REPORT(driver, (KC_Q));
189 EXPECT_EMPTY_REPORT(driver);
190 run_one_scan_loop();
191 testing::Mock::VerifyAndClearExpectations(&driver);
192}