From 3993b15f054265071730cdb450f43457dcf4c64a Mon Sep 17 00:00:00 2001 From: Pascal Getreuer <50221757+getreuer@users.noreply.github.com> Date: Sat, 20 May 2023 05:35:06 -0700 Subject: [Core] Add Repeat Key ("repeat last key") as a core feature. (#19700) Co-authored-by: casuanoob <96005765+casuanoob@users.noreply.github.com> Co-authored-by: Sergey Vlasov --- tests/test_common/keycode_table.cpp | 2 ++ tests/test_common/test_driver.hpp | 12 ++++++++++++ 2 files changed, 14 insertions(+) (limited to 'tests/test_common') diff --git a/tests/test_common/keycode_table.cpp b/tests/test_common/keycode_table.cpp index d21630c01b..9ed80cdbcf 100644 --- a/tests/test_common/keycode_table.cpp +++ b/tests/test_common/keycode_table.cpp @@ -663,6 +663,8 @@ std::map KEYCODE_ID_TABLE = { {QK_AUTOCORRECT_TOGGLE, "QK_AUTOCORRECT_TOGGLE"}, {QK_TRI_LAYER_LOWER, "QK_TRI_LAYER_LOWER"}, {QK_TRI_LAYER_UPPER, "QK_TRI_LAYER_UPPER"}, + {QK_REPEAT_KEY, "QK_REPEAT_KEY"}, + {QK_ALT_REPEAT_KEY, "QK_ALT_REPEAT_KEY"}, {QK_KB_0, "QK_KB_0"}, {QK_KB_1, "QK_KB_1"}, {QK_KB_2, "QK_KB_2"}, diff --git a/tests/test_common/test_driver.hpp b/tests/test_common/test_driver.hpp index 8d09e44840..d8a6885d0f 100644 --- a/tests/test_common/test_driver.hpp +++ b/tests/test_common/test_driver.hpp @@ -20,6 +20,7 @@ #include #include "host.h" #include "keyboard_report_util.hpp" +#include "keycode_util.hpp" #include "test_logger.hpp" class TestDriver { @@ -98,6 +99,17 @@ class TestDriver { */ #define EXPECT_NO_REPORT(driver) EXPECT_ANY_REPORT(driver).Times(0) +/** @brief Tests whether keycode `actual` is equal to `expected`. */ +#define EXPECT_KEYCODE_EQ(actual, expected) EXPECT_THAT((actual), KeycodeEq((expected))) + +MATCHER_P(KeycodeEq, expected_keycode, "is equal to " + testing::PrintToString(expected_keycode) + ", keycode " + get_keycode_identifier_or_default(expected_keycode)) { + if (arg == expected_keycode) { + return true; + } + *result_listener << "keycode " << get_keycode_identifier_or_default(arg); + return false; +} + /** * @brief Verify and clear all gmock expectations that have been setup until * this point. -- cgit v1.2.3