summaryrefslogtreecommitdiff
path: root/tests/basic
diff options
context:
space:
mode:
authorPascal Getreuer <50221757+getreuer@users.noreply.github.com>2022-06-05 00:14:02 -0700
committerGitHub <noreply@github.com>2022-06-05 09:14:02 +0200
commit95d20e6d8bb1ffaf3024af793daf789ee0b75727 (patch)
tree95d0bb0c179d6f42a3dafa1952caf8a4299b67ac /tests/basic
parent787165718de4ba532417fb3e04b321c950279237 (diff)
Fix and add unit tests for Caps Word to work with Unicode Map, Auto Shift, Retro Shift. (#17284)
* Fix Caps Word and Unicode Map * Tests for Caps Word + Auto Shift and Unicode Map. * Fix formatting * Add additional keyboard report expectation macros This commit defines five test utilities, EXPECT_REPORT, EXPECT_UNICODE, EXPECT_EMPTY_REPORT, EXPECT_ANY_REPORT and EXPECT_NO_REPORT for use with TestDriver. EXPECT_REPORT sets a gmock expectation that a given keyboard report will be sent. For instance, EXPECT_REPORT(driver, (KC_LSFT, KC_A)); is shorthand for EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LSFT, KC_A))); EXPECT_UNICODE sets a gmock expectation that a given Unicode code point will be sent using UC_LNX input mode. For instance for U+2013, EXPECT_UNICODE(driver, 0x2013); expects the sequence of keys: "Ctrl+Shift+U, 2, 0, 1, 3, space". EXPECT_EMPTY_REPORT sets a gmock expectation that a given keyboard report will be sent. For instance EXPECT_EMPTY_REPORT(driver); expects a single report without keypresses or modifiers. EXPECT_ANY_REPORT sets a gmock expectation that a arbitrary keyboard report will be sent, without matching its contents. For instance EXPECT_ANY_REPORT(driver).Times(1); expects a single arbitrary keyboard report will be sent. EXPECT_NO_REPORT sets a gmock expectation that no keyboard report will be sent at all. * Add tap_key() and tap_keys() to TestFixture. This commit adds a `tap_key(key)` method to TestFixture that taps a given KeymapKey, optionally with a specified delay between press and release. Similarly, the method `tap_keys(key_a, key_b, key_c)` taps a sequence of KeymapKeys. * Use EXPECT_REPORT, tap_keys, etc. in most tests. This commit uses EXPECT_REPORT, EXPECT_UNICODE, EXPECT_EMPTY_REPORT, EXPECT_NO_REPORT, tap_key() and tap_keys() test utilities from the previous two commits in most tests. Particularly the EXPECT_REPORT macro is frequently useful and makes a nice reduction in boilerplate needed to express many tests. Co-authored-by: David Kosorin <david@kosorin.net>
Diffstat (limited to 'tests/basic')
-rw-r--r--tests/basic/test_action_layer.cpp54
-rw-r--r--tests/basic/test_keypress.cpp96
-rw-r--r--tests/basic/test_one_shot_keys.cpp36
-rw-r--r--tests/basic/test_tapping.cpp34
4 files changed, 110 insertions, 110 deletions
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) {
131 set_keymap({layer_key}); 131 set_keymap({layer_key});
132 132
133 /* Press and release MO, nothing should happen. */ 133 /* Press and release MO, nothing should happen. */
134 EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); 134 EXPECT_NO_REPORT(driver);
135 layer_key.press(); 135 layer_key.press();
136 run_one_scan_loop(); 136 run_one_scan_loop();
137 testing::Mock::VerifyAndClearExpectations(&driver); 137 testing::Mock::VerifyAndClearExpectations(&driver);
138 138
139 EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); 139 EXPECT_NO_REPORT(driver);
140 layer_key.release(); 140 layer_key.release();
141 run_one_scan_loop(); 141 run_one_scan_loop();
142 testing::Mock::VerifyAndClearExpectations(&driver); 142 testing::Mock::VerifyAndClearExpectations(&driver);
@@ -151,28 +151,28 @@ TEST_F(ActionLayer, MomentaryLayerWithKeypress) {
151 set_keymap({layer_key, regular_key, KeymapKey{1, 1, 0, KC_B}}); 151 set_keymap({layer_key, regular_key, KeymapKey{1, 1, 0, KC_B}});
152 152
153 /* Press MO. */ 153 /* Press MO. */
154 EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); 154 EXPECT_NO_REPORT(driver);
155 layer_key.press(); 155 layer_key.press();
156 run_one_scan_loop(); 156 run_one_scan_loop();
157 EXPECT_TRUE(layer_state_is(1)); 157 EXPECT_TRUE(layer_state_is(1));
158 testing::Mock::VerifyAndClearExpectations(&driver); 158 testing::Mock::VerifyAndClearExpectations(&driver);
159 159
160 /* Press key on layer 1 */ 160 /* Press key on layer 1 */
161 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_B))).Times(1); 161 EXPECT_REPORT(driver, (KC_B)).Times(1);
162 regular_key.press(); 162 regular_key.press();
163 run_one_scan_loop(); 163 run_one_scan_loop();
164 EXPECT_TRUE(layer_state_is(1)); 164 EXPECT_TRUE(layer_state_is(1));
165 testing::Mock::VerifyAndClearExpectations(&driver); 165 testing::Mock::VerifyAndClearExpectations(&driver);
166 166
167 /* Release key on layer 1 */ 167 /* Release key on layer 1 */
168 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())).Times(1); 168 EXPECT_EMPTY_REPORT(driver);
169 regular_key.release(); 169 regular_key.release();
170 run_one_scan_loop(); 170 run_one_scan_loop();
171 EXPECT_TRUE(layer_state_is(1)); 171 EXPECT_TRUE(layer_state_is(1));
172 testing::Mock::VerifyAndClearExpectations(&driver); 172 testing::Mock::VerifyAndClearExpectations(&driver);
173 173
174 /* Release MO */ 174 /* Release MO */
175 EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); 175 EXPECT_NO_REPORT(driver);
176 layer_key.release(); 176 layer_key.release();
177 run_one_scan_loop(); 177 run_one_scan_loop();
178 EXPECT_TRUE(layer_state_is(0)); 178 EXPECT_TRUE(layer_state_is(0));
@@ -188,14 +188,14 @@ TEST_F(ActionLayer, ToggleLayerDoesNothing) {
188 set_keymap({layer_key}); 188 set_keymap({layer_key});
189 189
190 /* Press TG. Layer state should not change as it's applied on release. */ 190 /* Press TG. Layer state should not change as it's applied on release. */
191 EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); 191 EXPECT_NO_REPORT(driver);
192 layer_key.press(); 192 layer_key.press();
193 run_one_scan_loop(); 193 run_one_scan_loop();
194 EXPECT_TRUE(layer_state_is(1)); 194 EXPECT_TRUE(layer_state_is(1));
195 testing::Mock::VerifyAndClearExpectations(&driver); 195 testing::Mock::VerifyAndClearExpectations(&driver);
196 196
197 /* Release TG. */ 197 /* Release TG. */
198 EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); 198 EXPECT_NO_REPORT(driver);
199 layer_key.release(); 199 layer_key.release();
200 run_one_scan_loop(); 200 run_one_scan_loop();
201 EXPECT_TRUE(layer_state_is(1)); 201 EXPECT_TRUE(layer_state_is(1));
@@ -212,26 +212,26 @@ TEST_F(ActionLayer, ToggleLayerUpAndDown) {
212 set_keymap({toggle_layer_1_on_layer_0, toggle_layer_0_on_layer_1}); 212 set_keymap({toggle_layer_1_on_layer_0, toggle_layer_0_on_layer_1});
213 213
214 /* Toggle Layer 1. */ 214 /* Toggle Layer 1. */
215 EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); 215 EXPECT_NO_REPORT(driver);
216 toggle_layer_1_on_layer_0.press(); 216 toggle_layer_1_on_layer_0.press();
217 run_one_scan_loop(); 217 run_one_scan_loop();
218 EXPECT_TRUE(layer_state_is(1)); 218 EXPECT_TRUE(layer_state_is(1));
219 testing::Mock::VerifyAndClearExpectations(&driver); 219 testing::Mock::VerifyAndClearExpectations(&driver);
220 220
221 EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); 221 EXPECT_NO_REPORT(driver);
222 toggle_layer_1_on_layer_0.release(); 222 toggle_layer_1_on_layer_0.release();
223 run_one_scan_loop(); 223 run_one_scan_loop();
224 EXPECT_TRUE(layer_state_is(1)); 224 EXPECT_TRUE(layer_state_is(1));
225 testing::Mock::VerifyAndClearExpectations(&driver); 225 testing::Mock::VerifyAndClearExpectations(&driver);
226 226
227 /* Toggle Layer 0. */ 227 /* Toggle Layer 0. */
228 EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); 228 EXPECT_NO_REPORT(driver);
229 toggle_layer_0_on_layer_1.press(); 229 toggle_layer_0_on_layer_1.press();
230 run_one_scan_loop(); 230 run_one_scan_loop();
231 EXPECT_TRUE(layer_state_is(0)); 231 EXPECT_TRUE(layer_state_is(0));
232 testing::Mock::VerifyAndClearExpectations(&driver); 232 testing::Mock::VerifyAndClearExpectations(&driver);
233 233
234 EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); 234 EXPECT_NO_REPORT(driver);
235 toggle_layer_0_on_layer_1.release(); 235 toggle_layer_0_on_layer_1.release();
236 run_one_scan_loop(); 236 run_one_scan_loop();
237 EXPECT_TRUE(layer_state_is(0)); 237 EXPECT_TRUE(layer_state_is(0));
@@ -247,13 +247,13 @@ TEST_F(ActionLayer, LayerTapToggleDoesNothing) {
247 set_keymap({layer_key}); 247 set_keymap({layer_key});
248 248
249 /* Press and release TT. */ 249 /* Press and release TT. */
250 EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); 250 EXPECT_NO_REPORT(driver);
251 layer_key.press(); 251 layer_key.press();
252 run_one_scan_loop(); 252 run_one_scan_loop();
253 EXPECT_TRUE(layer_state_is(1)); 253 EXPECT_TRUE(layer_state_is(1));
254 testing::Mock::VerifyAndClearExpectations(&driver); 254 testing::Mock::VerifyAndClearExpectations(&driver);
255 255
256 EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); 256 EXPECT_NO_REPORT(driver);
257 layer_key.release(); 257 layer_key.release();
258 run_one_scan_loop(); 258 run_one_scan_loop();
259 EXPECT_TRUE(layer_state_is(0)); 259 EXPECT_TRUE(layer_state_is(0));
@@ -271,25 +271,25 @@ TEST_F(ActionLayer, LayerTapToggleWithKeypress) {
271 set_keymap({layer_key, regular_key, KeymapKey{1, 1, 0, KC_B}}); 271 set_keymap({layer_key, regular_key, KeymapKey{1, 1, 0, KC_B}});
272 272
273 /* Press TT. */ 273 /* Press TT. */
274 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())).Times(0); 274 EXPECT_NO_REPORT(driver);
275 layer_key.press(); 275 layer_key.press();
276 run_one_scan_loop(); 276 run_one_scan_loop();
277 EXPECT_TRUE(layer_state_is(1)); 277 EXPECT_TRUE(layer_state_is(1));
278 testing::Mock::VerifyAndClearExpectations(&driver); 278 testing::Mock::VerifyAndClearExpectations(&driver);
279 279
280 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_B))).Times(1); 280 EXPECT_REPORT(driver, (KC_B)).Times(1);
281 regular_key.press(); 281 regular_key.press();
282 run_one_scan_loop(); 282 run_one_scan_loop();
283 EXPECT_TRUE(layer_state_is(1)); 283 EXPECT_TRUE(layer_state_is(1));
284 testing::Mock::VerifyAndClearExpectations(&driver); 284 testing::Mock::VerifyAndClearExpectations(&driver);
285 285
286 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())).Times(1); 286 EXPECT_EMPTY_REPORT(driver);
287 regular_key.release(); 287 regular_key.release();
288 run_one_scan_loop(); 288 run_one_scan_loop();
289 EXPECT_TRUE(layer_state_is(1)); 289 EXPECT_TRUE(layer_state_is(1));
290 testing::Mock::VerifyAndClearExpectations(&driver); 290 testing::Mock::VerifyAndClearExpectations(&driver);
291 291
292 EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); 292 EXPECT_NO_REPORT(driver);
293 layer_key.release(); 293 layer_key.release();
294 run_one_scan_loop(); 294 run_one_scan_loop();
295 EXPECT_TRUE(layer_state_is(0)); 295 EXPECT_TRUE(layer_state_is(0));
@@ -307,7 +307,7 @@ TEST_F(ActionLayer, LayerTapToggleWithToggleWithKeypress) {
307 set_keymap({layer_key, regular_key, KeymapKey{1, 1, 0, KC_B}}); 307 set_keymap({layer_key, regular_key, KeymapKey{1, 1, 0, KC_B}});
308 308
309 /* Tap TT five times . */ 309 /* Tap TT five times . */
310 EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); 310 EXPECT_NO_REPORT(driver);
311 311
312 layer_key.press(); 312 layer_key.press();
313 run_one_scan_loop(); 313 run_one_scan_loop();
@@ -346,13 +346,13 @@ TEST_F(ActionLayer, LayerTapToggleWithToggleWithKeypress) {
346 346
347 testing::Mock::VerifyAndClearExpectations(&driver); 347 testing::Mock::VerifyAndClearExpectations(&driver);
348 348
349 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_B))).Times(1); 349 EXPECT_REPORT(driver, (KC_B)).Times(1);
350 regular_key.press(); 350 regular_key.press();
351 run_one_scan_loop(); 351 run_one_scan_loop();
352 EXPECT_TRUE(layer_state_is(1)); 352 EXPECT_TRUE(layer_state_is(1));
353 testing::Mock::VerifyAndClearExpectations(&driver); 353 testing::Mock::VerifyAndClearExpectations(&driver);
354 354
355 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())).Times(1); 355 EXPECT_EMPTY_REPORT(driver);
356 regular_key.release(); 356 regular_key.release();
357 run_one_scan_loop(); 357 run_one_scan_loop();
358 EXPECT_TRUE(layer_state_is(1)); 358 EXPECT_TRUE(layer_state_is(1));
@@ -370,7 +370,7 @@ TEST_F(ActionLayer, LayerTapReleasedBeforeKeypressReleaseWithModifiers) {
370 set_keymap({layer_0_key_0, layer_1_key_1}); 370 set_keymap({layer_0_key_0, layer_1_key_1});
371 371
372 /* Press layer tap and wait for tapping term to switch to layer 1 */ 372 /* Press layer tap and wait for tapping term to switch to layer 1 */
373 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())).Times(0); 373 EXPECT_NO_REPORT(driver);
374 layer_0_key_0.press(); 374 layer_0_key_0.press();
375 idle_for(TAPPING_TERM); 375 idle_for(TAPPING_TERM);
376 EXPECT_TRUE(layer_state_is(0)); 376 EXPECT_TRUE(layer_state_is(0));
@@ -378,23 +378,23 @@ TEST_F(ActionLayer, LayerTapReleasedBeforeKeypressReleaseWithModifiers) {
378 378
379 /* Press key with layer 1 mapping, result basically expected 379 /* Press key with layer 1 mapping, result basically expected
380 * altough more reports are send then necessary. */ 380 * altough more reports are send then necessary. */
381 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_RALT))).Times(1); 381 EXPECT_REPORT(driver, (KC_RALT)).Times(1);
382 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_RALT, KC_9))).Times(1); 382 EXPECT_REPORT(driver, (KC_RALT, KC_9)).Times(1);
383 layer_1_key_1.press(); 383 layer_1_key_1.press();
384 run_one_scan_loop(); 384 run_one_scan_loop();
385 EXPECT_TRUE(layer_state_is(1)); 385 EXPECT_TRUE(layer_state_is(1));
386 testing::Mock::VerifyAndClearExpectations(&driver); 386 testing::Mock::VerifyAndClearExpectations(&driver);
387 387
388 /* Release layer tap key, no report is send because key is still held. */ 388 /* Release layer tap key, no report is send because key is still held. */
389 EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); 389 EXPECT_NO_REPORT(driver);
390 layer_0_key_0.release(); 390 layer_0_key_0.release();
391 run_one_scan_loop(); 391 run_one_scan_loop();
392 EXPECT_TRUE(layer_state_is(0)); 392 EXPECT_TRUE(layer_state_is(0));
393 testing::Mock::VerifyAndClearExpectations(&driver); 393 testing::Mock::VerifyAndClearExpectations(&driver);
394 394
395 /* Unregister keycode and modifier. */ 395 /* Unregister keycode and modifier. */
396 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_RALT))).Times(1); 396 EXPECT_REPORT(driver, (KC_RALT)).Times(1);
397 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())).Times(1); 397 EXPECT_EMPTY_REPORT(driver);
398 layer_1_key_1.release(); 398 layer_1_key_1.release();
399 run_one_scan_loop(); 399 run_one_scan_loop();
400 EXPECT_TRUE(layer_state_is(0)); 400 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 {};
24 24
25TEST_F(KeyPress, SendKeyboardIsNotCalledWhenNoKeyIsPressed) { 25TEST_F(KeyPress, SendKeyboardIsNotCalledWhenNoKeyIsPressed) {
26 TestDriver driver; 26 TestDriver driver;
27 EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); 27 EXPECT_NO_REPORT(driver);
28 keyboard_task(); 28 keyboard_task();
29} 29}
30 30
@@ -35,11 +35,11 @@ TEST_F(KeyPress, CorrectKeyIsReportedWhenPressed) {
35 set_keymap({key}); 35 set_keymap({key});
36 36
37 key.press(); 37 key.press();
38 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(key.report_code))); 38 EXPECT_REPORT(driver, (key.report_code));
39 keyboard_task(); 39 keyboard_task();
40 40
41 key.release(); 41 key.release();
42 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); 42 EXPECT_EMPTY_REPORT(driver);
43 keyboard_task(); 43 keyboard_task();
44} 44}
45 45
@@ -50,7 +50,7 @@ TEST_F(KeyPress, ANonMappedKeyDoesNothing) {
50 set_keymap({key}); 50 set_keymap({key});
51 51
52 key.press(); 52 key.press();
53 EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); 53 EXPECT_NO_REPORT(driver);
54 keyboard_task(); 54 keyboard_task();
55 keyboard_task(); 55 keyboard_task();
56} 56}
@@ -66,19 +66,19 @@ TEST_F(KeyPress, CorrectKeysAreReportedWhenTwoKeysArePressed) {
66 key_c.press(); 66 key_c.press();
67 // Note that QMK only processes one key at a time 67 // Note that QMK only processes one key at a time
68 // See issue #1476 for more information 68 // See issue #1476 for more information
69 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(key_b.report_code))); 69 EXPECT_REPORT(driver, (key_b.report_code));
70 keyboard_task(); 70 keyboard_task();
71 71
72 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(key_b.report_code, key_c.report_code))); 72 EXPECT_REPORT(driver, (key_b.report_code, key_c.report_code));
73 keyboard_task(); 73 keyboard_task();
74 74
75 key_b.release(); 75 key_b.release();
76 key_c.release(); 76 key_c.release();
77 // Note that the first key released is the first one in the matrix order 77 // Note that the first key released is the first one in the matrix order
78 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(key_c.report_code))); 78 EXPECT_REPORT(driver, (key_c.report_code));
79 keyboard_task(); 79 keyboard_task();
80 80
81 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); 81 EXPECT_EMPTY_REPORT(driver);
82 keyboard_task(); 82 keyboard_task();
83} 83}
84 84
@@ -94,17 +94,17 @@ TEST_F(KeyPress, LeftShiftIsReportedCorrectly) {
94 94
95 // Unfortunately modifiers are also processed in the wrong order 95 // Unfortunately modifiers are also processed in the wrong order
96 // See issue #1476 for more information 96 // See issue #1476 for more information
97 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(key_a.report_code))); 97 EXPECT_REPORT(driver, (key_a.report_code));
98 keyboard_task(); 98 keyboard_task();
99 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(key_a.report_code, key_lsft.report_code))); 99 EXPECT_REPORT(driver, (key_a.report_code, key_lsft.report_code));
100 keyboard_task(); 100 keyboard_task();
101 101
102 key_a.release(); 102 key_a.release();
103 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(key_lsft.report_code))); 103 EXPECT_REPORT(driver, (key_lsft.report_code));
104 keyboard_task(); 104 keyboard_task();
105 105
106 key_lsft.release(); 106 key_lsft.release();
107 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); 107 EXPECT_EMPTY_REPORT(driver);
108 keyboard_task(); 108 keyboard_task();
109} 109}
110 110
@@ -120,19 +120,19 @@ TEST_F(KeyPress, PressLeftShiftAndControl) {
120 120
121 // Unfortunately modifiers are also processed in the wrong order 121 // Unfortunately modifiers are also processed in the wrong order
122 // See issue #1476 for more information 122 // See issue #1476 for more information
123 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(key_lsft.report_code))); 123 EXPECT_REPORT(driver, (key_lsft.report_code));
124 keyboard_task(); 124 keyboard_task();
125 125
126 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(key_lsft.report_code, key_lctrl.report_code))); 126 EXPECT_REPORT(driver, (key_lsft.report_code, key_lctrl.report_code));
127 keyboard_task(); 127 keyboard_task();
128 128
129 key_lsft.release(); 129 key_lsft.release();
130 key_lctrl.release(); 130 key_lctrl.release();
131 131
132 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(key_lctrl.report_code))); 132 EXPECT_REPORT(driver, (key_lctrl.report_code));
133 keyboard_task(); 133 keyboard_task();
134 134
135 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); 135 EXPECT_EMPTY_REPORT(driver);
136 keyboard_task(); 136 keyboard_task();
137} 137}
138 138
@@ -147,19 +147,19 @@ TEST_F(KeyPress, LeftAndRightShiftCanBePressedAtTheSameTime) {
147 key_rsft.press(); 147 key_rsft.press();
148 // Unfortunately modifiers are also processed in the wrong order 148 // Unfortunately modifiers are also processed in the wrong order
149 // See issue #1476 for more information 149 // See issue #1476 for more information
150 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(key_lsft.report_code))); 150 EXPECT_REPORT(driver, (key_lsft.report_code));
151 keyboard_task(); 151 keyboard_task();
152 152
153 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(key_lsft.report_code, key_rsft.report_code))); 153 EXPECT_REPORT(driver, (key_lsft.report_code, key_rsft.report_code));
154 keyboard_task(); 154 keyboard_task();
155 155
156 key_lsft.release(); 156 key_lsft.release();
157 key_rsft.release(); 157 key_rsft.release();
158 158
159 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(key_rsft.report_code))); 159 EXPECT_REPORT(driver, (key_rsft.report_code));
160 keyboard_task(); 160 keyboard_task();
161 161
162 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); 162 EXPECT_EMPTY_REPORT(driver);
163 keyboard_task(); 163 keyboard_task();
164} 164}
165 165
@@ -175,13 +175,13 @@ TEST_F(KeyPress, RightShiftLeftControlAndCharWithTheSameKey) {
175 // The underlying cause is that we use only one bit to represent the right hand 175 // The underlying cause is that we use only one bit to represent the right hand
176 // modifiers. 176 // modifiers.
177 combo_key.press(); 177 combo_key.press();
178 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_RIGHT_SHIFT, KC_RIGHT_CTRL))); 178 EXPECT_REPORT(driver, (KC_RIGHT_SHIFT, KC_RIGHT_CTRL));
179 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_RIGHT_SHIFT, KC_RIGHT_CTRL, KC_O))); 179 EXPECT_REPORT(driver, (KC_RIGHT_SHIFT, KC_RIGHT_CTRL, KC_O));
180 keyboard_task(); 180 keyboard_task();
181 181
182 combo_key.release(); 182 combo_key.release();
183 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_RIGHT_SHIFT, KC_RIGHT_CTRL))); 183 EXPECT_REPORT(driver, (KC_RIGHT_SHIFT, KC_RIGHT_CTRL));
184 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); 184 EXPECT_EMPTY_REPORT(driver);
185 keyboard_task(); 185 keyboard_task();
186} 186}
187 187
@@ -194,24 +194,24 @@ TEST_F(KeyPress, PressPlusEqualReleaseBeforePress) {
194 set_keymap({key_plus, key_eql}); 194 set_keymap({key_plus, key_eql});
195 195
196 key_plus.press(); 196 key_plus.press();
197 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT))); 197 EXPECT_REPORT(driver, (KC_LEFT_SHIFT));
198 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT, KC_EQUAL))); 198 EXPECT_REPORT(driver, (KC_LEFT_SHIFT, KC_EQUAL));
199 run_one_scan_loop(); 199 run_one_scan_loop();
200 testing::Mock::VerifyAndClearExpectations(&driver); 200 testing::Mock::VerifyAndClearExpectations(&driver);
201 201
202 key_plus.release(); 202 key_plus.release();
203 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT))); 203 EXPECT_REPORT(driver, (KC_LEFT_SHIFT));
204 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); 204 EXPECT_EMPTY_REPORT(driver);
205 run_one_scan_loop(); 205 run_one_scan_loop();
206 testing::Mock::VerifyAndClearExpectations(&driver); 206 testing::Mock::VerifyAndClearExpectations(&driver);
207 207
208 key_eql.press(); 208 key_eql.press();
209 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(key_eql.report_code))); 209 EXPECT_REPORT(driver, (key_eql.report_code));
210 run_one_scan_loop(); 210 run_one_scan_loop();
211 testing::Mock::VerifyAndClearExpectations(&driver); 211 testing::Mock::VerifyAndClearExpectations(&driver);
212 212
213 key_eql.release(); 213 key_eql.release();
214 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); 214 EXPECT_EMPTY_REPORT(driver);
215 run_one_scan_loop(); 215 run_one_scan_loop();
216 testing::Mock::VerifyAndClearExpectations(&driver); 216 testing::Mock::VerifyAndClearExpectations(&driver);
217} 217}
@@ -225,25 +225,25 @@ TEST_F(KeyPress, PressPlusEqualDontReleaseBeforePress) {
225 set_keymap({key_plus, key_eql}); 225 set_keymap({key_plus, key_eql});
226 226
227 key_plus.press(); 227 key_plus.press();
228 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT))); 228 EXPECT_REPORT(driver, (KC_LEFT_SHIFT));
229 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT, KC_EQUAL))); 229 EXPECT_REPORT(driver, (KC_LEFT_SHIFT, KC_EQUAL));
230 run_one_scan_loop(); 230 run_one_scan_loop();
231 testing::Mock::VerifyAndClearExpectations(&driver); 231 testing::Mock::VerifyAndClearExpectations(&driver);
232 232
233 key_eql.press(); 233 key_eql.press();
234 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); 234 EXPECT_EMPTY_REPORT(driver);
235 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_EQUAL))); 235 EXPECT_REPORT(driver, (KC_EQUAL));
236 run_one_scan_loop(); 236 run_one_scan_loop();
237 testing::Mock::VerifyAndClearExpectations(&driver); 237 testing::Mock::VerifyAndClearExpectations(&driver);
238 238
239 key_plus.release(); 239 key_plus.release();
240 // BUG: Should really still return KC_EQUAL, but this is fine too 240 // BUG: Should really still return KC_EQUAL, but this is fine too
241 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())).Times(1); 241 EXPECT_EMPTY_REPORT(driver);
242 run_one_scan_loop(); 242 run_one_scan_loop();
243 testing::Mock::VerifyAndClearExpectations(&driver); 243 testing::Mock::VerifyAndClearExpectations(&driver);
244 244
245 key_eql.release(); 245 key_eql.release();
246 EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); 246 EXPECT_NO_REPORT(driver);
247 run_one_scan_loop(); 247 run_one_scan_loop();
248 testing::Mock::VerifyAndClearExpectations(&driver); 248 testing::Mock::VerifyAndClearExpectations(&driver);
249} 249}
@@ -257,24 +257,24 @@ TEST_F(KeyPress, PressEqualPlusReleaseBeforePress) {
257 set_keymap({key_plus, key_eql}); 257 set_keymap({key_plus, key_eql});
258 258
259 key_eql.press(); 259 key_eql.press();
260 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_EQUAL))); 260 EXPECT_REPORT(driver, (KC_EQUAL));
261 run_one_scan_loop(); 261 run_one_scan_loop();
262 testing::Mock::VerifyAndClearExpectations(&driver); 262 testing::Mock::VerifyAndClearExpectations(&driver);
263 263
264 key_eql.release(); 264 key_eql.release();
265 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); 265 EXPECT_EMPTY_REPORT(driver);
266 run_one_scan_loop(); 266 run_one_scan_loop();
267 testing::Mock::VerifyAndClearExpectations(&driver); 267 testing::Mock::VerifyAndClearExpectations(&driver);
268 268
269 key_plus.press(); 269 key_plus.press();
270 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT))); 270 EXPECT_REPORT(driver, (KC_LEFT_SHIFT));
271 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT, KC_EQUAL))); 271 EXPECT_REPORT(driver, (KC_LEFT_SHIFT, KC_EQUAL));
272 run_one_scan_loop(); 272 run_one_scan_loop();
273 testing::Mock::VerifyAndClearExpectations(&driver); 273 testing::Mock::VerifyAndClearExpectations(&driver);
274 274
275 key_plus.release(); 275 key_plus.release();
276 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT))); 276 EXPECT_REPORT(driver, (KC_LEFT_SHIFT));
277 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); 277 EXPECT_EMPTY_REPORT(driver);
278 run_one_scan_loop(); 278 run_one_scan_loop();
279 testing::Mock::VerifyAndClearExpectations(&driver); 279 testing::Mock::VerifyAndClearExpectations(&driver);
280} 280}
@@ -288,27 +288,27 @@ TEST_F(KeyPress, PressEqualPlusDontReleaseBeforePress) {
288 set_keymap({key_plus, key_eql}); 288 set_keymap({key_plus, key_eql});
289 289
290 key_eql.press(); 290 key_eql.press();
291 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_EQUAL))); 291 EXPECT_REPORT(driver, (KC_EQUAL));
292 run_one_scan_loop(); 292 run_one_scan_loop();
293 testing::Mock::VerifyAndClearExpectations(&driver); 293 testing::Mock::VerifyAndClearExpectations(&driver);
294 294
295 key_plus.press(); 295 key_plus.press();
296 // BUG: The sequence is a bit strange, but it works, the end result is that 296 // BUG: The sequence is a bit strange, but it works, the end result is that
297 // KC_PLUS is sent 297 // KC_PLUS is sent
298 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT, KC_EQUAL))); 298 EXPECT_REPORT(driver, (KC_LEFT_SHIFT, KC_EQUAL));
299 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT))); 299 EXPECT_REPORT(driver, (KC_LEFT_SHIFT));
300 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT, KC_EQUAL))); 300 EXPECT_REPORT(driver, (KC_LEFT_SHIFT, KC_EQUAL));
301 run_one_scan_loop(); 301 run_one_scan_loop();
302 testing::Mock::VerifyAndClearExpectations(&driver); 302 testing::Mock::VerifyAndClearExpectations(&driver);
303 303
304 key_eql.release(); 304 key_eql.release();
305 // I guess it's fine to still report shift here 305 // I guess it's fine to still report shift here
306 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT))); 306 EXPECT_REPORT(driver, (KC_LEFT_SHIFT));
307 run_one_scan_loop(); 307 run_one_scan_loop();
308 testing::Mock::VerifyAndClearExpectations(&driver); 308 testing::Mock::VerifyAndClearExpectations(&driver);
309 309
310 key_plus.release(); 310 key_plus.release();
311 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); 311 EXPECT_EMPTY_REPORT(driver);
312 run_one_scan_loop(); 312 run_one_scan_loop();
313 testing::Mock::VerifyAndClearExpectations(&driver); 313 testing::Mock::VerifyAndClearExpectations(&driver);
314} 314}
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) {
31 set_keymap({osm_key}); 31 set_keymap({osm_key});
32 32
33 /* Press and release OSM key*/ 33 /* Press and release OSM key*/
34 EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); 34 EXPECT_NO_REPORT(driver);
35 osm_key.press(); 35 osm_key.press();
36 run_one_scan_loop(); 36 run_one_scan_loop();
37 osm_key.release(); 37 osm_key.release();
@@ -39,7 +39,7 @@ TEST_F(OneShot, OSMWithoutAdditionalKeypressDoesNothing) {
39 testing::Mock::VerifyAndClearExpectations(&driver); 39 testing::Mock::VerifyAndClearExpectations(&driver);
40 40
41 /* OSM are added when an actual report is send */ 41 /* OSM are added when an actual report is send */
42 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(osm_key.report_code))); 42 EXPECT_REPORT(driver, (osm_key.report_code));
43 send_keyboard_report(); 43 send_keyboard_report();
44 testing::Mock::VerifyAndClearExpectations(&driver); 44 testing::Mock::VerifyAndClearExpectations(&driver);
45 45
@@ -57,7 +57,7 @@ TEST_P(OneShotParametrizedTestFixture, OSMExpiredDoesNothing) {
57 set_keymap({osm_key, regular_key}); 57 set_keymap({osm_key, regular_key});
58 58
59 /* Press and release OSM */ 59 /* Press and release OSM */
60 EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); 60 EXPECT_NO_REPORT(driver);
61 osm_key.press(); 61 osm_key.press();
62 run_one_scan_loop(); 62 run_one_scan_loop();
63 osm_key.release(); 63 osm_key.release();
@@ -65,13 +65,13 @@ TEST_P(OneShotParametrizedTestFixture, OSMExpiredDoesNothing) {
65 testing::Mock::VerifyAndClearExpectations(&driver); 65 testing::Mock::VerifyAndClearExpectations(&driver);
66 66
67 /* Press regular key */ 67 /* Press regular key */
68 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(regular_key.report_code))).Times(1); 68 EXPECT_REPORT(driver, (regular_key.report_code)).Times(1);
69 regular_key.press(); 69 regular_key.press();
70 run_one_scan_loop(); 70 run_one_scan_loop();
71 testing::Mock::VerifyAndClearExpectations(&driver); 71 testing::Mock::VerifyAndClearExpectations(&driver);
72 72
73 /* Release regular key */ 73 /* Release regular key */
74 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); 74 EXPECT_EMPTY_REPORT(driver);
75 regular_key.release(); 75 regular_key.release();
76 run_one_scan_loop(); 76 run_one_scan_loop();
77 testing::Mock::VerifyAndClearExpectations(&driver); 77 testing::Mock::VerifyAndClearExpectations(&driver);
@@ -87,7 +87,7 @@ TEST_P(OneShotParametrizedTestFixture, OSMWithAdditionalKeypress) {
87 set_keymap({osm_key, regular_key}); 87 set_keymap({osm_key, regular_key});
88 88
89 /* Press and release OSM */ 89 /* Press and release OSM */
90 EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); 90 EXPECT_NO_REPORT(driver);
91 osm_key.press(); 91 osm_key.press();
92 run_one_scan_loop(); 92 run_one_scan_loop();
93 osm_key.release(); 93 osm_key.release();
@@ -95,13 +95,13 @@ TEST_P(OneShotParametrizedTestFixture, OSMWithAdditionalKeypress) {
95 testing::Mock::VerifyAndClearExpectations(&driver); 95 testing::Mock::VerifyAndClearExpectations(&driver);
96 96
97 /* Press regular key */ 97 /* Press regular key */
98 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(osm_key.report_code, regular_key.report_code))).Times(1); 98 EXPECT_REPORT(driver, (osm_key.report_code, regular_key.report_code)).Times(1);
99 regular_key.press(); 99 regular_key.press();
100 run_one_scan_loop(); 100 run_one_scan_loop();
101 testing::Mock::VerifyAndClearExpectations(&driver); 101 testing::Mock::VerifyAndClearExpectations(&driver);
102 102
103 /* Release regular key */ 103 /* Release regular key */
104 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); 104 EXPECT_EMPTY_REPORT(driver);
105 regular_key.release(); 105 regular_key.release();
106 run_one_scan_loop(); 106 run_one_scan_loop();
107 testing::Mock::VerifyAndClearExpectations(&driver); 107 testing::Mock::VerifyAndClearExpectations(&driver);
@@ -117,26 +117,26 @@ TEST_P(OneShotParametrizedTestFixture, OSMAsRegularModifierWithAdditionalKeypres
117 set_keymap({osm_key, regular_key}); 117 set_keymap({osm_key, regular_key});
118 118
119 /* Press OSM */ 119 /* Press OSM */
120 EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); 120 EXPECT_NO_REPORT(driver);
121 osm_key.press(); 121 osm_key.press();
122 run_one_scan_loop(); 122 run_one_scan_loop();
123 testing::Mock::VerifyAndClearExpectations(&driver); 123 testing::Mock::VerifyAndClearExpectations(&driver);
124 124
125 /* Press regular key */ 125 /* Press regular key */
126 EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); 126 EXPECT_NO_REPORT(driver);
127 regular_key.press(); 127 regular_key.press();
128 run_one_scan_loop(); 128 run_one_scan_loop();
129 testing::Mock::VerifyAndClearExpectations(&driver); 129 testing::Mock::VerifyAndClearExpectations(&driver);
130 130
131 /* Release regular key */ 131 /* Release regular key */
132 EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); 132 EXPECT_NO_REPORT(driver);
133 regular_key.release(); 133 regular_key.release();
134 run_one_scan_loop(); 134 run_one_scan_loop();
135 testing::Mock::VerifyAndClearExpectations(&driver); 135 testing::Mock::VerifyAndClearExpectations(&driver);
136 136
137 /* Release OSM */ 137 /* Release OSM */
138 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(regular_key.report_code, osm_key.report_code))).Times(1); 138 EXPECT_REPORT(driver, (regular_key.report_code, osm_key.report_code)).Times(1);
139 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())).Times(1); 139 EXPECT_EMPTY_REPORT(driver);
140 osm_key.release(); 140 osm_key.release();
141 run_one_scan_loop(); 141 run_one_scan_loop();
142 testing::Mock::VerifyAndClearExpectations(&driver); 142 testing::Mock::VerifyAndClearExpectations(&driver);
@@ -169,26 +169,26 @@ TEST_F(OneShot, OSLWithAdditionalKeypress) {
169 set_keymap({osl_key, regular_key}); 169 set_keymap({osl_key, regular_key});
170 170
171 /* Press OSL key */ 171 /* Press OSL key */
172 EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); 172 EXPECT_NO_REPORT(driver);
173 osl_key.press(); 173 osl_key.press();
174 run_one_scan_loop(); 174 run_one_scan_loop();
175 testing::Mock::VerifyAndClearExpectations(&driver); 175 testing::Mock::VerifyAndClearExpectations(&driver);
176 176
177 /* Release OSL key */ 177 /* Release OSL key */
178 EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); 178 EXPECT_NO_REPORT(driver);
179 osl_key.release(); 179 osl_key.release();
180 run_one_scan_loop(); 180 run_one_scan_loop();
181 testing::Mock::VerifyAndClearExpectations(&driver); 181 testing::Mock::VerifyAndClearExpectations(&driver);
182 182
183 /* Press regular key */ 183 /* Press regular key */
184 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(regular_key.report_code))).Times(1); 184 EXPECT_REPORT(driver, (regular_key.report_code)).Times(1);
185 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); 185 EXPECT_EMPTY_REPORT(driver);
186 regular_key.press(); 186 regular_key.press();
187 run_one_scan_loop(); 187 run_one_scan_loop();
188 testing::Mock::VerifyAndClearExpectations(&driver); 188 testing::Mock::VerifyAndClearExpectations(&driver);
189 189
190 /* Release regular key */ 190 /* Release regular key */
191 EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); 191 EXPECT_NO_REPORT(driver);
192 regular_key.release(); 192 regular_key.release();
193 run_one_scan_loop(); 193 run_one_scan_loop();
194 testing::Mock::VerifyAndClearExpectations(&driver); 194 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) {
34 34
35 // Tapping keys does nothing on press 35 // Tapping keys does nothing on press
36 key_shift_hold_p_tap.press(); 36 key_shift_hold_p_tap.press();
37 EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); 37 EXPECT_NO_REPORT(driver);
38 run_one_scan_loop(); 38 run_one_scan_loop();
39 39
40 // First we get the key press 40 // First we get the key press
41 key_shift_hold_p_tap.release(); 41 key_shift_hold_p_tap.release();
42 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_P))); 42 EXPECT_REPORT(driver, (KC_P));
43 43
44 // Then the release 44 // Then the release
45 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); 45 EXPECT_EMPTY_REPORT(driver);
46 run_one_scan_loop(); 46 run_one_scan_loop();
47} 47}
48 48
@@ -56,13 +56,13 @@ TEST_F(Tapping, HoldA_SHFT_T_KeyReportsShift) {
56 mod_tap_hold_key.press(); 56 mod_tap_hold_key.press();
57 57
58 // Tapping keys does nothing on press 58 // Tapping keys does nothing on press
59 EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); 59 EXPECT_NO_REPORT(driver);
60 idle_for(TAPPING_TERM); 60 idle_for(TAPPING_TERM);
61 61
62 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LSFT))); 62 EXPECT_REPORT(driver, (KC_LSFT));
63 run_one_scan_loop(); 63 run_one_scan_loop();
64 64
65 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); 65 EXPECT_EMPTY_REPORT(driver);
66 mod_tap_hold_key.release(); 66 mod_tap_hold_key.release();
67 run_one_scan_loop(); 67 run_one_scan_loop();
68} 68}
@@ -77,36 +77,36 @@ TEST_F(Tapping, ANewTapWithinTappingTermIsBuggy) {
77 77
78 // Tapping keys does nothing on press 78 // Tapping keys does nothing on press
79 key_shift_hold_p_tap.press(); 79 key_shift_hold_p_tap.press();
80 EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); 80 EXPECT_NO_REPORT(driver);
81 run_one_scan_loop(); 81 run_one_scan_loop();
82 key_shift_hold_p_tap.release(); 82 key_shift_hold_p_tap.release();
83 83
84 // First we get the key press 84 // First we get the key press
85 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_P))); 85 EXPECT_REPORT(driver, (KC_P));
86 // Then the release 86 // Then the release
87 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); 87 EXPECT_EMPTY_REPORT(driver);
88 run_one_scan_loop(); 88 run_one_scan_loop();
89 89
90 // This sends KC_P, even if it should do nothing 90 // This sends KC_P, even if it should do nothing
91 key_shift_hold_p_tap.press(); 91 key_shift_hold_p_tap.press();
92 // This test should not succed if everything works correctly 92 // This test should not succed if everything works correctly
93 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_P))); 93 EXPECT_REPORT(driver, (KC_P));
94 run_one_scan_loop(); 94 run_one_scan_loop();
95 95
96 key_shift_hold_p_tap.release(); 96 key_shift_hold_p_tap.release();
97 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); 97 EXPECT_EMPTY_REPORT(driver);
98 idle_for(TAPPING_TERM + 1); 98 idle_for(TAPPING_TERM + 1);
99 99
100 // On the other hand, nothing is sent if we are outside the tapping term 100 // On the other hand, nothing is sent if we are outside the tapping term
101 key_shift_hold_p_tap.press(); 101 key_shift_hold_p_tap.press();
102 EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); 102 EXPECT_NO_REPORT(driver);
103 run_one_scan_loop(); 103 run_one_scan_loop();
104 key_shift_hold_p_tap.release(); 104 key_shift_hold_p_tap.release();
105 105
106 // First we get the key press 106 // First we get the key press
107 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_P))); 107 EXPECT_REPORT(driver, (KC_P));
108 // Then the release 108 // Then the release
109 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); 109 EXPECT_EMPTY_REPORT(driver);
110 idle_for(TAPPING_TERM + 1); 110 idle_for(TAPPING_TERM + 1);
111 111
112 // Now we are geting into strange territory, as the hold registers too early here 112 // Now we are geting into strange territory, as the hold registers too early here
@@ -114,10 +114,10 @@ TEST_F(Tapping, ANewTapWithinTappingTermIsBuggy) {
114 // If TAPPING_TERM + 1 above is changed to TAPPING_TERM or TAPPING_TERM + 2 it doesn't 114 // If TAPPING_TERM + 1 above is changed to TAPPING_TERM or TAPPING_TERM + 2 it doesn't
115 key_shift_hold_p_tap.press(); 115 key_shift_hold_p_tap.press();
116 // Shouldn't be called here really 116 // Shouldn't be called here really
117 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT))).Times(1); 117 EXPECT_REPORT(driver, (KC_LEFT_SHIFT)).Times(1);
118 idle_for(TAPPING_TERM); 118 idle_for(TAPPING_TERM);
119 119
120 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); 120 EXPECT_EMPTY_REPORT(driver);
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} \ No newline at end of file 123}