summaryrefslogtreecommitdiffstats
path: root/tests/leader/leader_strict_key_processing
diff options
context:
space:
mode:
Diffstat (limited to 'tests/leader/leader_strict_key_processing')
-rw-r--r--tests/leader/leader_strict_key_processing/config.h8
-rw-r--r--tests/leader/leader_strict_key_processing/test.mk7
-rw-r--r--tests/leader/leader_strict_key_processing/test_leader_strict_key_processing.cpp45
3 files changed, 60 insertions, 0 deletions
diff --git a/tests/leader/leader_strict_key_processing/config.h b/tests/leader/leader_strict_key_processing/config.h
new file mode 100644
index 0000000000..cca5ed0458
--- /dev/null
+++ b/tests/leader/leader_strict_key_processing/config.h
@@ -0,0 +1,8 @@
+// Copyright 2023 QMK
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include "test_common.h"
+
+#define LEADER_KEY_STRICT_KEY_PROCESSING
diff --git a/tests/leader/leader_strict_key_processing/test.mk b/tests/leader/leader_strict_key_processing/test.mk
new file mode 100644
index 0000000000..635c04ee92
--- /dev/null
+++ b/tests/leader/leader_strict_key_processing/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_strict_key_processing/test_leader_strict_key_processing.cpp b/tests/leader/leader_strict_key_processing/test_leader_strict_key_processing.cpp
new file mode 100644
index 0000000000..de6bcf0fce
--- /dev/null
+++ b/tests/leader/leader_strict_key_processing/test_leader_strict_key_processing.cpp
@@ -0,0 +1,45 @@
+// 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_extract_mod_tap_keycode) {
+ TestDriver driver;
+
+ auto key_leader = KeymapKey(0, 0, 0, QK_LEADER);
+ auto key_mt = KeymapKey(0, 1, 0, LSFT_T(KC_A));
+
+ set_keymap({key_leader, key_mt});
+
+ tap_key(key_leader);
+
+ EXPECT_NO_REPORT(driver);
+ tap_key(key_mt);
+
+ EXPECT_EQ(leader_sequence_one_key(KC_A), false);
+ EXPECT_EQ(leader_sequence_one_key(LSFT_T(KC_A)), true);
+}
+
+TEST_F(Leader, does_not_extract_layer_tap_keycode) {
+ TestDriver driver;
+
+ auto key_leader = KeymapKey(0, 0, 0, QK_LEADER);
+ auto key_lt = KeymapKey(0, 1, 0, LT(1, KC_A));
+
+ set_keymap({key_leader, key_lt});
+
+ tap_key(key_leader);
+
+ EXPECT_NO_REPORT(driver);
+ tap_key(key_lt);
+
+ EXPECT_EQ(leader_sequence_one_key(KC_A), false);
+ EXPECT_EQ(leader_sequence_one_key(LT(1, KC_A)), true);
+}