From cae7a9c3ec3834f08dfd56b0f094dc6afaf2ccaa Mon Sep 17 00:00:00 2001 From: Fred Sundvik Date: Sat, 1 Jul 2017 02:00:30 +0300 Subject: Add simple modifier test --- tests/test_common/keyboard_report_util.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'tests/test_common/keyboard_report_util.cpp') diff --git a/tests/test_common/keyboard_report_util.cpp b/tests/test_common/keyboard_report_util.cpp index aca4433dd6..aa096e4169 100644 --- a/tests/test_common/keyboard_report_util.cpp +++ b/tests/test_common/keyboard_report_util.cpp @@ -47,19 +47,25 @@ bool operator==(const report_keyboard_t& lhs, const report_keyboard_t& rhs) { std::ostream& operator<<(std::ostream& stream, const report_keyboard_t& value) { stream << "Keyboard report:" << std::endl; - stream << "Mods: " << value.mods << std::endl; + stream << "Mods: " << (uint32_t)value.mods << std::endl; + stream << "Keys: "; // TODO: This should probably print friendly names for the keys for (uint32_t k: get_keys(value)) { - stream << k << std::endl; + stream << k << " "; } + stream << std::endl; return stream; } KeyboardReportMatcher::KeyboardReportMatcher(const std::vector& keys) { - // TODO: Support modifiers memset(m_report.raw, 0, sizeof(m_report.raw)); for (auto k: keys) { - add_key_to_report(&m_report, k); + if (IS_MOD(k)) { + m_report.mods |= MOD_BIT(k); + } + else { + add_key_to_report(&m_report, k); + } } } -- cgit v1.2.3 From 67f722c9c8cb077b946dfb2b6a3b538e37f3aa8c Mon Sep 17 00:00:00 2001 From: Fred Sundvik Date: Sun, 2 Jul 2017 21:46:35 +0300 Subject: Configure vscode file associations, use hpp instead of h --- tests/test_common/keyboard_report_util.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/test_common/keyboard_report_util.cpp') diff --git a/tests/test_common/keyboard_report_util.cpp b/tests/test_common/keyboard_report_util.cpp index aa096e4169..bf728b9a2a 100644 --- a/tests/test_common/keyboard_report_util.cpp +++ b/tests/test_common/keyboard_report_util.cpp @@ -14,7 +14,7 @@ * along with this program. If not, see . */ - #include "keyboard_report_util.h" + #include "keyboard_report_util.hpp" #include #include using namespace testing; -- cgit v1.2.3