diff options
Diffstat (limited to 'tests/test_common')
-rw-r--r-- | tests/test_common/keyboard_report_util.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/tests/test_common/keyboard_report_util.cpp b/tests/test_common/keyboard_report_util.cpp index aca4433dd..aa096e416 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) { | |||
47 | 47 | ||
48 | std::ostream& operator<<(std::ostream& stream, const report_keyboard_t& value) { | 48 | std::ostream& operator<<(std::ostream& stream, const report_keyboard_t& value) { |
49 | stream << "Keyboard report:" << std::endl; | 49 | stream << "Keyboard report:" << std::endl; |
50 | stream << "Mods: " << value.mods << std::endl; | 50 | stream << "Mods: " << (uint32_t)value.mods << std::endl; |
51 | stream << "Keys: "; | ||
51 | // TODO: This should probably print friendly names for the keys | 52 | // TODO: This should probably print friendly names for the keys |
52 | for (uint32_t k: get_keys(value)) { | 53 | for (uint32_t k: get_keys(value)) { |
53 | stream << k << std::endl; | 54 | stream << k << " "; |
54 | } | 55 | } |
56 | stream << std::endl; | ||
55 | return stream; | 57 | return stream; |
56 | } | 58 | } |
57 | 59 | ||
58 | KeyboardReportMatcher::KeyboardReportMatcher(const std::vector<uint8_t>& keys) { | 60 | KeyboardReportMatcher::KeyboardReportMatcher(const std::vector<uint8_t>& keys) { |
59 | // TODO: Support modifiers | ||
60 | memset(m_report.raw, 0, sizeof(m_report.raw)); | 61 | memset(m_report.raw, 0, sizeof(m_report.raw)); |
61 | for (auto k: keys) { | 62 | for (auto k: keys) { |
62 | add_key_to_report(&m_report, k); | 63 | if (IS_MOD(k)) { |
64 | m_report.mods |= MOD_BIT(k); | ||
65 | } | ||
66 | else { | ||
67 | add_key_to_report(&m_report, k); | ||
68 | } | ||
63 | } | 69 | } |
64 | } | 70 | } |
65 | 71 | ||