summaryrefslogtreecommitdiff
path: root/tests/test_common
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_common')
-rw-r--r--tests/test_common/build.mk2
-rw-r--r--tests/test_common/keyboard_report_util.cpp4
-rw-r--r--tests/test_common/main.cpp2
-rw-r--r--tests/test_common/test_common.h2
-rw-r--r--tests/test_common/test_driver.cpp6
-rw-r--r--tests/test_common/test_driver.hpp2
6 files changed, 12 insertions, 6 deletions
diff --git a/tests/test_common/build.mk b/tests/test_common/build.mk
index aeb3057854..d7423bc78a 100644
--- a/tests/test_common/build.mk
+++ b/tests/test_common/build.mk
@@ -13,4 +13,4 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-CUSTOM_MATRIX=yes \ No newline at end of file
+CUSTOM_MATRIX=yes
diff --git a/tests/test_common/keyboard_report_util.cpp b/tests/test_common/keyboard_report_util.cpp
index cb7f7ae735..5676483539 100644
--- a/tests/test_common/keyboard_report_util.cpp
+++ b/tests/test_common/keyboard_report_util.cpp
@@ -95,12 +95,12 @@ std::ostream& operator<<(std::ostream& os, const report_keyboard_t& report) {
}
KeyboardReportMatcher::KeyboardReportMatcher(const std::vector<uint8_t>& keys) {
- memset(m_report.raw, 0, sizeof(m_report.raw));
+ memset(&m_report, 0, sizeof(report_keyboard_t));
for (auto k : keys) {
if (IS_MODIFIER_KEYCODE(k)) {
m_report.mods |= MOD_BIT(k);
} else {
- add_key_to_report(&m_report, k);
+ add_key_byte(&m_report, k);
}
}
}
diff --git a/tests/test_common/main.cpp b/tests/test_common/main.cpp
index 0f4e320b07..ac481b8fba 100644
--- a/tests/test_common/main.cpp
+++ b/tests/test_common/main.cpp
@@ -29,4 +29,4 @@ int main(int argc, char **argv) {
init_logging();
return RUN_ALL_TESTS();
-} \ No newline at end of file
+}
diff --git a/tests/test_common/test_common.h b/tests/test_common/test_common.h
index 19ffcddcea..8b93c032b6 100644
--- a/tests/test_common/test_common.h
+++ b/tests/test_common/test_common.h
@@ -1,4 +1,4 @@
#pragma once
#define MATRIX_ROWS 4
-#define MATRIX_COLS 10 \ No newline at end of file
+#define MATRIX_COLS 10
diff --git a/tests/test_common/test_driver.cpp b/tests/test_common/test_driver.cpp
index 0495da8205..d410b225f9 100644
--- a/tests/test_common/test_driver.cpp
+++ b/tests/test_common/test_driver.cpp
@@ -31,7 +31,7 @@ uint8_t hex_digit_to_keycode(uint8_t digit) {
}
} // namespace
-TestDriver::TestDriver() : m_driver{&TestDriver::keyboard_leds, &TestDriver::send_keyboard, &TestDriver::send_mouse, &TestDriver::send_extra} {
+TestDriver::TestDriver() : m_driver{&TestDriver::keyboard_leds, &TestDriver::send_keyboard, &TestDriver::send_nkro, &TestDriver::send_mouse, &TestDriver::send_extra} {
host_set_driver(&m_driver);
m_this = this;
}
@@ -49,6 +49,10 @@ void TestDriver::send_keyboard(report_keyboard_t* report) {
m_this->send_keyboard_mock(*report);
}
+void TestDriver::send_nkro(report_nkro_t* report) {
+ m_this->send_nkro_mock(*report);
+}
+
void TestDriver::send_mouse(report_mouse_t* report) {
m_this->send_mouse_mock(*report);
}
diff --git a/tests/test_common/test_driver.hpp b/tests/test_common/test_driver.hpp
index d8a6885d0f..ec75d3fff2 100644
--- a/tests/test_common/test_driver.hpp
+++ b/tests/test_common/test_driver.hpp
@@ -32,12 +32,14 @@ class TestDriver {
}
MOCK_METHOD1(send_keyboard_mock, void(report_keyboard_t&));
+ MOCK_METHOD1(send_nkro_mock, void(report_nkro_t&));
MOCK_METHOD1(send_mouse_mock, void(report_mouse_t&));
MOCK_METHOD1(send_extra_mock, void(report_extra_t&));
private:
static uint8_t keyboard_leds(void);
static void send_keyboard(report_keyboard_t* report);
+ static void send_nkro(report_nkro_t* report);
static void send_mouse(report_mouse_t* report);
static void send_extra(report_extra_t* report);
host_driver_t m_driver;