summaryrefslogtreecommitdiff
path: root/tests/caps_word
diff options
context:
space:
mode:
authorStefan Kerkmann <karlk90@pm.me>2022-12-18 21:55:14 +0100
committerGitHub <noreply@github.com>2022-12-18 21:55:14 +0100
commitc2b13bd77b71ea73db12a6cda64871565036a6dc (patch)
treee24c99abb8260a929b9fcc4cba21705475514c07 /tests/caps_word
parent7aa2d791f69244a5f17ec0d00908ec5a05d21103 (diff)
Introduce VERIFY_AND_CLEAR shorthand (#19370)
Which is just a syntactic sugar for testing::Mock::VerifyAndClearExpectations to reduce the visual clutter in unit-tests.
Diffstat (limited to 'tests/caps_word')
-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.cpp32
4 files changed, 25 insertions, 25 deletions
diff --git a/tests/caps_word/caps_word_autoshift/test_caps_word_autoshift.cpp b/tests/caps_word/caps_word_autoshift/test_caps_word_autoshift.cpp
index ba21c527a6..01b1a78a5f 100644
--- a/tests/caps_word/caps_word_autoshift/test_caps_word_autoshift.cpp
+++ b/tests/caps_word/caps_word_autoshift/test_caps_word_autoshift.cpp
@@ -64,7 +64,7 @@ TEST_F(CapsWord, AutoShiftKeys) {
tap_key(key_spc);
tap_key(key_a);
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
// Test Caps Word + Auto Shift where keys A and B are rolled.
@@ -104,7 +104,7 @@ TEST_F(CapsWord, AutoShiftRolledShiftedKeys) {
run_one_scan_loop();
caps_word_off();
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
// Tests that with tap-hold keys with Retro Shift, letter keys are shifted by
@@ -133,5 +133,5 @@ TEST_F(CapsWord, RetroShiftKeys) {
tap_key(key_modtap_a); // Tap A quickly.
EXPECT_EQ(is_caps_word_on(), true);
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
diff --git a/tests/caps_word/caps_word_combo/test_caps_word_combo.cpp b/tests/caps_word/caps_word_combo/test_caps_word_combo.cpp
index 3a0530b854..0876cc91a3 100644
--- a/tests/caps_word/caps_word_combo/test_caps_word_combo.cpp
+++ b/tests/caps_word/caps_word_combo/test_caps_word_combo.cpp
@@ -102,7 +102,7 @@ TEST_P(CapsWord, SingleCombo) {
EXPECT_TRUE(is_caps_word_on());
caps_word_off();
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
// Test a longer 4-key combo.
@@ -123,7 +123,7 @@ TEST_P(CapsWord, LongerCombo) {
EXPECT_TRUE(is_caps_word_on());
caps_word_off();
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
// Test with two overlapping combos on regular keys:
@@ -161,7 +161,7 @@ TEST_P(CapsWord, ComboRegularKeys) {
tap_key(key_a);
EXPECT_FALSE(is_caps_word_on());
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
// Test where combo chords involve tap-hold keys:
@@ -194,7 +194,7 @@ TEST_P(CapsWord, ComboModTapKey) {
EXPECT_TRUE(is_caps_word_on());
caps_word_off();
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
// clang-format off
diff --git a/tests/caps_word/caps_word_unicodemap/test_caps_word_unicodemap.cpp b/tests/caps_word/caps_word_unicodemap/test_caps_word_unicodemap.cpp
index fb8f9333bb..01cdfd6408 100644
--- a/tests/caps_word/caps_word_unicodemap/test_caps_word_unicodemap.cpp
+++ b/tests/caps_word/caps_word_unicodemap/test_caps_word_unicodemap.cpp
@@ -93,7 +93,7 @@ TEST_F(CapsWord, ShiftedUnicodeMapKey) {
tap_keys(key_delta, key_spc, key_delta);
EXPECT_EQ(is_caps_word_on(), false);
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
// Tests typing U_ENDASH while Caps Word is on.
@@ -117,5 +117,5 @@ TEST_F(CapsWord, UnshiftedUnicodeMapKey) {
tap_key(key_dash);
EXPECT_EQ(is_caps_word_on(), true);
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
diff --git a/tests/caps_word/test_caps_word.cpp b/tests/caps_word/test_caps_word.cpp
index fa970c7d0e..6d38b383f3 100644
--- a/tests/caps_word/test_caps_word.cpp
+++ b/tests/caps_word/test_caps_word.cpp
@@ -90,7 +90,7 @@ TEST_F(CapsWord, OnOffToggleFuns) {
caps_word_toggle();
EXPECT_EQ(is_caps_word_on(), false);
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
// Tests the default `caps_word_press_user()` function.
@@ -133,7 +133,7 @@ TEST_F(CapsWord, CapswrdKey) {
tap_key(key_capswrd); // Tap the QK_CAPS_WORD_TOGGLE key again.
EXPECT_EQ(is_caps_word_on(), false);
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
// Tests that being idle for CAPS_WORD_IDLE_TIMEOUT turns off Caps Word.
@@ -157,7 +157,7 @@ TEST_F(CapsWord, IdleTimeout) {
caps_word_on();
tap_key(key_a);
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
idle_for(CAPS_WORD_IDLE_TIMEOUT);
run_one_scan_loop();
@@ -171,7 +171,7 @@ TEST_F(CapsWord, IdleTimeout) {
EXPECT_REPORT(driver, (KC_A));
tap_key(key_a);
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
// Tests that typing "A, 4, A, 4" produces "Shift+A, 4, Shift+A, 4".
@@ -201,7 +201,7 @@ TEST_F(CapsWord, ShiftsLettersButNotDigits) {
caps_word_on();
tap_keys(key_a, key_4, key_a, key_4);
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
// Tests that typing "A, Space, A" produces "Shift+A, Space, A".
@@ -230,7 +230,7 @@ TEST_F(CapsWord, SpaceTurnsOffCapsWord) {
caps_word_on();
tap_keys(key_a, key_spc, key_a);
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
// Tests that typing "AltGr + A" produces "Shift + AltGr + A".
@@ -260,7 +260,7 @@ TEST_F(CapsWord, ShiftsAltGrSymbols) {
run_one_scan_loop();
key_altgr.release();
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
// Tests typing "AltGr + A" using a mod-tap key.
@@ -291,7 +291,7 @@ TEST_F(CapsWord, ShiftsModTapAltGrSymbols) {
key_altgr_t.release();
EXPECT_TRUE(is_caps_word_on());
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
struct CapsWordPressUserParams {
@@ -326,7 +326,7 @@ TEST_P(CapsWordPressUser, KeyCode) {
EXPECT_EQ(passed_keycode, GetParam().expected_passed_keycode);
EXPECT_EQ(is_caps_word_on(), GetParam().continues_caps_word);
clear_oneshot_mods();
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
const uint16_t LT_1_KC_A = LT(1, KC_A);
@@ -431,7 +431,7 @@ TEST_P(CapsWordBothShifts, PressLRLR) {
EXPECT_EQ(is_caps_word_on(), true);
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
// Pressing shifts as "Left down, Right down, Right up, Left up".
@@ -468,7 +468,7 @@ TEST_P(CapsWordBothShifts, PressLRRL) {
EXPECT_EQ(is_caps_word_on(), true);
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
// clang-format off
@@ -524,7 +524,7 @@ TEST_P(CapsWordDoubleTapShift, Activation) {
EXPECT_EQ(is_caps_word_on(), true);
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
// We have to manually reset the internal state of the caps word state
// machine at this point. This due to imperfect test isolation which can't
@@ -562,7 +562,7 @@ TEST_P(CapsWordDoubleTapShift, Interrupted) {
EXPECT_EQ(is_caps_word_on(), false); // Caps Word is still off.
clear_oneshot_mods();
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
// Double tap doesn't count if taps are more than tapping term apart.
@@ -585,7 +585,7 @@ TEST_P(CapsWordDoubleTapShift, SlowTaps) {
EXPECT_EQ(is_caps_word_on(), false); // Caps Word is still off.
clear_oneshot_mods();
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
// clang-format off
@@ -623,7 +623,7 @@ TEST_F(CapsWord, IgnoresOSLHold) {
key_osl.release();
run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
// Tests that tapping a OSL keeps caps word active and shifts keys on the layer that need to be shifted.
@@ -648,7 +648,7 @@ TEST_F(CapsWord, IgnoresOSLTap) {
tap_key(key_b);
run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
+ VERIFY_AND_CLEAR(driver);
}
// clang-format on
} // namespace