summaryrefslogtreecommitdiff
path: root/tests/test_common
diff options
context:
space:
mode:
authorPascal Getreuer <50221757+getreuer@users.noreply.github.com>2023-05-20 05:35:06 -0700
committerGitHub <noreply@github.com>2023-05-20 22:35:06 +1000
commit3993b15f054265071730cdb450f43457dcf4c64a (patch)
tree61c5b980ed14428bae3c0278c27937dbb5d33627 /tests/test_common
parente1766df185869d8a591228d37f3f7b6d5b4049b4 (diff)
[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 <sigprof@gmail.com>
Diffstat (limited to 'tests/test_common')
-rw-r--r--tests/test_common/keycode_table.cpp2
-rw-r--r--tests/test_common/test_driver.hpp12
2 files changed, 14 insertions, 0 deletions
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<uint16_t, std::string> KEYCODE_ID_TABLE = {
663 {QK_AUTOCORRECT_TOGGLE, "QK_AUTOCORRECT_TOGGLE"}, 663 {QK_AUTOCORRECT_TOGGLE, "QK_AUTOCORRECT_TOGGLE"},
664 {QK_TRI_LAYER_LOWER, "QK_TRI_LAYER_LOWER"}, 664 {QK_TRI_LAYER_LOWER, "QK_TRI_LAYER_LOWER"},
665 {QK_TRI_LAYER_UPPER, "QK_TRI_LAYER_UPPER"}, 665 {QK_TRI_LAYER_UPPER, "QK_TRI_LAYER_UPPER"},
666 {QK_REPEAT_KEY, "QK_REPEAT_KEY"},
667 {QK_ALT_REPEAT_KEY, "QK_ALT_REPEAT_KEY"},
666 {QK_KB_0, "QK_KB_0"}, 668 {QK_KB_0, "QK_KB_0"},
667 {QK_KB_1, "QK_KB_1"}, 669 {QK_KB_1, "QK_KB_1"},
668 {QK_KB_2, "QK_KB_2"}, 670 {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 @@
20#include <stdint.h> 20#include <stdint.h>
21#include "host.h" 21#include "host.h"
22#include "keyboard_report_util.hpp" 22#include "keyboard_report_util.hpp"
23#include "keycode_util.hpp"
23#include "test_logger.hpp" 24#include "test_logger.hpp"
24 25
25class TestDriver { 26class TestDriver {
@@ -98,6 +99,17 @@ class TestDriver {
98 */ 99 */
99#define EXPECT_NO_REPORT(driver) EXPECT_ANY_REPORT(driver).Times(0) 100#define EXPECT_NO_REPORT(driver) EXPECT_ANY_REPORT(driver).Times(0)
100 101
102/** @brief Tests whether keycode `actual` is equal to `expected`. */
103#define EXPECT_KEYCODE_EQ(actual, expected) EXPECT_THAT((actual), KeycodeEq((expected)))
104
105MATCHER_P(KeycodeEq, expected_keycode, "is equal to " + testing::PrintToString(expected_keycode) + ", keycode " + get_keycode_identifier_or_default(expected_keycode)) {
106 if (arg == expected_keycode) {
107 return true;
108 }
109 *result_listener << "keycode " << get_keycode_identifier_or_default(arg);
110 return false;
111}
112
101/** 113/**
102 * @brief Verify and clear all gmock expectations that have been setup until 114 * @brief Verify and clear all gmock expectations that have been setup until
103 * this point. 115 * this point.