summaryrefslogtreecommitdiff
path: root/tests/caps_word
diff options
context:
space:
mode:
authorStefan Kerkmann <karlk90@pm.me>2022-12-14 16:31:08 +0100
committerGitHub <noreply@github.com>2022-12-15 02:31:08 +1100
commit962e4c0e1854b10612bab547c3d842c5f967dd23 (patch)
treedfe13a5a7d3f593452a1e77b5c4173263d3fb2e2 /tests/caps_word
parente2ab98f9601049a7540bd89cb128669b09c688d5 (diff)
[Test] Reset timer for every unit test and provide timestamps for log messages (#17028)
Diffstat (limited to 'tests/caps_word')
-rw-r--r--tests/caps_word/test_caps_word.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/caps_word/test_caps_word.cpp b/tests/caps_word/test_caps_word.cpp
index e5ecbb844e..fa970c7d0e 100644
--- a/tests/caps_word/test_caps_word.cpp
+++ b/tests/caps_word/test_caps_word.cpp
@@ -505,7 +505,8 @@ class CapsWordDoubleTapShift : public ::testing::WithParamInterface<CapsWordDoub
TEST_P(CapsWordDoubleTapShift, Activation) {
TestDriver driver;
KeymapKey left_shift(0, 0, 0, GetParam().left_shift_keycode);
- set_keymap({left_shift});
+ KeymapKey esc(0, 0, 1, KC_ESCAPE);
+ set_keymap({left_shift, esc});
// clang-format off
EXPECT_CALL(driver, send_keyboard_mock(AnyOf(
@@ -524,6 +525,12 @@ TEST_P(CapsWordDoubleTapShift, Activation) {
EXPECT_EQ(is_caps_word_on(), true);
testing::Mock::VerifyAndClearExpectations(&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
+ // reset the caps word double shift timer on test case setup.
+ idle_for(CAPS_WORD_IDLE_TIMEOUT);
+ tap_key(esc);
}
// Double tap doesn't count if another key is pressed between the taps.