summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/basic/test_keycode_util.cpp52
-rw-r--r--tests/basic/test_tapping.cpp69
-rw-r--r--tests/caps_word/test_caps_word.cpp62
-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_tap_hold.cpp2
-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_tap_hold.cpp2
-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)2
-rw-r--r--tests/tap_hold_configurations/quick_tap/test_quick_tap.cpp290
-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_fixture.cpp29
-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
30 files changed, 1394 insertions, 615 deletions
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_tapping.cpp b/tests/basic/test_tapping.cpp
index 6ff9cfe22b..faf9b9fe91 100644
--- a/tests/basic/test_tapping.cpp
+++ b/tests/basic/test_tapping.cpp
@@ -121,3 +121,72 @@ TEST_F(Tapping, ANewTapWithinTappingTermIsBuggy) {
key_shift_hold_p_tap.release();
run_one_scan_loop();
}
+
+TEST_F(Tapping, TapA_CTL_T_KeyWhileReleasingShift) {
+ TestDriver driver;
+ InSequence s;
+ auto shift_key = KeymapKey(0, 7, 0, KC_LSFT);
+ auto mod_tap_hold_key = KeymapKey(0, 8, 0, CTL_T(KC_P));
+
+ set_keymap({shift_key, mod_tap_hold_key});
+
+ shift_key.press();
+ // Shift is reported
+ EXPECT_REPORT(driver, (KC_LSFT));
+ run_one_scan_loop();
+ testing::Mock::VerifyAndClearExpectations(&driver);
+
+ mod_tap_hold_key.press();
+ // Tapping keys does nothing on press
+ EXPECT_NO_REPORT(driver);
+ run_one_scan_loop();
+
+ shift_key.release();
+ // Releasing shift is delayed while tapping is in progress
+ EXPECT_NO_REPORT(driver);
+ run_one_scan_loop();
+ testing::Mock::VerifyAndClearExpectations(&driver);
+
+ mod_tap_hold_key.release();
+ // Releasing mod-tap key reports the tap and releases shift
+ EXPECT_REPORT(driver, (KC_LSFT, KC_P));
+ EXPECT_REPORT(driver, (KC_P));
+ EXPECT_EMPTY_REPORT(driver);
+ run_one_scan_loop();
+ testing::Mock::VerifyAndClearExpectations(&driver);
+}
+
+TEST_F(Tapping, TapA_CTL_T_KeyWhileReleasingLayer) {
+ TestDriver driver;
+ InSequence s;
+ auto layer_key = KeymapKey(0, 7, 0, MO(1));
+ auto trans_key = KeymapKey(1, 7, 0, KC_TRNS);
+ auto mod_tap_hold_key0 = KeymapKey(0, 8, 0, CTL_T(KC_P));
+ auto mod_tap_hold_key1 = KeymapKey(1, 8, 0, CTL_T(KC_Q));
+
+ set_keymap({layer_key, trans_key, mod_tap_hold_key0, mod_tap_hold_key1});
+
+ layer_key.press();
+ // Pressing the layer key does nothing
+ EXPECT_NO_REPORT(driver);
+ run_one_scan_loop();
+
+ mod_tap_hold_key1.press();
+ // Tapping layer 1 mod-tap key does nothing on press
+ EXPECT_NO_REPORT(driver);
+ run_one_scan_loop();
+
+ layer_key.release();
+ // Releasing layer is delayed while tapping is in progress
+ EXPECT_NO_REPORT(driver);
+ run_one_scan_loop();
+ testing::Mock::VerifyAndClearExpectations(&driver);
+
+ mod_tap_hold_key1.release();
+ // Releasing mod-tap key reports the tap of the layer 1 key
+ // If delayed layer release is broken, this reports the layer 0 key
+ EXPECT_REPORT(driver, (KC_Q));
+ EXPECT_EMPTY_REPORT(driver);
+ run_one_scan_loop();
+ testing::Mock::VerifyAndClearExpectations(&driver);
+}
diff --git a/tests/caps_word/test_caps_word.cpp b/tests/caps_word/test_caps_word.cpp
index 3d0735d8c2..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.
@@ -591,6 +598,57 @@ INSTANTIATE_TEST_CASE_P(
),
CapsWordDoubleTapShiftParams::GetName
);
-// clang-format on
+// Tests that holding a OSL keeps caps word active and shifts keys on the layer that need to be shifted.
+TEST_F(CapsWord, IgnoresOSLHold) {
+ TestDriver driver;
+ KeymapKey key_a(0, 0, 0, KC_A);
+ KeymapKey key_osl(0, 1, 0, OSL(1));
+ KeymapKey key_b(1, 0, 0, KC_B);
+ set_keymap({key_a, key_osl, key_b});
+
+ // Allow any number of reports with no keys or only modifiers.
+ // clang-format off
+ EXPECT_CALL(driver, send_keyboard_mock(AnyOf(
+ KeyboardReport(),
+ KeyboardReport(KC_LSFT))))
+ .Times(AnyNumber());
+
+ EXPECT_REPORT(driver, (KC_LSFT, KC_B));
+ caps_word_on();
+
+ key_osl.press();
+ run_one_scan_loop();
+ tap_key(key_b);
+ key_osl.release();
+ run_one_scan_loop();
+
+ testing::Mock::VerifyAndClearExpectations(&driver);
+}
+
+// Tests that tapping a OSL keeps caps word active and shifts keys on the layer that need to be shifted.
+TEST_F(CapsWord, IgnoresOSLTap) {
+ TestDriver driver;
+ KeymapKey key_a(0, 0, 0, KC_A);
+ KeymapKey key_osl(0, 1, 0, OSL(1));
+ KeymapKey key_b(1, 0, 0, KC_B);
+ set_keymap({key_a, key_osl, key_b});
+
+ // Allow any number of reports with no keys or only modifiers.
+ // clang-format off
+ EXPECT_CALL(driver, send_keyboard_mock(AnyOf(
+ KeyboardReport(),
+ KeyboardReport(KC_LSFT))))
+ .Times(AnyNumber());
+
+ EXPECT_REPORT(driver, (KC_LSFT, KC_B));
+ caps_word_on();
+
+ tap_key(key_osl);
+ tap_key(key_b);
+ run_one_scan_loop();
+
+ testing::Mock::VerifyAndClearExpectations(&driver);
+}
+// clang-format on
} // namespace
diff --git a/tests/tap_dance/examples.c b/tests/tap_dance/examples.c
index 4a5be41b08..af74388209 100644
--- a/tests/tap_dance/examples.c
+++ b/tests/tap_dance/examples.c
@@ -23,7 +23,7 @@
// Example 1
-void dance_egg(qk_tap_dance_state_t *state, void *user_data) {
+void dance_egg(tap_dance_state_t *state, void *user_data) {
if (state->count >= 100) {
// SEND_STRING("Safety dance!");
tap_code(KC_C);
@@ -34,7 +34,7 @@ void dance_egg(qk_tap_dance_state_t *state, void *user_data) {
// Example 2
-void dance_flsh_each(qk_tap_dance_state_t *state, void *user_data) {
+void dance_flsh_each(tap_dance_state_t *state, void *user_data) {
switch (state->count) {
case 1:
register_code(KC_3);
@@ -54,14 +54,14 @@ void dance_flsh_each(qk_tap_dance_state_t *state, void *user_data) {
}
}
-void dance_flsh_finished(qk_tap_dance_state_t *state, void *user_data) {
+void dance_flsh_finished(tap_dance_state_t *state, void *user_data) {
if (state->count >= 4) {
// reset_keyboard();
tap_code(KC_R);
}
}
-void dance_flsh_reset(qk_tap_dance_state_t *state, void *user_data) {
+void dance_flsh_reset(tap_dance_state_t *state, void *user_data) {
unregister_code(KC_1);
// wait_ms(50);
unregister_code(KC_2);
@@ -79,7 +79,7 @@ typedef struct {
} tap_dance_tap_hold_t;
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
- qk_tap_dance_action_t *action;
+ tap_dance_action_t *action;
switch (keycode) {
case TD(CT_CLN):
@@ -92,7 +92,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
}
-void tap_dance_tap_hold_finished(qk_tap_dance_state_t *state, void *user_data) {
+void tap_dance_tap_hold_finished(tap_dance_state_t *state, void *user_data) {
tap_dance_tap_hold_t *tap_hold = (tap_dance_tap_hold_t *)user_data;
if (state->pressed) {
@@ -110,7 +110,7 @@ void tap_dance_tap_hold_finished(qk_tap_dance_state_t *state, void *user_data) {
}
}
-void tap_dance_tap_hold_reset(qk_tap_dance_state_t *state, void *user_data) {
+void tap_dance_tap_hold_reset(tap_dance_state_t *state, void *user_data) {
tap_dance_tap_hold_t *tap_hold = (tap_dance_tap_hold_t *)user_data;
if (tap_hold->held) {
@@ -142,7 +142,7 @@ typedef struct {
td_state_t state;
} td_tap_t;
-td_state_t cur_dance(qk_tap_dance_state_t *state) {
+td_state_t cur_dance(tap_dance_state_t *state) {
if (state->count == 1) {
if (state->interrupted || !state->pressed) return TD_SINGLE_TAP;
else return TD_SINGLE_HOLD;
@@ -163,7 +163,7 @@ static td_tap_t xtap_state = {
.state = TD_NONE
};
-void x_finished(qk_tap_dance_state_t *state, void *user_data) {
+void x_finished(tap_dance_state_t *state, void *user_data) {
xtap_state.state = cur_dance(state);
switch (xtap_state.state) {
case TD_SINGLE_TAP: register_code(KC_X); break;
@@ -175,7 +175,7 @@ void x_finished(qk_tap_dance_state_t *state, void *user_data) {
}
}
-void x_reset(qk_tap_dance_state_t *state, void *user_data) {
+void x_reset(tap_dance_state_t *state, void *user_data) {
switch (xtap_state.state) {
case TD_SINGLE_TAP: unregister_code(KC_X); break;
case TD_SINGLE_HOLD: unregister_code(KC_LCTL); break;
@@ -188,7 +188,7 @@ void x_reset(qk_tap_dance_state_t *state, void *user_data) {
}
-qk_tap_dance_action_t tap_dance_actions[] = {
+tap_dance_action_t tap_dance_actions[] = {
[TD_ESC_CAPS] = ACTION_TAP_DANCE_DOUBLE(KC_ESC, KC_CAPS),
[CT_EGG] = ACTION_TAP_DANCE_FN(dance_egg),
[CT_FLSH] = ACTION_TAP_DANCE_FN_ADVANCED(dance_flsh_each, dance_flsh_finished, dance_flsh_reset),
diff --git a/tests/tap_dance/tap_dance_layers/tap_dance_defs.c b/tests/tap_dance/tap_dance_layers/tap_dance_defs.c
index 5ec900c041..fbe37f7ed0 100644
--- a/tests/tap_dance/tap_dance_layers/tap_dance_defs.c
+++ b/tests/tap_dance/tap_dance_layers/tap_dance_defs.c
@@ -43,7 +43,7 @@ enum lt_app_state {
static enum lt_app_state saved_lt_app_state;
-static enum lt_app_state get_lt_app_state(qk_tap_dance_state_t *state) {
+static enum lt_app_state get_lt_app_state(tap_dance_state_t *state) {
if (state->count == 1) {
if (!state->pressed) {
return LTA_SINGLE_TAP;
@@ -57,7 +57,7 @@ static enum lt_app_state get_lt_app_state(qk_tap_dance_state_t *state) {
}
}
-static void lt_app_finished(qk_tap_dance_state_t *state, void *user_data) {
+static void lt_app_finished(tap_dance_state_t *state, void *user_data) {
saved_lt_app_state = get_lt_app_state(state);
switch (saved_lt_app_state) {
case LTA_NONE:
@@ -74,7 +74,7 @@ static void lt_app_finished(qk_tap_dance_state_t *state, void *user_data) {
}
}
-static void lt_app_reset(qk_tap_dance_state_t *state, void *user_data) {
+static void lt_app_reset(tap_dance_state_t *state, void *user_data) {
switch (saved_lt_app_state) {
case LTA_NONE:
break;
@@ -90,7 +90,7 @@ static void lt_app_reset(qk_tap_dance_state_t *state, void *user_data) {
}
}
-qk_tap_dance_action_t tap_dance_actions[] = {
+tap_dance_action_t tap_dance_actions[] = {
[TD_L_MOVE] = ACTION_TAP_DANCE_LAYER_MOVE(KC_APP, 1),
[TD_L_TOGG] = ACTION_TAP_DANCE_LAYER_TOGGLE(KC_APP, 1),
[TD_LT_APP] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, lt_app_finished, lt_app_reset),
diff --git a/tests/tap_hold_configurations/default_mod_tap/config.h b/tests/tap_hold_configurations/default_mod_tap/config.h
index 5955b8600a..f22448845e 100644
--- a/tests/tap_hold_configurations/default_mod_tap/config.h
+++ b/tests/tap_hold_configurations/default_mod_tap/config.h
@@ -18,4 +18,4 @@
#include "test_common.h"
-#define IGNORE_MOD_TAP_INTERRUPT \ No newline at end of file
+#define IGNORE_MOD_TAP_INTERRUPT
diff --git a/tests/tap_hold_configurations/default_mod_tap/test_tap_hold.cpp b/tests/tap_hold_configurations/default_mod_tap/test_tap_hold.cpp
index b70efe4aed..01943c10d2 100644
--- a/tests/tap_hold_configurations/default_mod_tap/test_tap_hold.cpp
+++ b/tests/tap_hold_configurations/default_mod_tap/test_tap_hold.cpp
@@ -66,7 +66,7 @@ TEST_F(DefaultTapHold, tap_regular_key_while_mod_tap_key_is_held) {
testing::Mock::VerifyAndClearExpectations(&driver);
}
-TEST_F(DefaultTapHold, tap_mod_tap_key_while_mod_tap_key_is_held) {
+TEST_F(DefaultTapHold, tap_a_mod_tap_key_while_another_mod_tap_key_is_held) {
TestDriver driver;
InSequence s;
auto first_mod_tap_hold_key = KeymapKey(0, 1, 0, SFT_T(KC_P));
diff --git a/tests/tap_hold_configurations/ignore_mod_tap_interrupt/config.h b/tests/tap_hold_configurations/ignore_mod_tap_interrupt/config.h
deleted file mode 100644
index 5955b8600a..0000000000
--- a/tests/tap_hold_configurations/ignore_mod_tap_interrupt/config.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/* Copyright 2021 Stefan Kerkmann
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#pragma once
-
-#include "test_common.h"
-
-#define IGNORE_MOD_TAP_INTERRUPT \ No newline at end of file
diff --git a/tests/tap_hold_configurations/ignore_mod_tap_interrupt/test_tap_hold.cpp b/tests/tap_hold_configurations/ignore_mod_tap_interrupt/test_tap_hold.cpp
deleted file mode 100644
index 319de61070..0000000000
--- a/tests/tap_hold_configurations/ignore_mod_tap_interrupt/test_tap_hold.cpp
+++ /dev/null
@@ -1,136 +0,0 @@
-/* Copyright 2021 Stefan Kerkmann
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "keyboard_report_util.hpp"
-#include "keycode.h"
-#include "test_common.hpp"
-#include "action_tapping.h"
-#include "test_fixture.hpp"
-#include "test_keymap_key.hpp"
-
-using testing::_;
-using testing::InSequence;
-
-class IgnoreModTapInterrupt : public TestFixture {};
-
-TEST_F(IgnoreModTapInterrupt, tap_regular_key_while_mod_tap_key_is_held) {
- TestDriver driver;
- InSequence s;
- auto mod_tap_hold_key = KeymapKey(0, 1, 0, SFT_T(KC_P));
- auto regular_key = KeymapKey(0, 2, 0, KC_A);
-
- set_keymap({mod_tap_hold_key, regular_key});
-
- /* Press mod-tap-hold key */
- EXPECT_NO_REPORT(driver);
- mod_tap_hold_key.press();
- run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
-
- /* Press regular key */
- EXPECT_NO_REPORT(driver);
- regular_key.press();
- run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
-
- /* Release regular key */
- EXPECT_NO_REPORT(driver);
- regular_key.release();
- run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
-
- /* Release mod-tap-hold key */
- EXPECT_REPORT(driver, (KC_P));
- EXPECT_REPORT(driver, (KC_A, KC_P));
- EXPECT_REPORT(driver, (KC_P));
- EXPECT_EMPTY_REPORT(driver);
- mod_tap_hold_key.release();
- run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
-}
-
-TEST_F(IgnoreModTapInterrupt, tap_mod_tap_key_while_mod_tap_key_is_held) {
- TestDriver driver;
- InSequence s;
- auto first_mod_tap_hold_key = KeymapKey(0, 1, 0, SFT_T(KC_P));
- auto second_mod_tap_hold_key = KeymapKey(0, 2, 0, RSFT_T(KC_A));
-
- set_keymap({first_mod_tap_hold_key, second_mod_tap_hold_key});
-
- /* Press first mod-tap-hold key */
- EXPECT_NO_REPORT(driver);
- first_mod_tap_hold_key.press();
- run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
-
- /* Press second tap-hold key */
- EXPECT_NO_REPORT(driver);
- second_mod_tap_hold_key.press();
- run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
-
- /* Release second tap-hold key */
- EXPECT_NO_REPORT(driver);
- second_mod_tap_hold_key.release();
- run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
-
- /* Release first mod-tap-hold key */
- EXPECT_REPORT(driver, (KC_P));
- EXPECT_REPORT(driver, (KC_A, KC_P));
- EXPECT_REPORT(driver, (KC_P));
- EXPECT_EMPTY_REPORT(driver);
- first_mod_tap_hold_key.release();
- run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
-}
-
-TEST_F(IgnoreModTapInterrupt, tap_regular_key_while_layer_tap_key_is_held) {
- TestDriver driver;
- InSequence s;
- auto layer_tap_hold_key = KeymapKey(0, 1, 0, LT(1, KC_P));
- auto regular_key = KeymapKey(0, 2, 0, KC_A);
- auto layer_key = KeymapKey(1, 2, 0, KC_B);
-
- set_keymap({layer_tap_hold_key, regular_key, layer_key});
-
- /* Press layer-tap-hold key */
- EXPECT_NO_REPORT(driver);
- layer_tap_hold_key.press();
- run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
-
- /* Press regular key */
- EXPECT_NO_REPORT(driver);
- regular_key.press();
- run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
-
- /* Release regular key */
- EXPECT_NO_REPORT(driver);
- regular_key.release();
- run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
-
- /* Release layer-tap-hold key */
- EXPECT_REPORT(driver, (KC_P));
- EXPECT_REPORT(driver, (KC_P, regular_key.report_code));
- EXPECT_REPORT(driver, (KC_P));
- EXPECT_EMPTY_REPORT(driver);
- layer_tap_hold_key.release();
- run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
-}
diff --git a/tests/tap_hold_configurations/permissive_hold/test_tap_hold.cpp b/tests/tap_hold_configurations/permissive_hold/test_tap_hold.cpp
index 74e81f347f..e6ecc86401 100644
--- a/tests/tap_hold_configurations/permissive_hold/test_tap_hold.cpp
+++ b/tests/tap_hold_configurations/permissive_hold/test_tap_hold.cpp
@@ -60,7 +60,7 @@ TEST_F(PermissiveHold, tap_regular_key_while_mod_tap_key_is_held) {
testing::Mock::VerifyAndClearExpectations(&driver);
}
-TEST_F(PermissiveHold, tap_mod_tap_key_while_mod_tap_key_is_held) {
+TEST_F(PermissiveHold, tap_a_mod_tap_key_while_another_mod_tap_key_is_held) {
TestDriver driver;
InSequence s;
auto first_mod_tap_hold_key = KeymapKey(0, 1, 0, SFT_T(KC_P));
diff --git a/tests/tap_hold_configurations/permissive_hold_ignore_mod_tap_interrupt/config.h b/tests/tap_hold_configurations/permissive_hold_ignore_mod_tap_interrupt/config.h
deleted file mode 100644
index a6abd50bbe..0000000000
--- a/tests/tap_hold_configurations/permissive_hold_ignore_mod_tap_interrupt/config.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Copyright 2021 Stefan Kerkmann
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#pragma once
-
-#include "test_common.h"
-
-#define IGNORE_MOD_TAP_INTERRUPT
-#define PERMISSIVE_HOLD \ No newline at end of file
diff --git a/tests/tap_hold_configurations/permissive_hold_ignore_mod_tap_interrupt/test.mk b/tests/tap_hold_configurations/permissive_hold_ignore_mod_tap_interrupt/test.mk
deleted file mode 100644
index efecca2c22..0000000000
--- a/tests/tap_hold_configurations/permissive_hold_ignore_mod_tap_interrupt/test.mk
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright 2021 Stefan Kerkmann
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-# --------------------------------------------------------------------------------
-# Keep this file, even if it is empty, as a marker that this folder contains tests
-# --------------------------------------------------------------------------------
diff --git a/tests/tap_hold_configurations/permissive_hold_ignore_mod_tap_interrupt/test_tap_hold.cpp b/tests/tap_hold_configurations/permissive_hold_ignore_mod_tap_interrupt/test_tap_hold.cpp
deleted file mode 100644
index ee7e707c94..0000000000
--- a/tests/tap_hold_configurations/permissive_hold_ignore_mod_tap_interrupt/test_tap_hold.cpp
+++ /dev/null
@@ -1,133 +0,0 @@
-
-/* Copyright 2021 Stefan Kerkmann
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "keyboard_report_util.hpp"
-#include "keycode.h"
-#include "test_common.hpp"
-#include "action_tapping.h"
-#include "test_fixture.hpp"
-#include "test_keymap_key.hpp"
-
-using testing::_;
-using testing::InSequence;
-
-class PermissiveHold_IgnoreModTapInterrupt : public TestFixture {};
-
-TEST_F(PermissiveHold_IgnoreModTapInterrupt, tap_regular_key_while_mod_tap_key_is_held) {
- TestDriver driver;
- InSequence s;
- auto mod_tap_hold_key = KeymapKey(0, 1, 0, SFT_T(KC_P));
- auto regular_key = KeymapKey(0, 2, 0, KC_A);
-
- set_keymap({mod_tap_hold_key, regular_key});
-
- /* Press mod-tap-hold key */
- EXPECT_NO_REPORT(driver);
- mod_tap_hold_key.press();
- run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
-
- /* Press regular key */
- EXPECT_NO_REPORT(driver);
- regular_key.press();
- run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
-
- /* Release regular key */
- EXPECT_REPORT(driver, (KC_LSFT));
- EXPECT_REPORT(driver, (KC_LSFT, KC_A));
- EXPECT_REPORT(driver, (KC_LSFT));
- regular_key.release();
- run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
-
- /* Release mod-tap-hold key */
- EXPECT_EMPTY_REPORT(driver);
- mod_tap_hold_key.release();
- run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
-}
-
-TEST_F(PermissiveHold_IgnoreModTapInterrupt, tap_mod_tap_key_while_mod_tap_key_is_held) {
- TestDriver driver;
- InSequence s;
- auto first_mod_tap_hold_key = KeymapKey(0, 1, 0, SFT_T(KC_P));
- auto second_mod_tap_hold_key = KeymapKey(0, 2, 0, RSFT_T(KC_A));
-
- set_keymap({first_mod_tap_hold_key, second_mod_tap_hold_key});
-
- /* Press first mod-tap-hold key */
- EXPECT_NO_REPORT(driver);
- first_mod_tap_hold_key.press();
- run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
-
- /* Press second tap-hold key */
- EXPECT_NO_REPORT(driver);
- second_mod_tap_hold_key.press();
- run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
-
- /* Release second tap-hold key */
- EXPECT_REPORT(driver, (KC_LSFT));
- EXPECT_REPORT(driver, (KC_LSFT, KC_A));
- EXPECT_REPORT(driver, (KC_LSFT));
- second_mod_tap_hold_key.release();
- run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
-
- /* Release first mod-tap-hold key */
- EXPECT_EMPTY_REPORT(driver);
- first_mod_tap_hold_key.release();
- run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
-}
-
-TEST_F(PermissiveHold_IgnoreModTapInterrupt, tap_regular_key_while_layer_tap_key_is_held) {
- TestDriver driver;
- InSequence s;
- auto layer_tap_hold_key = KeymapKey(0, 1, 0, LT(1, KC_P));
- auto regular_key = KeymapKey(0, 2, 0, KC_A);
- auto layer_key = KeymapKey(1, 2, 0, KC_B);
-
- set_keymap({layer_tap_hold_key, regular_key, layer_key});
-
- /* Press layer-tap-hold key */
- EXPECT_NO_REPORT(driver);
- layer_tap_hold_key.press();
- run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
-
- /* Press regular key */
- EXPECT_NO_REPORT(driver);
- regular_key.press();
- run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
-
- /* Release regular key */
- EXPECT_REPORT(driver, (KC_B));
- EXPECT_EMPTY_REPORT(driver);
- regular_key.release();
- run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
-
- /* Release layer-tap-hold key */
- EXPECT_NO_REPORT(driver);
- layer_tap_hold_key.release();
- run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
-}
diff --git a/tests/tap_hold_configurations/tapping_force_hold/config.h b/tests/tap_hold_configurations/quick_tap/config.h
index 3b4646338a..cd82d3b5a5 100644
--- a/tests/tap_hold_configurations/tapping_force_hold/config.h
+++ b/tests/tap_hold_configurations/quick_tap/config.h
@@ -18,4 +18,4 @@
#include "test_common.h"
-#define TAPPING_FORCE_HOLD \ No newline at end of file
+#define QUICK_TAP_TERM 100
diff --git a/tests/tap_hold_configurations/ignore_mod_tap_interrupt/test.mk b/tests/tap_hold_configurations/quick_tap/test.mk
index efecca2c22..efecca2c22 100644
--- a/tests/tap_hold_configurations/ignore_mod_tap_interrupt/test.mk
+++ b/tests/tap_hold_configurations/quick_tap/test.mk
diff --git a/tests/tap_hold_configurations/tapping_force_hold/test_action_layer.cpp b/tests/tap_hold_configurations/quick_tap/test_action_layer.cpp
index 965c702d7a..9c3b38050a 100644
--- a/tests/tap_hold_configurations/tapping_force_hold/test_action_layer.cpp
+++ b/tests/tap_hold_configurations/quick_tap/test_action_layer.cpp
@@ -40,6 +40,8 @@ TEST_F(ActionLayer, LayerTapToggleWithToggleWithKeypress) {
run_one_scan_loop();
expect_layer_state(0);
+ idle_for(QUICK_TAP_TERM + 10);
+
layer_key.press();
run_one_scan_loop();
layer_key.release();
diff --git a/tests/tap_hold_configurations/quick_tap/test_quick_tap.cpp b/tests/tap_hold_configurations/quick_tap/test_quick_tap.cpp
new file mode 100644
index 0000000000..e2f8c51340
--- /dev/null
+++ b/tests/tap_hold_configurations/quick_tap/test_quick_tap.cpp
@@ -0,0 +1,290 @@
+/* Copyright 2021 Stefan Kerkmann
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+#include "keyboard_report_util.hpp"
+#include "keycode.h"
+#include "test_common.hpp"
+#include "action_tapping.h"
+#include "test_fixture.hpp"
+#include "test_keymap_key.hpp"
+
+using testing::_;
+using testing::InSequence;
+
+class QuickTap : public TestFixture {};
+
+TEST_F(QuickTap, tap_regular_key_while_mod_tap_key_is_held) {
+ TestDriver driver;
+ InSequence s;
+ auto mod_tap_key = KeymapKey(0, 1, 0, SFT_T(KC_P));
+ auto regular_key = KeymapKey(0, 2, 0, KC_A);
+
+ set_keymap({mod_tap_key, regular_key});
+
+ /* Press mod-tap key. */
+ EXPECT_NO_REPORT(driver);
+ mod_tap_key.press();
+ run_one_scan_loop();
+ testing::Mock::VerifyAndClearExpectations(&driver);
+
+ /* Press regular key. */
+ EXPECT_NO_REPORT(driver);
+ regular_key.press();
+ run_one_scan_loop();
+ testing::Mock::VerifyAndClearExpectations(&driver);
+
+ /* Release regular key. */
+ EXPECT_NO_REPORT(driver);
+ regular_key.release();
+ run_one_scan_loop();
+ testing::Mock::VerifyAndClearExpectations(&driver);
+
+ /* Release mod-tap key. */
+ EXPECT_REPORT(driver, (KC_LSFT));
+ mod_tap_key.release();
+ run_one_scan_loop();
+ testing::Mock::VerifyAndClearExpectations(&driver);
+
+ /* Idle for tapping term of mod tap hold key. */
+ EXPECT_REPORT(driver, (KC_LSFT, KC_A));
+ EXPECT_REPORT(driver, (KC_LSFT));
+ EXPECT_EMPTY_REPORT(driver);
+ idle_for(TAPPING_TERM - 3);
+ testing::Mock::VerifyAndClearExpectations(&driver);
+}
+
+TEST_F(QuickTap, tap_mod_tap_key_while_mod_tap_key_is_held) {
+ TestDriver driver;
+ InSequence s;
+ auto first_mod_tap_key = KeymapKey(0, 1, 0, SFT_T(KC_P));
+ auto second_mod_tap_key = KeymapKey(0, 2, 0, RSFT_T(KC_A));
+
+ set_keymap({first_mod_tap_key, second_mod_tap_key});
+
+ /* Press first mod-tap key */
+ EXPECT_NO_REPORT(driver);
+ first_mod_tap_key.press();
+ run_one_scan_loop();
+ testing::Mock::VerifyAndClearExpectations(&driver);
+
+ /* Press second mod-tap key */
+ EXPECT_NO_REPORT(driver);
+ second_mod_tap_key.press();
+ run_one_scan_loop();
+ testing::Mock::VerifyAndClearExpectations(&driver);
+
+ /* Release second tap-hold key */
+ EXPECT_NO_REPORT(driver);
+ second_mod_tap_key.release();
+ run_one_scan_loop();
+ testing::Mock::VerifyAndClearExpectations(&driver);
+
+ /* Release first mod-tap key */
+ EXPECT_REPORT(driver, (KC_LSFT));
+ first_mod_tap_key.release();
+ run_one_scan_loop();
+ testing::Mock::VerifyAndClearExpectations(&driver);
+
+ /* Idle for tapping term of first mod-tap key. */
+ EXPECT_REPORT(driver, (KC_LSFT, KC_A));
+ EXPECT_REPORT(driver, (KC_LSFT));
+ EXPECT_EMPTY_REPORT(driver);
+ idle_for(TAPPING_TERM - 3);
+ testing::Mock::VerifyAndClearExpectations(&driver);
+}
+
+TEST_F(QuickTap, tap_regular_key_while_layer_tap_key_is_held) {
+ TestDriver driver;
+ InSequence s;
+ auto layer_tap_key = KeymapKey(0, 1, 0, LT(1, KC_P));
+ auto regular_key = KeymapKey(0, 2, 0, KC_A);
+ auto layer_key = KeymapKey(1, 2, 0, KC_B);
+
+ set_keymap({layer_tap_key, regular_key, layer_key});
+
+ /* Press layer-tap key */
+ EXPECT_NO_REPORT(driver);
+ layer_tap_key.press();
+ run_one_scan_loop();
+ testing::Mock::VerifyAndClearExpectations(&driver);
+
+ /* Press regular key */
+ EXPECT_NO_REPORT(driver);
+ regular_key.press();
+ run_one_scan_loop();
+ testing::Mock::VerifyAndClearExpectations(&driver);
+
+ /* Release regular key */
+ EXPECT_NO_REPORT(driver);
+ regular_key.release();
+ run_one_scan_loop();
+ testing::Mock::VerifyAndClearExpectations(&driver);
+
+ /* Release layer-tap key */
+ EXPECT_REPORT(driver, (KC_P));
+ EXPECT_REPORT(driver, (KC_A, KC_P));
+ EXPECT_REPORT(driver, (KC_P));
+ EXPECT_EMPTY_REPORT(driver);
+ layer_tap_key.release();
+ run_one_scan_loop();
+ testing::Mock::VerifyAndClearExpectations(&driver);
+}
+
+TEST_F(QuickTap, tap_key_and_tap_again_before_quick_tap_term) {
+ TestDriver driver;
+ InSequence s;
+ auto mod_tap_key = KeymapKey(0, 1, 0, SFT_T(KC_P));
+
+ set_keymap({mod_tap_key});
+
+ /* Press mod-tap key. */
+ EXPECT_NO_REPORT(driver);
+ mod_tap_key.press();
+ run_one_scan_loop();
+ testing::Mock::VerifyAndClearExpectations(&driver);
+
+ /* Release mod-tap key. */
+ EXPECT_REPORT(driver, (KC_P));
+ EXPECT_EMPTY_REPORT(driver);
+ mod_tap_key.release();
+ idle_for(QUICK_TAP_TERM - 10);
+ run_one_scan_loop();
+ testing::Mock::VerifyAndClearExpectations(&driver);
+
+ /* Press and tap mod-tap key again. */
+ EXPECT_REPORT(driver, (KC_P));
+ mod_tap_key.press();
+ run_one_scan_loop();
+ testing::Mock::VerifyAndClearExpectations(&driver);
+
+ /* Release mod-tap key. */
+ EXPECT_EMPTY_REPORT(driver);
+ mod_tap_key.release();
+ run_one_scan_loop();
+ testing::Mock::VerifyAndClearExpectations(&driver);
+}
+
+TEST_F(QuickTap, tap_key_and_hold_again_before_quick_tap_term) {
+ TestDriver driver;
+ InSequence s;
+ auto mod_tap_key = KeymapKey(0, 1, 0, SFT_T(KC_P));
+
+ set_keymap({mod_tap_key});
+
+ /* Press mod-tap key. */
+ EXPECT_NO_REPORT(driver);
+ mod_tap_key.press();
+ run_one_scan_loop();
+ testing::Mock::VerifyAndClearExpectations(&driver);
+
+ /* Release mod-tap key. */
+ EXPECT_REPORT(driver, (KC_P));
+ EXPECT_EMPTY_REPORT(driver);
+ mod_tap_key.release();
+ idle_for(QUICK_TAP_TERM - 10);
+ testing::Mock::VerifyAndClearExpectations(&driver);
+
+ /* Press and hold mod-tap key again. */
+ EXPECT_REPORT(driver, (KC_P));
+ mod_tap_key.press();
+ run_one_scan_loop();
+ testing::Mock::VerifyAndClearExpectations(&driver);
+
+ /* Wait until tapping term expired */
+ EXPECT_NO_REPORT(driver);
+ idle_for(TAPPING_TERM);
+ testing::Mock::VerifyAndClearExpectations(&driver);
+
+ /* Release mod-tap key. */
+ EXPECT_EMPTY_REPORT(driver);
+ mod_tap_key.release();
+ run_one_scan_loop();
+ testing::Mock::VerifyAndClearExpectations(&driver);
+}
+
+TEST_F(QuickTap, tap_key_and_tap_again_after_quick_tap_term) {
+ TestDriver driver;
+ InSequence s;
+ auto mod_tap_key = KeymapKey(0, 1, 0, SFT_T(KC_P));
+
+ set_keymap({mod_tap_key});
+
+ /* Press mod-tap key. */
+ EXPECT_NO_REPORT(driver);
+ mod_tap_key.press();
+ run_one_scan_loop();
+ testing::Mock::VerifyAndClearExpectations(&driver);
+
+ /* Release mod-tap key. */
+ EXPECT_REPORT(driver, (KC_P));
+ EXPECT_EMPTY_REPORT(driver);
+ mod_tap_key.release();
+ idle_for(QUICK_TAP_TERM + 10);
+ run_one_scan_loop();
+ testing::Mock::VerifyAndClearExpectations(&driver);
+
+ /* Press mod-tap key again. */
+ EXPECT_NO_REPORT(driver);
+ mod_tap_key.press();
+ run_one_scan_loop();
+ testing::Mock::VerifyAndClearExpectations(&driver);
+
+ /* Release mod-tap key. */
+ EXPECT_REPORT(driver, (KC_P));
+ EXPECT_EMPTY_REPORT(driver);
+ mod_tap_key.release();
+ run_one_scan_loop();
+ testing::Mock::VerifyAndClearExpectations(&driver);
+}
+
+TEST_F(QuickTap, tap_key_and_hold_again_after_quick_tap_term) {
+ TestDriver driver;
+ InSequence s;
+ auto mod_tap_key = KeymapKey(0, 1, 0, SFT_T(KC_P));
+
+ set_keymap({mod_tap_key});
+
+ /* Press mod-tap key. */
+ EXPECT_NO_REPORT(driver);
+ mod_tap_key.press();
+ run_one_scan_loop();
+ testing::Mock::VerifyAndClearExpectations(&driver);
+
+ /* Release mod-tap key. */
+ EXPECT_REPORT(driver, (KC_P));
+ EXPECT_EMPTY_REPORT(driver);
+ mod_tap_key.release();
+ idle_for(QUICK_TAP_TERM + 10);
+ testing::Mock::VerifyAndClearExpectations(&driver);
+
+ /* Press and hold mod-tap key again. */
+ EXPECT_NO_REPORT(driver);
+ mod_tap_key.press();
+ run_one_scan_loop();
+ testing::Mock::VerifyAndClearExpectations(&driver);
+
+ /* Wait until tapping term expired */
+ EXPECT_REPORT(driver, (KC_LSFT));
+ idle_for(TAPPING_TERM);
+ testing::Mock::VerifyAndClearExpectations(&driver);
+
+ /* Release mod-tap key. */
+ EXPECT_EMPTY_REPORT(driver);
+ mod_tap_key.release();
+ run_one_scan_loop();
+ testing::Mock::VerifyAndClearExpectations(&driver);
+}
diff --git a/tests/tap_hold_configurations/tapping_force_hold/test.mk b/tests/tap_hold_configurations/tapping_force_hold/test.mk
deleted file mode 100644
index efecca2c22..0000000000
--- a/tests/tap_hold_configurations/tapping_force_hold/test.mk
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright 2021 Stefan Kerkmann
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-# --------------------------------------------------------------------------------
-# Keep this file, even if it is empty, as a marker that this folder contains tests
-# --------------------------------------------------------------------------------
diff --git a/tests/tap_hold_configurations/tapping_force_hold/test_tap_hold.cpp b/tests/tap_hold_configurations/tapping_force_hold/test_tap_hold.cpp
deleted file mode 100644
index 604f9a4a54..0000000000
--- a/tests/tap_hold_configurations/tapping_force_hold/test_tap_hold.cpp
+++ /dev/null
@@ -1,213 +0,0 @@
-
-/* Copyright 2021 Stefan Kerkmann
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "keyboard_report_util.hpp"
-#include "keycode.h"
-#include "test_common.hpp"
-#include "action_tapping.h"
-#include "test_fixture.hpp"
-#include "test_keymap_key.hpp"
-
-using testing::_;
-using testing::InSequence;
-
-class TappingForceHold : public TestFixture {};
-
-TEST_F(TappingForceHold, tap_regular_key_while_mod_tap_key_is_held) {
- TestDriver driver;
- InSequence s;
- auto mod_tap_hold_key = KeymapKey(0, 1, 0, SFT_T(KC_P));
- auto regular_key = KeymapKey(0, 2, 0, KC_A);
-
- set_keymap({mod_tap_hold_key, regular_key});
-
- /* Press mod-tap-hold key. */
- EXPECT_NO_REPORT(driver);
- mod_tap_hold_key.press();
- run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
-
- /* Press regular key. */
- EXPECT_NO_REPORT(driver);
- regular_key.press();
- run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
-
- /* Release regular key. */
- EXPECT_NO_REPORT(driver);
- regular_key.release();
- run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
-
- /* Release mod-tap-hold key. */
- EXPECT_REPORT(driver, (KC_LSFT));
- mod_tap_hold_key.release();
- run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
-
- /* Idle for tapping term of mod tap hold key. */
- EXPECT_REPORT(driver, (KC_LSFT, KC_A));
- EXPECT_REPORT(driver, (KC_LSFT));
- EXPECT_EMPTY_REPORT(driver);
- idle_for(TAPPING_TERM - 3);
- testing::Mock::VerifyAndClearExpectations(&driver);
-}
-
-TEST_F(TappingForceHold, tap_mod_tap_key_while_mod_tap_key_is_held) {
- TestDriver driver;
- InSequence s;
- auto first_mod_tap_hold_key = KeymapKey(0, 1, 0, SFT_T(KC_P));
- auto second_mod_tap_hold_key = KeymapKey(0, 2, 0, RSFT_T(KC_A));
-
- set_keymap({first_mod_tap_hold_key, second_mod_tap_hold_key});
-
- /* Press first mod-tap-hold key */
- EXPECT_NO_REPORT(driver);
- first_mod_tap_hold_key.press();
- run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
-
- /* Press second tap-hold key */
- EXPECT_NO_REPORT(driver);
- second_mod_tap_hold_key.press();
- run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
-
- /* Release second tap-hold key */
- EXPECT_NO_REPORT(driver);
- second_mod_tap_hold_key.release();
- run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
-
- /* Release first mod-tap-hold key */
- EXPECT_REPORT(driver, (KC_LSFT));
- first_mod_tap_hold_key.release();
- run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
-
- /* Idle for tapping term of first mod tap hold key. */
- EXPECT_REPORT(driver, (KC_LSFT, KC_A));
- EXPECT_REPORT(driver, (KC_LSFT));
- EXPECT_EMPTY_REPORT(driver);
- idle_for(TAPPING_TERM - 3);
- testing::Mock::VerifyAndClearExpectations(&driver);
-}
-
-TEST_F(TappingForceHold, tap_regular_key_while_layer_tap_key_is_held) {
- TestDriver driver;
- InSequence s;
- auto layer_tap_hold_key = KeymapKey(0, 1, 0, LT(1, KC_P));
- auto regular_key = KeymapKey(0, 2, 0, KC_A);
- auto layer_key = KeymapKey(1, 2, 0, KC_B);
-
- set_keymap({layer_tap_hold_key, regular_key, layer_key});
-
- /* Press layer-tap-hold key */
- EXPECT_NO_REPORT(driver);
- layer_tap_hold_key.press();
- run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
-
- /* Press regular key */
- EXPECT_NO_REPORT(driver);
- regular_key.press();
- run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
-
- /* Release regular key */
- EXPECT_NO_REPORT(driver);
- regular_key.release();
- run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
-
- /* Release layer-tap-hold key */
- EXPECT_REPORT(driver, (KC_P));
- EXPECT_REPORT(driver, (KC_A, KC_P));
- EXPECT_REPORT(driver, (KC_P));
- EXPECT_EMPTY_REPORT(driver);
- layer_tap_hold_key.release();
- run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
-}
-
-TEST_F(TappingForceHold, tap_mod_tap_hold_key_two_times) {
- TestDriver driver;
- InSequence s;
- auto mod_tap_hold_key = KeymapKey(0, 1, 0, SFT_T(KC_P));
-
- set_keymap({mod_tap_hold_key});
-
- /* Press mod-tap-hold key. */
- EXPECT_NO_REPORT(driver);
- mod_tap_hold_key.press();
- run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
-
- /* Release mod-tap-hold key. */
- EXPECT_REPORT(driver, (KC_P));
- EXPECT_EMPTY_REPORT(driver);
- mod_tap_hold_key.release();
- run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
-
- /* Press mod-tap-hold key again. */
- EXPECT_NO_REPORT(driver);
- mod_tap_hold_key.press();
- run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
-
- /* Release mod-tap-hold key. */
- EXPECT_REPORT(driver, (KC_P));
- EXPECT_EMPTY_REPORT(driver);
- mod_tap_hold_key.release();
- run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
-}
-
-TEST_F(TappingForceHold, tap_mod_tap_hold_key_twice_and_hold_on_second_time) {
- TestDriver driver;
- InSequence s;
- auto mod_tap_hold_key = KeymapKey(0, 1, 0, SFT_T(KC_P));
-
- set_keymap({mod_tap_hold_key});
-
- /* Press mod-tap-hold key. */
- EXPECT_NO_REPORT(driver);
- mod_tap_hold_key.press();
- run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
-
- /* Release mod-tap-hold key. */
- EXPECT_REPORT(driver, (KC_P));
- EXPECT_EMPTY_REPORT(driver);
- mod_tap_hold_key.release();
- run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
-
- /* Press mod-tap-hold key again. */
- EXPECT_NO_REPORT(driver);
- mod_tap_hold_key.press();
- idle_for(TAPPING_TERM);
- testing::Mock::VerifyAndClearExpectations(&driver);
-
- /* Release mod-tap-hold key. */
- EXPECT_REPORT(driver, (KC_LEFT_SHIFT));
- EXPECT_EMPTY_REPORT(driver);
- mod_tap_hold_key.release();
- run_one_scan_loop();
- testing::Mock::VerifyAndClearExpectations(&driver);
-}
diff --git a/tests/test_common/keyboard_report_util.cpp b/tests/test_common/keyboard_report_util.cpp
index 7908e64f7f..2de1af2301 100644
--- a/tests/test_common/keyboard_report_util.cpp
+++ b/tests/test_common/keyboard_report_util.cpp
@@ -15,11 +15,16 @@
*/
#include "keyboard_report_util.hpp"
+#include <cstdint>
#include <vector>
#include <algorithm>
+
using namespace testing;
+extern std::map<uint16_t, std::string> KEYCODE_ID_TABLE;
+
namespace {
+
std::vector<uint8_t> get_keys(const report_keyboard_t& report) {
std::vector<uint8_t> result;
#if defined(NKRO_ENABLE)
@@ -36,6 +41,19 @@ std::vector<uint8_t> get_keys(const report_keyboard_t& report) {
std::sort(result.begin(), result.end());
return result;
}
+
+std::vector<uint8_t> get_mods(const report_keyboard_t& report) {
+ std::vector<uint8_t> result;
+ for (size_t i = 0; i < 8; i++) {
+ if (report.mods & (1 << i)) {
+ uint8_t code = KC_LEFT_CTRL + i;
+ result.emplace_back(code);
+ }
+ }
+ std::sort(result.begin(), result.end());
+ return result;
+}
+
} // namespace
bool operator==(const report_keyboard_t& lhs, const report_keyboard_t& rhs) {
@@ -44,21 +62,36 @@ bool operator==(const report_keyboard_t& lhs, const report_keyboard_t& rhs) {
return lhs.mods == rhs.mods && lhskeys == rhskeys;
}
-std::ostream& operator<<(std::ostream& stream, const report_keyboard_t& report) {
+std::ostream& operator<<(std::ostream& os, const report_keyboard_t& report) {
auto keys = get_keys(report);
+ auto mods = get_mods(report);
- // TODO: This should probably print friendly names for the keys
- stream << "Keyboard Report: Mods (" << (uint32_t)report.mods << ") Keys (";
+ os << std::setw(10) << std::left << "report: ";
+
+ if (!keys.size() && !mods.size()) {
+ return os << "empty" << std::endl;
+ }
+ os << "(";
for (auto key = keys.cbegin(); key != keys.cend();) {
- stream << +(*key);
+ os << KEYCODE_ID_TABLE.at(*key);
key++;
if (key != keys.cend()) {
- stream << ",";
+ os << ", ";
+ }
+ }
+
+ os << ") [";
+
+ for (auto mod = mods.cbegin(); mod != mods.cend();) {
+ os << KEYCODE_ID_TABLE.at(*mod);
+ mod++;
+ if (mod != mods.cend()) {
+ os << ", ";
}
}
- return stream << ")" << std::endl;
+ return os << "]" << std::endl;
}
KeyboardReportMatcher::KeyboardReportMatcher(const std::vector<uint8_t>& keys) {
diff --git a/tests/test_common/keycode_table.cpp b/tests/test_common/keycode_table.cpp
new file mode 100644
index 0000000000..63350c272d
--- /dev/null
+++ b/tests/test_common/keycode_table.cpp
@@ -0,0 +1,663 @@
+// Copyright 2022 QMK
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+/*******************************************************************************
+ 88888888888 888 d8b .d888 d8b 888 d8b
+ 888 888 Y8P d88P" Y8P 888 Y8P
+ 888 888 888 888
+ 888 88888b. 888 .d8888b 888888 888 888 .d88b. 888 .d8888b
+ 888 888 "88b 888 88K 888 888 888 d8P Y8b 888 88K
+ 888 888 888 888 "Y8888b. 888 888 888 88888888 888 "Y8888b.
+ 888 888 888 888 X88 888 888 888 Y8b. 888 X88
+ 888 888 888 888 88888P' 888 888 888 "Y8888 888 88888P'
+ 888 888
+ 888 888
+ 888 888
+ .d88b. .d88b. 88888b. .d88b. 888d888 8888b. 888888 .d88b. .d88888
+ d88P"88b d8P Y8b 888 "88b d8P Y8b 888P" "88b 888 d8P Y8b d88" 888
+ 888 888 88888888 888 888 88888888 888 .d888888 888 88888888 888 888
+ Y88b 888 Y8b. 888 888 Y8b. 888 888 888 Y88b. Y8b. Y88b 888
+ "Y88888 "Y8888 888 888 "Y8888 888 "Y888888 "Y888 "Y8888 "Y88888
+ 888
+ Y8b d88P
+ "Y88P"
+*******************************************************************************/
+
+// clang-format off
+extern "C" {
+#include <keycode.h>
+}
+#include <map>
+#include <string>
+#include <cstdint>
+
+std::map<uint16_t, std::string> KEYCODE_ID_TABLE = {
+ {KC_NO, "KC_NO"},
+ {KC_TRANSPARENT, "KC_TRANSPARENT"},
+ {KC_A, "KC_A"},
+ {KC_B, "KC_B"},
+ {KC_C, "KC_C"},
+ {KC_D, "KC_D"},
+ {KC_E, "KC_E"},
+ {KC_F, "KC_F"},
+ {KC_G, "KC_G"},
+ {KC_H, "KC_H"},
+ {KC_I, "KC_I"},
+ {KC_J, "KC_J"},
+ {KC_K, "KC_K"},
+ {KC_L, "KC_L"},
+ {KC_M, "KC_M"},
+ {KC_N, "KC_N"},
+ {KC_O, "KC_O"},
+ {KC_P, "KC_P"},
+ {KC_Q, "KC_Q"},
+ {KC_R, "KC_R"},
+ {KC_S, "KC_S"},
+ {KC_T, "KC_T"},
+ {KC_U, "KC_U"},
+ {KC_V, "KC_V"},
+ {KC_W, "KC_W"},
+ {KC_X, "KC_X"},
+ {KC_Y, "KC_Y"},
+ {KC_Z, "KC_Z"},
+ {KC_1, "KC_1"},
+ {KC_2, "KC_2"},
+ {KC_3, "KC_3"},
+ {KC_4, "KC_4"},
+ {KC_5, "KC_5"},
+ {KC_6, "KC_6"},
+ {KC_7, "KC_7"},
+ {KC_8, "KC_8"},
+ {KC_9, "KC_9"},
+ {KC_0, "KC_0"},
+ {KC_ENTER, "KC_ENTER"},
+ {KC_ESCAPE, "KC_ESCAPE"},
+ {KC_BACKSPACE, "KC_BACKSPACE"},
+ {KC_TAB, "KC_TAB"},
+ {KC_SPACE, "KC_SPACE"},
+ {KC_MINUS, "KC_MINUS"},
+ {KC_EQUAL, "KC_EQUAL"},
+ {KC_LEFT_BRACKET, "KC_LEFT_BRACKET"},
+ {KC_RIGHT_BRACKET, "KC_RIGHT_BRACKET"},
+ {KC_BACKSLASH, "KC_BACKSLASH"},
+ {KC_NONUS_HASH, "KC_NONUS_HASH"},
+ {KC_SEMICOLON, "KC_SEMICOLON"},
+ {KC_QUOTE, "KC_QUOTE"},
+ {KC_GRAVE, "KC_GRAVE"},
+ {KC_COMMA, "KC_COMMA"},
+ {KC_DOT, "KC_DOT"},
+ {KC_SLASH, "KC_SLASH"},
+ {KC_CAPS_LOCK, "KC_CAPS_LOCK"},
+ {KC_F1, "KC_F1"},
+ {KC_F2, "KC_F2"},
+ {KC_F3, "KC_F3"},
+ {KC_F4, "KC_F4"},
+ {KC_F5, "KC_F5"},
+ {KC_F6, "KC_F6"},
+ {KC_F7, "KC_F7"},
+ {KC_F8, "KC_F8"},
+ {KC_F9, "KC_F9"},
+ {KC_F10, "KC_F10"},
+ {KC_F11, "KC_F11"},
+ {KC_F12, "KC_F12"},
+ {KC_PRINT_SCREEN, "KC_PRINT_SCREEN"},
+ {KC_SCROLL_LOCK, "KC_SCROLL_LOCK"},
+ {KC_PAUSE, "KC_PAUSE"},
+ {KC_INSERT, "KC_INSERT"},
+ {KC_HOME, "KC_HOME"},
+ {KC_PAGE_UP, "KC_PAGE_UP"},
+ {KC_DELETE, "KC_DELETE"},
+ {KC_END, "KC_END"},
+ {KC_PAGE_DOWN, "KC_PAGE_DOWN"},
+ {KC_RIGHT, "KC_RIGHT"},
+ {KC_LEFT, "KC_LEFT"},
+ {KC_DOWN, "KC_DOWN"},
+ {KC_UP, "KC_UP"},
+ {KC_NUM_LOCK, "KC_NUM_LOCK"},
+ {KC_KP_SLASH, "KC_KP_SLASH"},
+ {KC_KP_ASTERISK, "KC_KP_ASTERISK"},
+ {KC_KP_MINUS, "KC_KP_MINUS"},
+ {KC_KP_PLUS, "KC_KP_PLUS"},
+ {KC_KP_ENTER, "KC_KP_ENTER"},
+ {KC_KP_1, "KC_KP_1"},
+ {KC_KP_2, "KC_KP_2"},
+ {KC_KP_3, "KC_KP_3"},
+ {KC_KP_4, "KC_KP_4"},
+ {KC_KP_5, "KC_KP_5"},
+ {KC_KP_6, "KC_KP_6"},
+ {KC_KP_7, "KC_KP_7"},
+ {KC_KP_8, "KC_KP_8"},
+ {KC_KP_9, "KC_KP_9"},
+ {KC_KP_0, "KC_KP_0"},
+ {KC_KP_DOT, "KC_KP_DOT"},
+ {KC_NONUS_BACKSLASH, "KC_NONUS_BACKSLASH"},
+ {KC_APPLICATION, "KC_APPLICATION"},
+ {KC_KB_POWER, "KC_KB_POWER"},
+ {KC_KP_EQUAL, "KC_KP_EQUAL"},
+ {KC_F13, "KC_F13"},
+ {KC_F14, "KC_F14"},
+ {KC_F15, "KC_F15"},
+ {KC_F16, "KC_F16"},
+ {KC_F17, "KC_F17"},
+ {KC_F18, "KC_F18"},
+ {KC_F19, "KC_F19"},
+ {KC_F20, "KC_F20"},
+ {KC_F21, "KC_F21"},
+ {KC_F22, "KC_F22"},
+ {KC_F23, "KC_F23"},
+ {KC_F24, "KC_F24"},
+ {KC_EXECUTE, "KC_EXECUTE"},
+ {KC_HELP, "KC_HELP"},
+ {KC_MENU, "KC_MENU"},
+ {KC_SELECT, "KC_SELECT"},
+ {KC_STOP, "KC_STOP"},
+ {KC_AGAIN, "KC_AGAIN"},
+ {KC_UNDO, "KC_UNDO"},
+ {KC_CUT, "KC_CUT"},
+ {KC_COPY, "KC_COPY"},
+ {KC_PASTE, "KC_PASTE"},
+ {KC_FIND, "KC_FIND"},
+ {KC_KB_MUTE, "KC_KB_MUTE"},
+ {KC_KB_VOLUME_UP, "KC_KB_VOLUME_UP"},
+ {KC_KB_VOLUME_DOWN, "KC_KB_VOLUME_DOWN"},
+ {KC_LOCKING_CAPS_LOCK, "KC_LOCKING_CAPS_LOCK"},
+ {KC_LOCKING_NUM_LOCK, "KC_LOCKING_NUM_LOCK"},
+ {KC_LOCKING_SCROLL_LOCK, "KC_LOCKING_SCROLL_LOCK"},
+ {KC_KP_COMMA, "KC_KP_COMMA"},
+ {KC_KP_EQUAL_AS400, "KC_KP_EQUAL_AS400"},
+ {KC_INTERNATIONAL_1, "KC_INTERNATIONAL_1"},
+ {KC_INTERNATIONAL_2, "KC_INTERNATIONAL_2"},
+ {KC_INTERNATIONAL_3, "KC_INTERNATIONAL_3"},
+ {KC_INTERNATIONAL_4, "KC_INTERNATIONAL_4"},
+ {KC_INTERNATIONAL_5, "KC_INTERNATIONAL_5"},
+ {KC_INTERNATIONAL_6, "KC_INTERNATIONAL_6"},
+ {KC_INTERNATIONAL_7, "KC_INTERNATIONAL_7"},
+ {KC_INTERNATIONAL_8, "KC_INTERNATIONAL_8"},
+ {KC_INTERNATIONAL_9, "KC_INTERNATIONAL_9"},
+ {KC_LANGUAGE_1, "KC_LANGUAGE_1"},
+ {KC_LANGUAGE_2, "KC_LANGUAGE_2"},
+ {KC_LANGUAGE_3, "KC_LANGUAGE_3"},
+ {KC_LANGUAGE_4, "KC_LANGUAGE_4"},
+ {KC_LANGUAGE_5, "KC_LANGUAGE_5"},
+ {KC_LANGUAGE_6, "KC_LANGUAGE_6"},
+ {KC_LANGUAGE_7, "KC_LANGUAGE_7"},
+ {KC_LANGUAGE_8, "KC_LANGUAGE_8"},
+ {KC_LANGUAGE_9, "KC_LANGUAGE_9"},
+ {KC_ALTERNATE_ERASE, "KC_ALTERNATE_ERASE"},
+ {KC_SYSTEM_REQUEST, "KC_SYSTEM_REQUEST"},
+ {KC_CANCEL, "KC_CANCEL"},
+ {KC_CLEAR, "KC_CLEAR"},
+ {KC_PRIOR, "KC_PRIOR"},
+ {KC_RETURN, "KC_RETURN"},
+ {KC_SEPARATOR, "KC_SEPARATOR"},
+ {KC_OUT, "KC_OUT"},
+ {KC_OPER, "KC_OPER"},
+ {KC_CLEAR_AGAIN, "KC_CLEAR_AGAIN"},
+ {KC_CRSEL, "KC_CRSEL"},
+ {KC_EXSEL, "KC_EXSEL"},
+ {KC_SYSTEM_POWER, "KC_SYSTEM_POWER"},
+ {KC_SYSTEM_SLEEP, "KC_SYSTEM_SLEEP"},
+ {KC_SYSTEM_WAKE, "KC_SYSTEM_WAKE"},
+ {KC_AUDIO_MUTE, "KC_AUDIO_MUTE"},
+ {KC_AUDIO_VOL_UP, "KC_AUDIO_VOL_UP"},
+ {KC_AUDIO_VOL_DOWN, "KC_AUDIO_VOL_DOWN"},
+ {KC_MEDIA_NEXT_TRACK, "KC_MEDIA_NEXT_TRACK"},
+ {KC_MEDIA_PREV_TRACK, "KC_MEDIA_PREV_TRACK"},
+ {KC_MEDIA_STOP, "KC_MEDIA_STOP"},
+ {KC_MEDIA_PLAY_PAUSE, "KC_MEDIA_PLAY_PAUSE"},
+ {KC_MEDIA_SELECT, "KC_MEDIA_SELECT"},
+ {KC_MEDIA_EJECT, "KC_MEDIA_EJECT"},
+ {KC_MAIL, "KC_MAIL"},
+ {KC_CALCULATOR, "KC_CALCULATOR"},
+ {KC_MY_COMPUTER, "KC_MY_COMPUTER"},
+ {KC_WWW_SEARCH, "KC_WWW_SEARCH"},
+ {KC_WWW_HOME, "KC_WWW_HOME"},
+ {KC_WWW_BACK, "KC_WWW_BACK"},
+ {KC_WWW_FORWARD, "KC_WWW_FORWARD"},
+ {KC_WWW_STOP, "KC_WWW_STOP"},
+ {KC_WWW_REFRESH, "KC_WWW_REFRESH"},
+ {KC_WWW_FAVORITES, "KC_WWW_FAVORITES"},
+ {KC_MEDIA_FAST_FORWARD, "KC_MEDIA_FAST_FORWARD"},
+ {KC_MEDIA_REWIND, "KC_MEDIA_REWIND"},
+ {KC_BRIGHTNESS_UP, "KC_BRIGHTNESS_UP"},
+ {KC_BRIGHTNESS_DOWN, "KC_BRIGHTNESS_DOWN"},
+ {KC_CONTROL_PANEL, "KC_CONTROL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E_UP, "QK_MIDI_TRANSPOSE_UP"},
+ {QK_MIDI_VELOCITY_0, "QK_MIDI_VELOCITY_0"},
+ {QK_MIDI_VELOCITY_1, "QK_MIDI_VELOCITY_1"},
+ {QK_MIDI_VELOCITY_2, "QK_MIDI_VELOCITY_2"},
+ {QK_MIDI_VELOCITY_3, "QK_MIDI_VELOCITY_3"},
+ {QK_MIDI_VELOCITY_4, "QK_MIDI_VELOCITY_4"},
+ {QK_MIDI_VELOCITY_5, "QK_MIDI_VELOCITY_5"},
+ {QK_MIDI_VELOCITY_6, "QK_MIDI_VELOCITY_6"},
+ {QK_MIDI_VELOCITY_7, "QK_MIDI_VELOCITY_7"},
+ {QK_MIDI_VELOCITY_8, "QK_MIDI_VELOCITY_8"},
+ {QK_MIDI_VELOCITY_9, "QK_MIDI_VELOCITY_9"},
+ {QK_MIDI_VELOCITY_10, "QK_MIDI_VELOCITY_10"},
+ {QK_MIDI_VELOCITY_DOWN, "QK_MIDI_VELOCITY_DOWN"},
+ {QK_MIDI_VELOCITY_UP, "QK_MIDI_VELOCITY_UP"},
+ {QK_MIDI_CHANNEL_1, "QK_MIDI_CHANNEL_1"},
+ {QK_MIDI_CHANNEL_2, "QK_MIDI_CHANNEL_2"},
+ {QK_MIDI_CHANNEL_3, "QK_MIDI_CHANNEL_3"},
+ {QK_MIDI_CHANNEL_4, "QK_MIDI_CHANNEL_4"},
+ {QK_MIDI_CHANNEL_5, "QK_MIDI_CHANNEL_5"},
+ {QK_MIDI_CHANNEL_6, "QK_MIDI_CHANNEL_6"},
+ {QK_MIDI_CHANNEL_7, "QK_MIDI_CHANNEL_7"},
+ {QK_MIDI_CHANNEL_8, "QK_MIDI_CHANNEL_8"},
+ {QK_MIDI_CHANNEL_9, "QK_MIDI_CHANNEL_9"},
+ {QK_MIDI_CHANNEL_10, "QK_MIDI_CHANNEL_10"},
+ {QK_MIDI_CHANNEL_11, "QK_MIDI_CHANNEL_11"},
+ {QK_MIDI_CHANNEL_12, "QK_MIDI_CHANNEL_12"},
+ {QK_MIDI_CHANNEL_13, "QK_MIDI_CHANNEL_13"},
+ {QK_MIDI_CHANNEL_14, "QK_MIDI_CHANNEL_14"},
+ {QK_MIDI_CHANNEL_15, "QK_MIDI_CHANNEL_15"},
+ {QK_MIDI_CHANNEL_16, "QK_MIDI_CHANNEL_16"},
+ {QK_MIDI_CHANNEL_DOWN, "QK_MIDI_CHANNEL_DOWN"},
+ {QK_MIDI_CHANNEL_UP, "QK_MIDI_CHANNEL_UP"},
+ {QK_MIDI_ALL_NOTES_OFF, "QK_MIDI_ALL_NOTES_OFF"},
+ {QK_MIDI_SUSTAIN, "QK_MIDI_SUSTAIN"},
+ {QK_MIDI_PORTAMENTO, "QK_MIDI_PORTAMENTO"},
+ {QK_MIDI_SOSTENUTO, "QK_MIDI_SOSTENUTO"},
+ {QK_MIDI_SOFT, "QK_MIDI_SOFT"},
+ {QK_MIDI_LEGATO, "QK_MIDI_LEGATO"},
+ {QK_MIDI_MODULATION, "QK_MIDI_MODULATION"},
+ {QK_MIDI_MODULATION_SPEED_DOWN, "QK_MIDI_MODULATION_SPEED_DOWN"},
+ {QK_MIDI_MODULATION_SPEED_UP, "QK_MIDI_MODULATION_SPEED_UP"},
+ {QK_MIDI_PITCH_BEND_DOWN, "QK_MIDI_PITCH_BEND_DOWN"},
+ {QK_MIDI_PITCH_BEND_UP, "QK_MIDI_PITCH_BEND_UP"},
+ {SQ_ON, "SQ_ON"},
+ {SQ_OFF, "SQ_OFF"},
+ {SQ_TOG, "SQ_TOG"},
+ {SQ_TMPD, "SQ_TMPD"},
+ {SQ_TMPU, "SQ_TMPU"},
+ {SQ_RESD, "SQ_RESD"},
+ {SQ_RESU, "SQ_RESU"},
+ {SQ_SALL, "SQ_SALL"},
+ {SQ_SCLR, "SQ_SCLR"},
+ {QK_JOYSTICK_BUTTON_0, "QK_JOYSTICK_BUTTON_0"},
+ {QK_JOYSTICK_BUTTON_1, "QK_JOYSTICK_BUTTON_1"},
+ {QK_JOYSTICK_BUTTON_2, "QK_JOYSTICK_BUTTON_2"},
+ {QK_JOYSTICK_BUTTON_3, "QK_JOYSTICK_BUTTON_3"},
+ {QK_JOYSTICK_BUTTON_4, "QK_JOYSTICK_BUTTON_4"},
+ {QK_JOYSTICK_BUTTON_5, "QK_JOYSTICK_BUTTON_5"},
+ {QK_JOYSTICK_BUTTON_6, "QK_JOYSTICK_BUTTON_6"},
+ {QK_JOYSTICK_BUTTON_7, "QK_JOYSTICK_BUTTON_7"},
+ {QK_JOYSTICK_BUTTON_8, "QK_JOYSTICK_BUTTON_8"},
+ {QK_JOYSTICK_BUTTON_9, "QK_JOYSTICK_BUTTON_9"},
+ {QK_JOYSTICK_BUTTON_10, "QK_JOYSTICK_BUTTON_10"},
+ {QK_JOYSTICK_BUTTON_11, "QK_JOYSTICK_BUTTON_11"},
+ {QK_JOYSTICK_BUTTON_12, "QK_JOYSTICK_BUTTON_12"},
+ {QK_JOYSTICK_BUTTON_13, "QK_JOYSTICK_BUTTON_13"},
+ {QK_JOYSTICK_BUTTON_14, "QK_JOYSTICK_BUTTON_14"},
+ {QK_JOYSTICK_BUTTON_15, "QK_JOYSTICK_BUTTON_15"},
+ {QK_JOYSTICK_BUTTON_16, "QK_JOYSTICK_BUTTON_16"},
+ {QK_JOYSTICK_BUTTON_17, "QK_JOYSTICK_BUTTON_17"},
+ {QK_JOYSTICK_BUTTON_18, "QK_JOYSTICK_BUTTON_18"},
+ {QK_JOYSTICK_BUTTON_19, "QK_JOYSTICK_BUTTON_19"},
+ {QK_JOYSTICK_BUTTON_20, "QK_JOYSTICK_BUTTON_20"},
+ {QK_JOYSTICK_BUTTON_21, "QK_JOYSTICK_BUTTON_21"},
+ {QK_JOYSTICK_BUTTON_22, "QK_JOYSTICK_BUTTON_22"},
+ {QK_JOYSTICK_BUTTON_23, "QK_JOYSTICK_BUTTON_23"},
+ {QK_JOYSTICK_BUTTON_24, "QK_JOYSTICK_BUTTON_24"},
+ {QK_JOYSTICK_BUTTON_25, "QK_JOYSTICK_BUTTON_25"},
+ {QK_JOYSTICK_BUTTON_26, "QK_JOYSTICK_BUTTON_26"},
+ {QK_JOYSTICK_BUTTON_27, "QK_JOYSTICK_BUTTON_27"},
+ {QK_JOYSTICK_BUTTON_28, "QK_JOYSTICK_BUTTON_28"},
+ {QK_JOYSTICK_BUTTON_29, "QK_JOYSTICK_BUTTON_29"},
+ {QK_JOYSTICK_BUTTON_30, "QK_JOYSTICK_BUTTON_30"},
+ {QK_JOYSTICK_BUTTON_31, "QK_JOYSTICK_BUTTON_31"},
+ {QK_PROGRAMMABLE_BUTTON_1, "QK_PROGRAMMABLE_BUTTON_1"},
+ {QK_PROGRAMMABLE_BUTTON_2, "QK_PROGRAMMABLE_BUTTON_2"},
+ {QK_PROGRAMMABLE_BUTTON_3, "QK_PROGRAMMABLE_BUTTON_3"},
+ {QK_PROGRAMMABLE_BUTTON_4, "QK_PROGRAMMABLE_BUTTON_4"},
+ {QK_PROGRAMMABLE_BUTTON_5, "QK_PROGRAMMABLE_BUTTON_5"},
+ {QK_PROGRAMMABLE_BUTTON_6, "QK_PROGRAMMABLE_BUTTON_6"},
+ {QK_PROGRAMMABLE_BUTTON_7, "QK_PROGRAMMABLE_BUTTON_7"},
+ {QK_PROGRAMMABLE_BUTTON_8, "QK_PROGRAMMABLE_BUTTON_8"},
+ {QK_PROGRAMMABLE_BUTTON_9, "QK_PROGRAMMABLE_BUTTON_9"},
+ {QK_PROGRAMMABLE_BUTTON_10, "QK_PROGRAMMABLE_BUTTON_10"},
+ {QK_PROGRAMMABLE_BUTTON_11, "QK_PROGRAMMABLE_BUTTON_11"},
+ {QK_PROGRAMMABLE_BUTTON_12, "QK_PROGRAMMABLE_BUTTON_12"},
+ {QK_PROGRAMMABLE_BUTTON_13, "QK_PROGRAMMABLE_BUTTON_13"},
+ {QK_PROGRAMMABLE_BUTTON_14, "QK_PROGRAMMABLE_BUTTON_14"},
+ {QK_PROGRAMMABLE_BUTTON_15, "QK_PROGRAMMABLE_BUTTON_15"},
+ {QK_PROGRAMMABLE_BUTTON_16, "QK_PROGRAMMABLE_BUTTON_16"},
+ {QK_PROGRAMMABLE_BUTTON_17, "QK_PROGRAMMABLE_BUTTON_17"},
+ {QK_PROGRAMMABLE_BUTTON_18, "QK_PROGRAMMABLE_BUTTON_18"},
+ {QK_PROGRAMMABLE_BUTTON_19, "QK_PROGRAMMABLE_BUTTON_19"},
+ {QK_PROGRAMMABLE_BUTTON_20, "QK_PROGRAMMABLE_BUTTON_20"},
+ {QK_PROGRAMMABLE_BUTTON_21, "QK_PROGRAMMABLE_BUTTON_21"},
+ {QK_PROGRAMMABLE_BUTTON_22, "QK_PROGRAMMABLE_BUTTON_22"},
+ {QK_PROGRAMMABLE_BUTTON_23, "QK_PROGRAMMABLE_BUTTON_23"},
+ {QK_PROGRAMMABLE_BUTTON_24, "QK_PROGRAMMABLE_BUTTON_24"},
+ {QK_PROGRAMMABLE_BUTTON_25, "QK_PROGRAMMABLE_BUTTON_25"},
+ {QK_PROGRAMMABLE_BUTTON_26, "QK_PROGRAMMABLE_BUTTON_26"},
+ {QK_PROGRAMMABLE_BUTTON_27, "QK_PROGRAMMABLE_BUTTON_27"},
+ {QK_PROGRAMMABLE_BUTTON_28, "QK_PROGRAMMABLE_BUTTON_28"},
+ {QK_PROGRAMMABLE_BUTTON_29, "QK_PROGRAMMABLE_BUTTON_29"},
+ {QK_PROGRAMMABLE_BUTTON_30, "QK_PROGRAMMABLE_BUTTON_30"},
+ {QK_PROGRAMMABLE_BUTTON_31, "QK_PROGRAMMABLE_BUTTON_31"},
+ {QK_PROGRAMMABLE_BUTTON_32, "QK_PROGRAMMABLE_BUTTON_32"},
+ {QK_AUDIO_ON, "QK_AUDIO_ON"},
+ {QK_AUDIO_OFF, "QK_AUDIO_OFF"},
+ {QK_AUDIO_TOGGLE, "QK_AUDIO_TOGGLE"},
+ {QK_AUDIO_CLICKY_TOGGLE, "QK_AUDIO_CLICKY_TOGGLE"},
+ {QK_AUDIO_CLICKY_ON, "QK_AUDIO_CLICKY_ON"},
+ {QK_AUDIO_CLICKY_OFF, "QK_AUDIO_CLICKY_OFF"},
+ {QK_AUDIO_CLICKY_UP, "QK_AUDIO_CLICKY_UP"},
+ {QK_AUDIO_CLICKY_DOWN, "QK_AUDIO_CLICKY_DOWN"},
+ {QK_AUDIO_CLICKY_RESET, "QK_AUDIO_CLICKY_RESET"},
+ {QK_MUSIC_ON, "QK_MUSIC_ON"},
+ {QK_MUSIC_OFF, "QK_MUSIC_OFF"},
+ {QK_MUSIC_TOGGLE, "QK_MUSIC_TOGGLE"},
+ {QK_MUSIC_MODE_NEXT, "QK_MUSIC_MODE_NEXT"},
+ {QK_AUDIO_VOICE_NEXT, "QK_AUDIO_VOICE_NEXT"},
+ {QK_AUDIO_VOICE_PREVIOUS, "QK_AUDIO_VOICE_PREVIOUS"},
+ {QK_STENO_BOLT, "QK_STENO_BOLT"},
+ {QK_STENO_GEMINI, "QK_STENO_GEMINI"},
+ {QK_STENO_COMB, "QK_STENO_COMB"},
+ {QK_STENO_COMB_MAX, "QK_STENO_COMB_MAX"},
+ {QK_MACRO_0, "QK_MACRO_0"},
+ {QK_MACRO_1, "QK_MACRO_1"},
+ {QK_MACRO_2, "QK_MACRO_2"},
+ {QK_MACRO_3, "QK_MACRO_3"},
+ {QK_MACRO_4, "QK_MACRO_4"},
+ {QK_MACRO_5, "QK_MACRO_5"},
+ {QK_MACRO_6, "QK_MACRO_6"},
+ {QK_MACRO_7, "QK_MACRO_7"},
+ {QK_MACRO_8, "QK_MACRO_8"},
+ {QK_MACRO_9, "QK_MACRO_9"},
+ {QK_MACRO_10, "QK_MACRO_10"},
+ {QK_MACRO_11, "QK_MACRO_11"},
+ {QK_MACRO_12, "QK_MACRO_12"},
+ {QK_MACRO_13, "QK_MACRO_13"},
+ {QK_MACRO_14, "QK_MACRO_14"},
+ {QK_MACRO_15, "QK_MACRO_15"},
+ {QK_MACRO_16, "QK_MACRO_16"},
+ {QK_MACRO_17, "QK_MACRO_17"},
+ {QK_MACRO_18, "QK_MACRO_18"},
+ {QK_MACRO_19, "QK_MACRO_19"},
+ {QK_MACRO_20, "QK_MACRO_20"},
+ {QK_MACRO_21, "QK_MACRO_21"},
+ {QK_MACRO_22, "QK_MACRO_22"},
+ {QK_MACRO_23, "QK_MACRO_23"},
+ {QK_MACRO_24, "QK_MACRO_24"},
+ {QK_MACRO_25, "QK_MACRO_25"},
+ {QK_MACRO_26, "QK_MACRO_26"},
+ {QK_MACRO_27, "QK_MACRO_27"},
+ {QK_MACRO_28, "QK_MACRO_28"},
+ {QK_MACRO_29, "QK_MACRO_29"},
+ {QK_MACRO_30, "QK_MACRO_30"},
+ {QK_MACRO_31, "QK_MACRO_31"},
+ {QK_BACKLIGHT_ON, "QK_BACKLIGHT_ON"},
+ {QK_BACKLIGHT_OFF, "QK_BACKLIGHT_OFF"},
+ {QK_BACKLIGHT_TOGGLE, "QK_BACKLIGHT_TOGGLE"},
+ {QK_BACKLIGHT_DOWN, "QK_BACKLIGHT_DOWN"},
+ {QK_BACKLIGHT_UP, "QK_BACKLIGHT_UP"},
+ {QK_BACKLIGHT_STEP, "QK_BACKLIGHT_STEP"},
+ {QK_BACKLIGHT_TOGGLE_BREATHING, "QK_BACKLIGHT_TOGGLE_BREATHING"},
+ {RGB_TOG, "RGB_TOG"},
+ {RGB_MODE_FORWARD, "RGB_MODE_FORWARD"},
+ {RGB_MODE_REVERSE, "RGB_MODE_REVERSE"},
+ {RGB_HUI, "RGB_HUI"},
+ {RGB_HUD, "RGB_HUD"},
+ {RGB_SAI, "RGB_SAI"},
+ {RGB_SAD, "RGB_SAD"},
+ {RGB_VAI, "RGB_VAI"},
+ {RGB_VAD, "RGB_VAD"},
+ {RGB_SPI, "RGB_SPI"},
+ {RGB_SPD, "RGB_SPD"},
+ {RGB_MODE_PLAIN, "RGB_MODE_PLAIN"},
+ {RGB_MODE_BREATHE, "RGB_MODE_BREATHE"},
+ {RGB_MODE_RAINBOW, "RGB_MODE_RAINBOW"},
+ {RGB_MODE_SWIRL, "RGB_MODE_SWIRL"},
+ {RGB_MODE_SNAKE, "RGB_MODE_SNAKE"},
+ {RGB_MODE_KNIGHT, "RGB_MODE_KNIGHT"},
+ {RGB_MODE_XMAS, "RGB_MODE_XMAS"},
+ {RGB_MODE_GRADIENT, "RGB_MODE_GRADIENT"},
+ {RGB_MODE_RGBTEST, "RGB_MODE_RGBTEST"},
+ {RGB_MODE_TWINKLE, "RGB_MODE_TWINKLE"},
+ {QK_BOOTLOADER, "QK_BOOTLOADER"},
+ {QK_REBOOT, "QK_REBOOT"},
+ {QK_DEBUG_TOGGLE, "QK_DEBUG_TOGGLE"},
+ {QK_CLEAR_EEPROM, "QK_CLEAR_EEPROM"},
+ {QK_MAKE, "QK_MAKE"},
+ {QK_AUTO_SHIFT_DOWN, "QK_AUTO_SHIFT_DOWN"},
+ {QK_AUTO_SHIFT_UP, "QK_AUTO_SHIFT_UP"},
+ {QK_AUTO_SHIFT_REPORT, "QK_AUTO_SHIFT_REPORT"},
+ {QK_AUTO_SHIFT_ON, "QK_AUTO_SHIFT_ON"},
+ {QK_AUTO_SHIFT_OFF, "QK_AUTO_SHIFT_OFF"},
+ {QK_AUTO_SHIFT_TOGGLE, "QK_AUTO_SHIFT_TOGGLE"},
+ {QK_GRAVE_ESCAPE, "QK_GRAVE_ESCAPE"},
+ {QK_VELOCIKEY_TOGGLE, "QK_VELOCIKEY_TOGGLE"},
+ {QK_SPACE_CADET_LEFT_CTRL_PARENTHESIS_OPEN, "QK_SPACE_CADET_LEFT_CTRL_PARENTHESIS_OPEN"},
+ {QK_SPACE_CADET_RIGHT_CTRL_PARENTHESIS_CLOSE, "QK_SPACE_CADET_RIGHT_CTRL_PARENTHESIS_CLOSE"},
+ {QK_SPACE_CADET_LEFT_SHIFT_PARENTHESIS_OPEN, "QK_SPACE_CADET_LEFT_SHIFT_PARENTHESIS_OPEN"},
+ {QK_SPACE_CADET_RIGHT_SHIFT_PARENTHESIS_CLOSE, "QK_SPACE_CADET_RIGHT_SHIFT_PARENTHESIS_CLOSE"},
+ {QK_SPACE_CADET_LEFT_ALT_PARENTHESIS_OPEN, "QK_SPACE_CADET_LEFT_ALT_PARENTHESIS_OPEN"},
+ {QK_SPACE_CADET_RIGHT_ALT_PARENTHESIS_CLOSE, "QK_SPACE_CADET_RIGHT_ALT_PARENTHESIS_CLOSE"},
+ {QK_SPACE_CADET_RIGHT_SHIFT_ENTER, "QK_SPACE_CADET_RIGHT_SHIFT_ENTER"},
+ {QK_OUTPUT_AUTO, "QK_OUTPUT_AUTO"},
+ {QK_OUTPUT_USB, "QK_OUTPUT_USB"},
+ {QK_OUTPUT_BLUETOOTH, "QK_OUTPUT_BLUETOOTH"},
+ {QK_UNICODE_MODE_NEXT, "QK_UNICODE_MODE_NEXT"},
+ {QK_UNICODE_MODE_PREVIOUS, "QK_UNICODE_MODE_PREVIOUS"},
+ {QK_UNICODE_MODE_MACOS, "QK_UNICODE_MODE_MACOS"},
+ {QK_UNICODE_MODE_LINUX, "QK_UNICODE_MODE_LINUX"},
+ {QK_UNICODE_MODE_WINDOWS, "QK_UNICODE_MODE_WINDOWS"},
+ {QK_UNICODE_MODE_BSD, "QK_UNICODE_MODE_BSD"},
+ {QK_UNICODE_MODE_WINCOMPOSE, "QK_UNICODE_MODE_WINCOMPOSE"},
+ {QK_UNICODE_MODE_EMACS, "QK_UNICODE_MODE_EMACS"},
+ {QK_HAPTIC_ON, "QK_HAPTIC_ON"},
+ {QK_HAPTIC_OFF, "QK_HAPTIC_OFF"},
+ {QK_HAPTIC_TOGGLE, "QK_HAPTIC_TOGGLE"},
+ {QK_HAPTIC_RESET, "QK_HAPTIC_RESET"},
+ {QK_HAPTIC_FEEDBACK_TOGGLE, "QK_HAPTIC_FEEDBACK_TOGGLE"},
+ {QK_HAPTIC_BUZZ_TOGGLE, "QK_HAPTIC_BUZZ_TOGGLE"},
+ {QK_HAPTIC_MODE_NEXT, "QK_HAPTIC_MODE_NEXT"},
+ {QK_HAPTIC_MODE_PREVIOUS, "QK_HAPTIC_MODE_PREVIOUS"},
+ {QK_HAPTIC_CONTINUOUS_TOGGLE, "QK_HAPTIC_CONTINUOUS_TOGGLE"},
+ {QK_HAPTIC_CONTINUOUS_UP, "QK_HAPTIC_CONTINUOUS_UP"},
+ {QK_HAPTIC_CONTINUOUS_DOWN, "QK_HAPTIC_CONTINUOUS_DOWN"},
+ {QK_HAPTIC_DWELL_UP, "QK_HAPTIC_DWELL_UP"},
+ {QK_HAPTIC_DWELL_DOWN, "QK_HAPTIC_DWELL_DOWN"},
+ {QK_COMBO_ON, "QK_COMBO_ON"},
+ {QK_COMBO_OFF, "QK_COMBO_OFF"},
+ {QK_COMBO_TOGGLE, "QK_COMBO_TOGGLE"},
+ {QK_DYNAMIC_MACRO_RECORD_START_1, "QK_DYNAMIC_MACRO_RECORD_START_1"},
+ {QK_DYNAMIC_MACRO_RECORD_START_2, "QK_DYNAMIC_MACRO_RECORD_START_2"},
+ {QK_DYNAMIC_MACRO_RECORD_STOP, "QK_DYNAMIC_MACRO_RECORD_STOP"},
+ {QK_DYNAMIC_MACRO_PLAY_1, "QK_DYNAMIC_MACRO_PLAY_1"},
+ {QK_DYNAMIC_MACRO_PLAY_2, "QK_DYNAMIC_MACRO_PLAY_2"},
+ {QK_LEADER, "QK_LEADER"},
+ {QK_LOCK, "QK_LOCK"},
+ {QK_ONE_SHOT_ON, "QK_ONE_SHOT_ON"},
+ {QK_ONE_SHOT_OFF, "QK_ONE_SHOT_OFF"},
+ {QK_ONE_SHOT_TOGGLE, "QK_ONE_SHOT_TOGGLE"},
+ {QK_KEY_OVERRIDE_TOGGLE, "QK_KEY_OVERRIDE_TOGGLE"},
+ {QK_KEY_OVERRIDE_ON, "QK_KEY_OVERRIDE_ON"},
+ {QK_KEY_OVERRIDE_OFF, "QK_KEY_OVERRIDE_OFF"},
+ {QK_SECURE_LOCK, "QK_SECURE_LOCK"},
+ {QK_SECURE_UNLOCK, "QK_SECURE_UNLOCK"},
+ {QK_SECURE_TOGGLE, "QK_SECURE_TOGGLE"},
+ {QK_SECURE_REQUEST, "QK_SECURE_REQUEST"},
+ {QK_DYNAMIC_TAPPING_TERM_PRINT, "QK_DYNAMIC_TAPPING_TERM_PRINT"},
+ {QK_DYNAMIC_TAPPING_TERM_UP, "QK_DYNAMIC_TAPPING_TERM_UP"},
+ {QK_DYNAMIC_TAPPING_TERM_DOWN, "QK_DYNAMIC_TAPPING_TERM_DOWN"},
+ {QK_CAPS_WORD_TOGGLE, "QK_CAPS_WORD_TOGGLE"},
+ {QK_AUTOCORRECT_ON, "QK_AUTOCORRECT_ON"},
+ {QK_AUTOCORRECT_OFF, "QK_AUTOCORRECT_OFF"},
+ {QK_AUTOCORRECT_TOGGLE, "QK_AUTOCORRECT_TOGGLE"},
+ {SAFE_RANGE, "SAFE_RANGE"},
+};
diff --git a/tests/test_common/keycode_util.cpp b/tests/test_common/keycode_util.cpp
new file mode 100644
index 0000000000..9f88d40ec7
--- /dev/null
+++ b/tests/test_common/keycode_util.cpp
@@ -0,0 +1,128 @@
+#include "keycode_util.hpp"
+#include <cstdint>
+extern "C" {
+#include "action_code.h"
+#include "keycode.h"
+#include "quantum_keycodes.h"
+#include "util.h"
+}
+#include <string>
+#include <iomanip>
+#include <map>
+
+extern std::map<uint16_t, std::string> KEYCODE_ID_TABLE;
+
+std::string get_mods(uint8_t mods) {
+ std::stringstream s;
+ if ((mods & MOD_RCTL) == MOD_RCTL) {
+ s << XSTR(MOD_RCTL) << " | ";
+ } else if ((mods & MOD_LCTL) == MOD_LCTL) {
+ s << XSTR(MOD_LCTL) << " | ";
+ }
+
+ if ((mods & MOD_RSFT) == MOD_RSFT) {
+ s << XSTR(MOD_RSFT) << " | ";
+ } else if ((mods & MOD_LSFT) == MOD_LSFT) {
+ s << XSTR(MOD_LSFT) << " | ";
+ }
+
+ if ((mods & MOD_RALT) == MOD_RALT) {
+ s << XSTR(MOD_RALT) << " | ";
+ } else if ((mods & MOD_LALT) == MOD_LALT) {
+ s << XSTR(MOD_LALT) << " | ";
+ }
+
+ if ((mods & MOD_RGUI) == MOD_RGUI) {
+ s << XSTR(MOD_RGUI) << " | ";
+ } else if ((mods & MOD_LGUI) == MOD_LGUI) {
+ s << XSTR(MOD_LGUI) << " | ";
+ }
+
+ auto _mods = s.str();
+
+ if (_mods.size()) {
+ _mods.resize(_mods.size() - 3);
+ }
+
+ return std::string(_mods);
+}
+
+std::string get_qk_mods(uint16_t keycode) {
+ std::stringstream s;
+ if ((keycode & QK_RCTL) == QK_RCTL) {
+ s << XSTR(QK_RCTL) << " | ";
+ } else if ((keycode & QK_LCTL) == QK_LCTL) {
+ s << XSTR(QK_LCTL) << " | ";
+ }
+
+ if ((keycode & QK_RSFT) == QK_RSFT) {
+ s << XSTR(QK_RSFT) << " | ";
+ } else if ((keycode & QK_LSFT) == QK_LSFT) {
+ s << XSTR(QK_LSFT) << " | ";
+ }
+
+ if ((keycode & QK_RALT) == QK_RALT) {
+ s << XSTR(QK_RALT) << " | ";
+ } else if ((keycode & QK_LALT) == QK_LALT) {
+ s << XSTR(QK_LALT) << " | ";
+ }
+
+ if ((keycode & QK_RGUI) == QK_RGUI) {
+ s << XSTR(QK_RGUI) << " | ";
+ } else if ((keycode & QK_LGUI) == QK_LGUI) {
+ s << XSTR(QK_LGUI) << " | ";
+ }
+
+ auto _mods = s.str();
+
+ if (_mods.size()) {
+ _mods.resize(_mods.size() - 3);
+ }
+
+ return std::string(_mods);
+}
+
+std::string generate_identifier(uint16_t kc) {
+ std::stringstream s;
+ if (IS_QK_MOD_TAP(kc)) {
+ s << "MT(" << get_mods(QK_MOD_TAP_GET_MODS(kc)) << ", " << KEYCODE_ID_TABLE.at(kc & 0xFF) << ")";
+ } else if (IS_QK_LAYER_TAP(kc)) {
+ s << "LT(" << +QK_LAYER_TAP_GET_LAYER(kc) << ", " << KEYCODE_ID_TABLE.at(kc & 0xFF) << ")";
+ } else if (IS_QK_TO(kc)) {
+ s << "TO(" << +QK_TO_GET_LAYER(kc) << ")";
+ } else if (IS_QK_MOMENTARY(kc)) {
+ s << "MO(" << +QK_MOMENTARY_GET_LAYER(kc) << ")";
+ } else if (IS_QK_DEF_LAYER(kc)) {
+ s << "DF(" << +QK_DEF_LAYER_GET_LAYER(kc) << ")";
+ } else if (IS_QK_TOGGLE_LAYER(kc)) {
+ s << "TG(" << +QK_TOGGLE_LAYER_GET_LAYER(kc) << ")";
+ } else if (IS_QK_LAYER_TAP_TOGGLE(kc)) {
+ s << "TT(" << +QK_LAYER_TAP_TOGGLE_GET_LAYER(kc) << ")";
+ } else if (IS_QK_ONE_SHOT_LAYER(kc)) {
+ s << "OSL(" << +QK_ONE_SHOT_LAYER_GET_LAYER(kc) << ")";
+ } else if (IS_QK_LAYER_MOD(kc)) {
+ s << "LM(" << +QK_LAYER_MOD_GET_LAYER(kc) << ", " << get_mods(QK_LAYER_MOD_GET_MODS(kc)) << ")";
+ } else if (IS_QK_ONE_SHOT_MOD(kc)) {
+ s << "OSM(" << get_mods(QK_ONE_SHOT_MOD_GET_MODS(kc)) << ")";
+ } else if (IS_QK_MODS(kc)) {
+ s << "QK_MODS(" << KEYCODE_ID_TABLE.at(QK_MODS_GET_BASIC_KEYCODE(kc)) << ", " << get_qk_mods(kc) << ")";
+ } else if (IS_QK_TAP_DANCE(kc)) {
+ s << "TD(" << +(kc & 0xFF) << ")";
+ } else {
+ // Fallback - we didn't found any matching keycode, generate the hex representation.
+ s << "unknown keycode: 0x" << std::hex << kc << ". Add conversion to " << XSTR(generate_identifier);
+ }
+
+ return std::string(s.str());
+}
+
+std::string get_keycode_identifier_or_default(uint16_t keycode) {
+ auto identifier = KEYCODE_ID_TABLE.find(keycode);
+ if (identifier != KEYCODE_ID_TABLE.end()) {
+ return identifier->second;
+ }
+
+ KEYCODE_ID_TABLE[keycode] = generate_identifier(keycode);
+
+ return KEYCODE_ID_TABLE[keycode];
+}
diff --git a/tests/test_common/keycode_util.hpp b/tests/test_common/keycode_util.hpp
new file mode 100644
index 0000000000..d5a520d4b2
--- /dev/null
+++ b/tests/test_common/keycode_util.hpp
@@ -0,0 +1,5 @@
+#pragma once
+
+#include <string>
+
+std::string get_keycode_identifier_or_default(uint16_t keycode);
diff --git a/tests/test_common/matrix.c b/tests/test_common/matrix.c
index 7b24d560e3..45e76d32c5 100644
--- a/tests/test_common/matrix.c
+++ b/tests/test_common/matrix.c
@@ -41,11 +41,15 @@ void matrix_init_kb(void) {}
void matrix_scan_kb(void) {}
void press_key(uint8_t col, uint8_t row) {
- matrix[row] |= 1 << col;
+ matrix[row] |= (matrix_row_t)1 << col;
}
void release_key(uint8_t col, uint8_t row) {
- matrix[row] &= ~(1 << col);
+ matrix[row] &= ~((matrix_row_t)1 << col);
+}
+
+bool matrix_is_on(uint8_t row, uint8_t col) {
+ return (matrix[row] & ((matrix_row_t)1 << col));
}
void clear_all_keys(void) {
diff --git a/tests/test_common/test_common.hpp b/tests/test_common/test_common.hpp
index a88fa8d7b8..295a6083cd 100644
--- a/tests/test_common/test_common.hpp
+++ b/tests/test_common/test_common.hpp
@@ -22,5 +22,6 @@ extern "C" {
}
#include "test_driver.hpp"
#include "test_matrix.h"
+#include "test_keymap_key.hpp"
#include "keyboard_report_util.hpp"
#include "test_fixture.hpp"
diff --git a/tests/test_common/test_fixture.cpp b/tests/test_common/test_fixture.cpp
index 44694cd390..5dc5db1848 100644
--- a/tests/test_common/test_fixture.cpp
+++ b/tests/test_common/test_fixture.cpp
@@ -12,6 +12,7 @@
#include "test_logger.hpp"
#include "test_matrix.h"
#include "test_keymap_key.hpp"
+#include "timer.h"
extern "C" {
#include "action.h"
@@ -41,7 +42,7 @@ extern "C" uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t position) {
}
void TestFixture::SetUpTestCase() {
- test_logger.info() << "TestFixture setup-up start." << std::endl;
+ test_logger.info() << "test fixture setup-up start." << std::endl;
// The following is enough to bootstrap the values set in main
eeconfig_init_quantum();
@@ -50,17 +51,19 @@ void TestFixture::SetUpTestCase() {
TestDriver driver;
keyboard_init();
- test_logger.info() << "TestFixture setup-up end." << std::endl;
+ test_logger.info() << "test fixture setup-up end." << std::endl;
}
void TestFixture::TearDownTestCase() {}
TestFixture::TestFixture() {
m_this = this;
+ timer_clear();
+ test_logger.info() << "tapping term is " << +GET_TAPPING_TERM(KC_TRANSPARENT, &(keyrecord_t){}) << "ms" << std::endl;
}
TestFixture::~TestFixture() {
- test_logger.info() << "TestFixture clean-up start." << std::endl;
+ test_logger.info() << "test fixture clean-up start." << std::endl;
TestDriver driver;
/* Reset keyboard state. */
@@ -85,17 +88,15 @@ TestFixture::~TestFixture() {
EXPECT_NO_REPORT(driver);
idle_for(TAPPING_TERM * 10);
testing::Mock::VerifyAndClearExpectations(&driver);
-
m_this = nullptr;
- test_logger.info() << "TestFixture clean-up end." << std::endl;
-
+ test_logger.info() << "test fixture clean-up end." << std::endl;
print_test_log();
}
void TestFixture::add_key(KeymapKey key) {
if (this->find_key(key.layer, key.position)) {
- FAIL() << "Key is already mapped for layer " << +key.layer << " and (column,row) (" << +key.position.col << "," << +key.position.row << ")";
+ FAIL() << "key is already mapped for layer " << +key.layer << " and (column,row) (" << +key.position.col << "," << +key.position.row << ")";
}
this->keymap.push_back(key);
@@ -149,7 +150,7 @@ void TestFixture::get_keycode(const layer_t layer, const keypos_t position, uint
/* See if this is done in hardware as well, because this is 100% out of bounds reads on all QMK keebs out there. */
auto msg = [&]() {
std::stringstream msg;
- msg << "Keycode for position (" << +position.col << "," << +position.row << ") requested! This is out of bounds." << std::endl;
+ msg << "keycode for position (" << +position.col << "," << +position.row << ") requested! This is out of bounds." << std::endl;
return msg.str();
}();
@@ -164,17 +165,18 @@ void TestFixture::get_keycode(const layer_t layer, const keypos_t position, uint
return;
}
- FAIL() << "No key is mapped for layer " << +layer << " and (column,row) " << +position.col << "," << +position.row << ")";
+ FAIL() << "no key is mapped for layer " << +layer << " and (column,row) " << +position.col << "," << +position.row << ")";
}
void TestFixture::run_one_scan_loop() {
- keyboard_task();
- advance_time(1);
+ this->idle_for(1);
}
void TestFixture::idle_for(unsigned time) {
+ test_logger.trace() << +time << " keyboard task " << (time > 1 ? "loops" : "loop") << std::endl;
for (unsigned i = 0; i < time; i++) {
- run_one_scan_loop();
+ keyboard_task();
+ advance_time(1);
}
}
@@ -182,12 +184,13 @@ void TestFixture::print_test_log() const {
const ::testing::TestInfo* const test_info = ::testing::UnitTest::GetInstance()->current_test_info();
if (HasFailure()) {
std::cerr << test_info->test_case_name() << "." << test_info->name() << " failed!" << std::endl;
+ test_logger.print_header();
test_logger.print_log();
}
test_logger.reset();
}
void TestFixture::expect_layer_state(layer_t layer_state) const {
- test_logger.trace() << "Layer state: (" << +layer_state << ") Highest layer bit: (" << +get_highest_layer(layer_state) << ")" << std::endl;
+ test_logger.trace() << "layer state: (" << +layer_state << ") highest layer bit: (" << +get_highest_layer(layer_state) << ")" << std::endl;
EXPECT_TRUE(layer_state_is(layer_state));
}
diff --git a/tests/test_common/test_keymap_key.cpp b/tests/test_common/test_keymap_key.cpp
index 878ae097bf..63ae29975b 100644
--- a/tests/test_common/test_keymap_key.cpp
+++ b/tests/test_common/test_keymap_key.cpp
@@ -15,16 +15,26 @@
*/
#include "test_keymap_key.hpp"
+#include <cstdint>
+#include <ios>
+#include "matrix.h"
#include "test_logger.hpp"
#include "gtest/gtest-message.h"
#include "gtest/gtest.h"
+#include "timer.h"
void KeymapKey::press() {
- test_logger.trace() << "Key pressed: (" << +this->position.col << "," << +this->position.row << ")" << std::endl;
+ EXPECT_FALSE(matrix_is_on(position.row, position.col)) << "tried to press key " << this->name << " that was already pressed! Check the test code." << std::endl;
+
press_key(this->position.col, this->position.row);
+ this->timestamp_pressed = timer_read32();
+ test_logger.trace() << std::setw(10) << std::left << "pressed: " << this->name << std::endl;
}
void KeymapKey::release() {
- test_logger.trace() << "Key released: (" << +this->position.col << "," << +this->position.row << ")" << std::endl;
+ EXPECT_TRUE(matrix_is_on(this->position.row, this->position.col)) << "tried to release key " << this->name << " that wasn't pressed before! Check the test code." << std::endl;
+
release_key(this->position.col, this->position.row);
-} \ No newline at end of file
+ uint32_t now = timer_read32();
+ test_logger.trace() << std::setw(10) << std::left << "released: " << this->name << " was pressed for " << now - this->timestamp_pressed << "ms" << std::endl;
+}
diff --git a/tests/test_common/test_keymap_key.hpp b/tests/test_common/test_keymap_key.hpp
index 7861cb4a32..37b4c827e4 100644
--- a/tests/test_common/test_keymap_key.hpp
+++ b/tests/test_common/test_keymap_key.hpp
@@ -16,6 +16,9 @@
#pragma once
+#include <cstddef>
+#include <string>
+#include "keycode_util.hpp"
extern "C" {
#include "keyboard.h"
#include "test_matrix.h"
@@ -26,8 +29,13 @@ extern "C" {
typedef uint8_t layer_t;
struct KeymapKey {
- KeymapKey(layer_t layer, uint8_t col, uint8_t row, uint16_t keycode) : layer(layer), position({.col = col, .row = row}), code(keycode), report_code(keycode) { validate(); }
- KeymapKey(layer_t layer, uint8_t col, uint8_t row, uint16_t keycode, uint16_t report_code) : layer(layer), position({.col = col, .row = row}), code(keycode), report_code(report_code) { validate(); }
+ KeymapKey(layer_t layer, uint8_t col, uint8_t row, uint16_t keycode) : layer(layer), position({.col = col, .row = row}), code(keycode), report_code(keycode), name(get_keycode_identifier_or_default(keycode)) {
+ validate();
+ }
+
+ KeymapKey(layer_t layer, uint8_t col, uint8_t row, uint16_t keycode, uint16_t report_code) : layer(layer), position({.col = col, .row = row}), code(keycode), report_code(report_code), name{get_keycode_identifier_or_default(keycode)} {
+ validate();
+ }
void press();
void release();
@@ -35,6 +43,7 @@ struct KeymapKey {
const layer_t layer;
const keypos_t position;
const uint16_t code;
+ std::string name;
/* Sometimes the keycode does not match the code that is send in the usb report, so we provide it here. */
const uint16_t report_code;
@@ -43,4 +52,5 @@ struct KeymapKey {
assert(position.col <= MATRIX_COLS);
assert(position.row <= MATRIX_ROWS);
}
-}; \ No newline at end of file
+ uint32_t timestamp_pressed;
+};
diff --git a/tests/test_common/test_logger.cpp b/tests/test_common/test_logger.cpp
index efc7719d13..0ff4e686ee 100644
--- a/tests/test_common/test_logger.cpp
+++ b/tests/test_common/test_logger.cpp
@@ -14,30 +14,40 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <iomanip>
#include <iostream>
#include "test_logger.hpp"
+#include "timer.h"
TestLogger test_logger;
TestLogger& TestLogger::info() {
*this << "[ INFO ] ";
- return *this;
+ return this->timestamp();
}
TestLogger& TestLogger::trace() {
*this << "[ TRACE ] ";
- return *this;
+ return this->timestamp();
}
TestLogger& TestLogger::error() {
*this << "[ ERROR ] ";
- return *this;
+ return this->timestamp();
}
+TestLogger& TestLogger::timestamp() {
+ *this << std::setw(6) << timer_read32() << " ";
+ return *this;
+}
void TestLogger::reset() {
this->m_log.str("");
};
+void TestLogger::print_header() {
+ std::cerr << "[ LEVEL ] [TIME] [EVENT]" << std::endl;
+}
+
void TestLogger::print_log() {
std::cerr << this->m_log.str();
}
diff --git a/tests/test_common/test_logger.hpp b/tests/test_common/test_logger.hpp
index 348af7fab8..4964583ded 100644
--- a/tests/test_common/test_logger.hpp
+++ b/tests/test_common/test_logger.hpp
@@ -25,11 +25,13 @@ class TestLogger : public std::ostream {
TestLogger& info();
TestLogger& trace();
TestLogger& error();
- void print_log();
- void reset();
+ void print_log();
+ void print_header();
+ void reset();
private:
+ TestLogger& timestamp();
std::stringbuf m_log;
};
-extern TestLogger test_logger; \ No newline at end of file
+extern TestLogger test_logger;