diff options
author | Ryan <fauxpark@gmail.com> | 2023-02-13 03:19:02 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-13 03:19:02 +1100 |
commit | bbf7a20b33de2d203518687cb5cd1aa85005ea27 (patch) | |
tree | ee1a5c412a02021d085c81a26321c3424eca7022 /tests/leader/leader_per_key_timeout | |
parent | d10350cd2ceb2b9d80522cdec3ea908118f7fd35 (diff) |
Refactor Leader key feature (#19632)
Co-authored-by: Drashna Jaelre <drashna@live.com>
Diffstat (limited to 'tests/leader/leader_per_key_timeout')
-rw-r--r-- | tests/leader/leader_per_key_timeout/config.h | 5 | ||||
-rw-r--r-- | tests/leader/leader_per_key_timeout/test.mk | 7 | ||||
-rw-r--r-- | tests/leader/leader_per_key_timeout/test_leader_per_key_timeout.cpp | 40 |
3 files changed, 52 insertions, 0 deletions
diff --git a/tests/leader/leader_per_key_timeout/config.h b/tests/leader/leader_per_key_timeout/config.h new file mode 100644 index 0000000000..045e7c1a57 --- /dev/null +++ b/tests/leader/leader_per_key_timeout/config.h @@ -0,0 +1,5 @@ +#pragma once + +#include "test_common.h" + +#define LEADER_PER_KEY_TIMING diff --git a/tests/leader/leader_per_key_timeout/test.mk b/tests/leader/leader_per_key_timeout/test.mk new file mode 100644 index 0000000000..635c04ee92 --- /dev/null +++ b/tests/leader/leader_per_key_timeout/test.mk @@ -0,0 +1,7 @@ +# -------------------------------------------------------------------------------- +# Keep this file, even if it is empty, as a marker that this folder contains tests +# -------------------------------------------------------------------------------- + +LEADER_ENABLE = yes + +SRC += ../leader_sequences.c diff --git a/tests/leader/leader_per_key_timeout/test_leader_per_key_timeout.cpp b/tests/leader/leader_per_key_timeout/test_leader_per_key_timeout.cpp new file mode 100644 index 0000000000..a1e9eb3c77 --- /dev/null +++ b/tests/leader/leader_per_key_timeout/test_leader_per_key_timeout.cpp @@ -0,0 +1,40 @@ +// Copyright 2023 QMK +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "keyboard_report_util.hpp" +#include "keycode.h" +#include "test_common.hpp" +#include "test_keymap_key.hpp" + +using testing::_; + +class Leader : public TestFixture {}; + +TEST_F(Leader, does_not_timeout_during_sequence) { + TestDriver driver; + + auto key_leader = KeymapKey(0, 0, 0, QK_LEADER); + auto key_a = KeymapKey(0, 1, 0, KC_A); + auto key_b = KeymapKey(0, 2, 0, KC_B); + auto key_c = KeymapKey(0, 3, 0, KC_C); + + set_keymap({key_leader, key_a, key_b, key_c}); + + tap_key(key_leader); + + EXPECT_NO_REPORT(driver); + tap_key(key_a); + + idle_for(150); + + EXPECT_NO_REPORT(driver); + tap_key(key_b); + + idle_for(150); + + EXPECT_REPORT(driver, (KC_3)); + EXPECT_EMPTY_REPORT(driver); + tap_key(key_c); + + idle_for(300); +} |