summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto_shift/test_auto_shift.cpp8
-rw-r--r--tests/autocorrect/test_autocorrect.cpp12
-rw-r--r--tests/basic/test_action_layer.cpp66
-rw-r--r--tests/basic/test_keycode_util.cpp52
-rw-r--r--tests/basic/test_keypress.cpp32
-rw-r--r--tests/basic/test_one_shot_keys.cpp32
-rw-r--r--tests/basic/test_tapping.cpp69
-rw-r--r--tests/caps_word/caps_word_autoshift/test_caps_word_autoshift.cpp6
-rw-r--r--tests/caps_word/caps_word_combo/test_caps_word_combo.cpp8
-rw-r--r--tests/caps_word/caps_word_unicodemap/test_caps_word_unicodemap.cpp4
-rw-r--r--tests/caps_word/test_caps_word.cpp90
-rw-r--r--tests/secure/test_secure.cpp20
-rw-r--r--tests/tap_dance/examples.c22
-rw-r--r--tests/tap_dance/tap_dance_layers/tap_dance_defs.c8
-rw-r--r--tests/tap_hold_configurations/default_mod_tap/config.h2
-rw-r--r--tests/tap_hold_configurations/default_mod_tap/test_one_shot_layer.cpp248
-rw-r--r--tests/tap_hold_configurations/default_mod_tap/test_tap_hold.cpp48
-rw-r--r--tests/tap_hold_configurations/hold_on_other_key_press/test_tap_hold.cpp94
-rw-r--r--tests/tap_hold_configurations/ignore_mod_tap_interrupt/config.h21
-rw-r--r--tests/tap_hold_configurations/ignore_mod_tap_interrupt/test_tap_hold.cpp136
-rw-r--r--tests/tap_hold_configurations/permissive_hold/test_one_shot_keys.cpp8
-rw-r--r--tests/tap_hold_configurations/permissive_hold/test_tap_hold.cpp26
-rw-r--r--tests/tap_hold_configurations/permissive_hold_ignore_mod_tap_interrupt/config.h22
-rw-r--r--tests/tap_hold_configurations/permissive_hold_ignore_mod_tap_interrupt/test.mk18
-rw-r--r--tests/tap_hold_configurations/permissive_hold_ignore_mod_tap_interrupt/test_tap_hold.cpp133
-rw-r--r--tests/tap_hold_configurations/quick_tap/config.h (renamed from tests/tap_hold_configurations/tapping_force_hold/config.h)2
-rw-r--r--tests/tap_hold_configurations/quick_tap/test.mk (renamed from tests/tap_hold_configurations/ignore_mod_tap_interrupt/test.mk)0
-rw-r--r--tests/tap_hold_configurations/quick_tap/test_action_layer.cpp (renamed from tests/tap_hold_configurations/tapping_force_hold/test_action_layer.cpp)8
-rw-r--r--tests/tap_hold_configurations/quick_tap/test_quick_tap.cpp290
-rw-r--r--tests/tap_hold_configurations/retro_tapping/test_tap_hold.cpp4
-rw-r--r--tests/tap_hold_configurations/retro_tapping/test_tapping.cpp22
-rw-r--r--tests/tap_hold_configurations/tapping_force_hold/test.mk18
-rw-r--r--tests/tap_hold_configurations/tapping_force_hold/test_tap_hold.cpp213
-rw-r--r--tests/test_common/keyboard_report_util.cpp45
-rw-r--r--tests/test_common/keycode_table.cpp663
-rw-r--r--tests/test_common/keycode_util.cpp128
-rw-r--r--tests/test_common/keycode_util.hpp5
-rw-r--r--tests/test_common/matrix.c8
-rw-r--r--tests/test_common/test_common.hpp1
-rw-r--r--tests/test_common/test_driver.hpp6
-rw-r--r--tests/test_common/test_fixture.cpp33
-rw-r--r--tests/test_common/test_keymap_key.cpp16
-rw-r--r--tests/test_common/test_keymap_key.hpp16
-rw-r--r--tests/test_common/test_logger.cpp16
-rw-r--r--tests/test_common/test_logger.hpp8
45 files changed, 1860 insertions, 827 deletions
diff --git a/tests/auto_shift/test_auto_shift.cpp b/tests/auto_shift/test_auto_shift.cpp
index a83f436c33..1d80634b2f 100644
--- a/tests/auto_shift/test_auto_shift.cpp
+++ b/tests/auto_shift/test_auto_shift.cpp
@@ -37,14 +37,14 @@ TEST_F(AutoShift, key_release_before_timeout) {
EXPECT_NO_REPORT(driver);
regular_key.press();
run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
/* Release regular key */
EXPECT_REPORT(driver, (KC_A));
EXPECT_EMPTY_REPORT(driver);
regular_key.release();
run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
TEST_F(AutoShift, key_release_after_timeout) {
@@ -58,7 +58,7 @@ TEST_F(AutoShift, key_release_after_timeout) {
EXPECT_NO_REPORT(driver);
regular_key.press();
idle_for(AUTO_SHIFT_TIMEOUT);
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
/* Release regular key */
EXPECT_REPORT(driver, (KC_LSFT, KC_A));
@@ -66,5 +66,5 @@ TEST_F(AutoShift, key_release_after_timeout) {
EXPECT_EMPTY_REPORT(driver);
regular_key.release();
run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
diff --git a/tests/autocorrect/test_autocorrect.cpp b/tests/autocorrect/test_autocorrect.cpp
index 509c1c9ea4..9b8db3d68d 100644
--- a/tests/autocorrect/test_autocorrect.cpp
+++ b/tests/autocorrect/test_autocorrect.cpp
@@ -51,7 +51,7 @@ TEST_F(AutoCorrect, OnOffToggle) {
autocorrect_toggle();
EXPECT_EQ(autocorrect_is_enabled(), true);
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
// Test that typing "fales" autocorrects to "false"
@@ -80,7 +80,7 @@ TEST_F(AutoCorrect, fales_to_false_autocorrection) {
TapKeys(key_f, key_a, key_l, key_e, key_s);
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
// Test that typing "fales" doesn't autocorrect if disabled
@@ -109,7 +109,7 @@ TEST_F(AutoCorrect, fales_disabled_autocorrect) {
TapKeys(key_f, key_a, key_l, key_e, key_s);
autocorrect_enable();
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
// Test that typing "falsify" doesn't autocorrect if disabled
@@ -139,7 +139,7 @@ TEST_F(AutoCorrect, falsify_should_not_autocorrect) {
TapKeys(key_f, key_a, key_l, key_s, key_i, key_f, key_y);
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
// Test that typing "ture" autocorrect to "true"
@@ -169,7 +169,7 @@ TEST_F(AutoCorrect, ture_to_true_autocorrect) {
TapKeys(key_space, key_t_code, key_u, key_r, key_e);
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
// Test that typing "overture" does not autocorrect
@@ -200,5 +200,5 @@ TEST_F(AutoCorrect, overture_should_not_autocorrect) {
TapKeys(key_o, key_v, key_e, key_r, key_t_code, key_u, key_r, key_e);
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
diff --git a/tests/basic/test_action_layer.cpp b/tests/basic/test_action_layer.cpp
index d0a28d42c0..883d99b404 100644
--- a/tests/basic/test_action_layer.cpp
+++ b/tests/basic/test_action_layer.cpp
@@ -28,7 +28,7 @@ TEST_F(ActionLayer, LayerStateDBG) {
layer_state_set(0);
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
TEST_F(ActionLayer, LayerStateSet) {
@@ -39,7 +39,7 @@ TEST_F(ActionLayer, LayerStateSet) {
layer_state_set(0b001100);
EXPECT_EQ(layer_state, 0b001100);
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
TEST_F(ActionLayer, LayerStateIs) {
@@ -56,7 +56,7 @@ TEST_F(ActionLayer, LayerStateIs) {
EXPECT_EQ(layer_state_is(1), true);
EXPECT_EQ(layer_state_is(2), false);
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
TEST_F(ActionLayer, LayerStateCmp) {
@@ -76,7 +76,7 @@ TEST_F(ActionLayer, LayerStateCmp) {
EXPECT_EQ(layer_state_cmp(prev_layer, 1), true);
EXPECT_EQ(layer_state_cmp(prev_layer, 2), false);
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
TEST_F(ActionLayer, LayerClear) {
@@ -85,7 +85,7 @@ TEST_F(ActionLayer, LayerClear) {
layer_clear();
EXPECT_EQ(layer_state, 0);
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
TEST_F(ActionLayer, LayerMove) {
@@ -96,7 +96,7 @@ TEST_F(ActionLayer, LayerMove) {
layer_move(3);
EXPECT_EQ(layer_state, 0b1000);
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
TEST_F(ActionLayer, LayerOn) {
@@ -108,7 +108,7 @@ TEST_F(ActionLayer, LayerOn) {
layer_on(3);
EXPECT_EQ(layer_state, 0b1010);
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
TEST_F(ActionLayer, LayerOff) {
@@ -121,7 +121,7 @@ TEST_F(ActionLayer, LayerOff) {
layer_off(2);
EXPECT_EQ(layer_state, 0b0010);
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
TEST_F(ActionLayer, MomentaryLayerDoesNothing) {
@@ -134,12 +134,12 @@ TEST_F(ActionLayer, MomentaryLayerDoesNothing) {
EXPECT_NO_REPORT(driver);
layer_key.press();
run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
EXPECT_NO_REPORT(driver);
layer_key.release();
run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
TEST_F(ActionLayer, MomentaryLayerWithKeypress) {
@@ -155,28 +155,28 @@ TEST_F(ActionLayer, MomentaryLayerWithKeypress) {
layer_key.press();
run_one_scan_loop();
EXPECT_TRUE(layer_state_is(1));
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
/* Press key on layer 1 */
EXPECT_REPORT(driver, (KC_B)).Times(1);
regular_key.press();
run_one_scan_loop();
EXPECT_TRUE(layer_state_is(1));
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
/* Release key on layer 1 */
EXPECT_EMPTY_REPORT(driver);
regular_key.release();
run_one_scan_loop();
EXPECT_TRUE(layer_state_is(1));
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
/* Release MO */
EXPECT_NO_REPORT(driver);
layer_key.release();
run_one_scan_loop();
EXPECT_TRUE(layer_state_is(0));
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
TEST_F(ActionLayer, ToggleLayerDoesNothing) {
@@ -192,14 +192,14 @@ TEST_F(ActionLayer, ToggleLayerDoesNothing) {
layer_key.press();
run_one_scan_loop();
EXPECT_TRUE(layer_state_is(1));
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
/* Release TG. */
EXPECT_NO_REPORT(driver);
layer_key.release();
run_one_scan_loop();
EXPECT_TRUE(layer_state_is(1));
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
TEST_F(ActionLayer, ToggleLayerUpAndDown) {
@@ -216,26 +216,26 @@ TEST_F(ActionLayer, ToggleLayerUpAndDown) {
toggle_layer_1_on_layer_0.press();
run_one_scan_loop();
EXPECT_TRUE(layer_state_is(1));
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
EXPECT_NO_REPORT(driver);
toggle_layer_1_on_layer_0.release();
run_one_scan_loop();
EXPECT_TRUE(layer_state_is(1));
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
/* Toggle Layer 0. */
EXPECT_NO_REPORT(driver);
toggle_layer_0_on_layer_1.press();
run_one_scan_loop();
EXPECT_TRUE(layer_state_is(0));
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
EXPECT_NO_REPORT(driver);
toggle_layer_0_on_layer_1.release();
run_one_scan_loop();
EXPECT_TRUE(layer_state_is(0));
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
TEST_F(ActionLayer, LayerTapToggleDoesNothing) {
@@ -251,13 +251,13 @@ TEST_F(ActionLayer, LayerTapToggleDoesNothing) {
layer_key.press();
run_one_scan_loop();
EXPECT_TRUE(layer_state_is(1));
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
EXPECT_NO_REPORT(driver);
layer_key.release();
run_one_scan_loop();
EXPECT_TRUE(layer_state_is(0));
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
TEST_F(ActionLayer, LayerTapToggleWithKeypress) {
@@ -275,25 +275,25 @@ TEST_F(ActionLayer, LayerTapToggleWithKeypress) {
layer_key.press();
run_one_scan_loop();
EXPECT_TRUE(layer_state_is(1));
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
EXPECT_REPORT(driver, (KC_B)).Times(1);
regular_key.press();
run_one_scan_loop();
EXPECT_TRUE(layer_state_is(1));
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
EXPECT_EMPTY_REPORT(driver);
regular_key.release();
run_one_scan_loop();
EXPECT_TRUE(layer_state_is(1));
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
EXPECT_NO_REPORT(driver);
layer_key.release();
run_one_scan_loop();
EXPECT_TRUE(layer_state_is(0));
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
TEST_F(ActionLayer, LayerTapToggleWithToggleWithKeypress) {
@@ -344,19 +344,19 @@ TEST_F(ActionLayer, LayerTapToggleWithToggleWithKeypress) {
run_one_scan_loop();
EXPECT_TRUE(layer_state_is(1));
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
EXPECT_REPORT(driver, (KC_B)).Times(1);
regular_key.press();
run_one_scan_loop();
EXPECT_TRUE(layer_state_is(1));
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
EXPECT_EMPTY_REPORT(driver);
regular_key.release();
run_one_scan_loop();
EXPECT_TRUE(layer_state_is(1));
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
TEST_F(ActionLayer, LayerTapReleasedBeforeKeypressReleaseWithModifiers) {
@@ -373,7 +373,7 @@ TEST_F(ActionLayer, LayerTapReleasedBeforeKeypressReleaseWithModifiers) {
layer_0_key_0.press();
idle_for(TAPPING_TERM);
EXPECT_TRUE(layer_state_is(0));
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
/* Press key with layer 1 mapping, result basically expected
* altough more reports are send then necessary. */
@@ -382,14 +382,14 @@ TEST_F(ActionLayer, LayerTapReleasedBeforeKeypressReleaseWithModifiers) {
layer_1_key_1.press();
run_one_scan_loop();
EXPECT_TRUE(layer_state_is(1));
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
/* Release layer tap key, no report is send because key is still held. */
EXPECT_NO_REPORT(driver);
layer_0_key_0.release();
run_one_scan_loop();
EXPECT_TRUE(layer_state_is(0));
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
/* Unregister keycode and modifier. */
EXPECT_REPORT(driver, (KC_RALT)).Times(1);
@@ -397,5 +397,5 @@ TEST_F(ActionLayer, LayerTapReleasedBeforeKeypressReleaseWithModifiers) {
layer_1_key_1.release();
run_one_scan_loop();
EXPECT_TRUE(layer_state_is(0));
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
diff --git a/tests/basic/test_keycode_util.cpp b/tests/basic/test_keycode_util.cpp
new file mode 100644
index 0000000000..693334676e
--- /dev/null
+++ b/tests/basic/test_keycode_util.cpp
@@ -0,0 +1,52 @@
+// Copyright 2022 Stefan Kerkmann
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "test_common.hpp"
+
+class KeycodeToIdentifierSuite : public ::testing::TestWithParam<std::pair<std::uint16_t, std::string>> {};
+
+TEST_P(KeycodeToIdentifierSuite, ConversionTests) {
+ ASSERT_EQ(get_keycode_identifier_or_default(GetParam().first), GetParam().second);
+}
+
+INSTANTIATE_TEST_CASE_P(ConversionTestsP, KeycodeToIdentifierSuite,
+ // clang-format off
+::testing::Values(
+ // Goto layer
+ std::make_pair(TO(0), "TO(0)"),
+ std::make_pair(TO(0x1F), "TO(31)"),
+ // Momentary switch layer
+ std::make_pair(MO(0), "MO(0)"),
+ std::make_pair(MO(0x1F), "MO(31)"),
+ // Set default layer
+ std::make_pair(DF(0), "DF(0)"),
+ std::make_pair(DF(0x1F), "DF(31)"),
+ // Toggle layer
+ std::make_pair(TG(0), "TG(0)"),
+ std::make_pair(TG(0x1F), "TG(31)"),
+ // One-shot layer
+ std::make_pair(OSL(0), "OSL(0)"),
+ std::make_pair(OSL(0x1F), "OSL(31)"),
+ // One-shot mod
+ std::make_pair(OSM(MOD_LSFT), "OSM(MOD_LSFT)"),
+ std::make_pair(OSM(MOD_LSFT | MOD_LCTL), "OSM(MOD_LCTL | MOD_LSFT)"),
+ // Layer Mod
+ std::make_pair(LM(0, MOD_LSFT), "LM(0, MOD_LSFT)"),
+ std::make_pair(LM(0xF, MOD_LSFT), "LM(15, MOD_LSFT)"),
+ std::make_pair(LM(0xF, MOD_LSFT | MOD_LCTL), "LM(15, MOD_LCTL | MOD_LSFT)"),
+ // Layer tap toggle
+ std::make_pair(TT(0), "TT(0)"),
+ std::make_pair(TT(0x1F), "TT(31)"),
+ // Layer tap
+ std::make_pair(LT(0, KC_A), "LT(0, KC_A)"),
+ std::make_pair(LT(0xF, KC_SPACE), "LT(15, KC_SPACE)"),
+ std::make_pair(LT(1, KC_SPC), "LT(1, KC_SPACE)"),
+ // Mod tap
+ std::make_pair(MT(MOD_LCTL, KC_A), "MT(MOD_LCTL, KC_A)"),
+ std::make_pair(MT(MOD_LCTL | MOD_LSFT, KC_A), "MT(MOD_LCTL | MOD_LSFT, KC_A)"),
+ std::make_pair(ALT_T(KC_TAB), "MT(MOD_LALT, KC_TAB)"),
+ // Mods
+ std::make_pair(LCTL(KC_A), "QK_MODS(KC_A, QK_LCTL)"),
+ std::make_pair(HYPR(KC_SPACE), "QK_MODS(KC_SPACE, QK_LCTL | QK_LSFT | QK_LALT | QK_LGUI)")
+));
+// clang-format on
diff --git a/tests/basic/test_keypress.cpp b/tests/basic/test_keypress.cpp
index 6d5b502a00..34682654b0 100644
--- a/tests/basic/test_keypress.cpp
+++ b/tests/basic/test_keypress.cpp
@@ -175,23 +175,23 @@ TEST_F(KeyPress, PressPlusEqualReleaseBeforePress) {
EXPECT_REPORT(driver, (KC_LEFT_SHIFT));
EXPECT_REPORT(driver, (KC_LEFT_SHIFT, KC_EQUAL));
run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
key_plus.release();
EXPECT_REPORT(driver, (KC_LEFT_SHIFT));
EXPECT_EMPTY_REPORT(driver);
run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
key_eql.press();
EXPECT_REPORT(driver, (key_eql.report_code));
run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
key_eql.release();
EXPECT_EMPTY_REPORT(driver);
run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
TEST_F(KeyPress, PressPlusEqualDontReleaseBeforePress) {
@@ -206,24 +206,24 @@ TEST_F(KeyPress, PressPlusEqualDontReleaseBeforePress) {
EXPECT_REPORT(driver, (KC_LEFT_SHIFT));
EXPECT_REPORT(driver, (KC_LEFT_SHIFT, KC_EQUAL));
run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
key_eql.press();
EXPECT_EMPTY_REPORT(driver);
EXPECT_REPORT(driver, (KC_EQUAL));
run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
key_plus.release();
// BUG: Should really still return KC_EQUAL, but this is fine too
EXPECT_EMPTY_REPORT(driver);
run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
key_eql.release();
EXPECT_NO_REPORT(driver);
run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
TEST_F(KeyPress, PressEqualPlusReleaseBeforePress) {
@@ -237,24 +237,24 @@ TEST_F(KeyPress, PressEqualPlusReleaseBeforePress) {
key_eql.press();
EXPECT_REPORT(driver, (KC_EQUAL));
run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
key_eql.release();
EXPECT_EMPTY_REPORT(driver);
run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
key_plus.press();
EXPECT_REPORT(driver, (KC_LEFT_SHIFT));
EXPECT_REPORT(driver, (KC_LEFT_SHIFT, KC_EQUAL));
run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
key_plus.release();
EXPECT_REPORT(driver, (KC_LEFT_SHIFT));
EXPECT_EMPTY_REPORT(driver);
run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
TEST_F(KeyPress, PressEqualPlusDontReleaseBeforePress) {
@@ -268,7 +268,7 @@ TEST_F(KeyPress, PressEqualPlusDontReleaseBeforePress) {
key_eql.press();
EXPECT_REPORT(driver, (KC_EQUAL));
run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
key_plus.press();
// BUG: The sequence is a bit strange, but it works, the end result is that
@@ -277,16 +277,16 @@ TEST_F(KeyPress, PressEqualPlusDontReleaseBeforePress) {
EXPECT_REPORT(driver, (KC_LEFT_SHIFT));
EXPECT_REPORT(driver, (KC_LEFT_SHIFT, KC_EQUAL));
run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
key_eql.release();
// I guess it's fine to still report shift here
EXPECT_REPORT(driver, (KC_LEFT_SHIFT));
run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
key_plus.release();
EXPECT_EMPTY_REPORT(driver);
run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
diff --git a/tests/basic/test_one_shot_keys.cpp b/tests/basic/test_one_shot_keys.cpp
index bb14221140..2401c2c837 100644
--- a/tests/basic/test_one_shot_keys.cpp
+++ b/tests/basic/test_one_shot_keys.cpp
@@ -36,12 +36,12 @@ TEST_F(OneShot, OSMWithoutAdditionalKeypressDoesNothing) {
run_one_scan_loop();
osm_key.release();
run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
/* OSM are added when an actual report is send */
EXPECT_REPORT(driver, (osm_key.report_code));
send_keyboard_report();
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
/* Make unit-test pass */
clear_oneshot_mods();
@@ -62,19 +62,19 @@ TEST_P(OneShotParametrizedTestFixture, OSMExpiredDoesNothing) {
run_one_scan_loop();
osm_key.release();
idle_for(ONESHOT_TIMEOUT);
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
/* Press regular key */
EXPECT_REPORT(driver, (regular_key.report_code)).Times(1);
regular_key.press();
run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
/* Release regular key */
EXPECT_EMPTY_REPORT(driver);
regular_key.release();
run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
#endif
@@ -92,19 +92,19 @@ TEST_P(OneShotParametrizedTestFixture, OSMWithAdditionalKeypress) {
run_one_scan_loop();
osm_key.release();
run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
/* Press regular key */
EXPECT_REPORT(driver, (osm_key.report_code, regular_key.report_code)).Times(1);
regular_key.press();
run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
/* Release regular key */
EXPECT_EMPTY_REPORT(driver);
regular_key.release();
run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
TEST_P(OneShotParametrizedTestFixture, OSMAsRegularModifierWithAdditionalKeypress) {
@@ -120,26 +120,26 @@ TEST_P(OneShotParametrizedTestFixture, OSMAsRegularModifierWithAdditionalKeypres
EXPECT_NO_REPORT(driver);
osm_key.press();
run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
/* Press regular key */
EXPECT_NO_REPORT(driver);
regular_key.press();
run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
/* Release regular key */
EXPECT_NO_REPORT(driver);
regular_key.release();
run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
/* Release OSM */
EXPECT_REPORT(driver, (regular_key.report_code, osm_key.report_code)).Times(1);
EXPECT_EMPTY_REPORT(driver);
osm_key.release();
run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
// clang-format off
@@ -172,24 +172,24 @@ TEST_F(OneShot, OSLWithAdditionalKeypress) {
EXPECT_NO_REPORT(driver);
osl_key.press();
run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
/* Release OSL key */
EXPECT_NO_REPORT(driver);
osl_key.release();
run_one_scan_loop();
- testing::Mock::VerifyA