summaryrefslogtreecommitdiff
path: root/tests/test_common
diff options
context:
space:
mode:
authorFred Sundvik <fsundvik@gmail.com>2017-07-01 02:00:30 +0300
committerJack Humbert <jack.humb@gmail.com>2017-07-08 21:59:51 -0400
commitcae7a9c3ec3834f08dfd56b0f094dc6afaf2ccaa (patch)
treec4249ba5748420175cc02d4b56ac45c5e74789d9 /tests/test_common
parent1985f43bad9fd51101467bea994e000c6c295f00 (diff)
Add simple modifier test
Diffstat (limited to 'tests/test_common')
-rw-r--r--tests/test_common/keyboard_report_util.cpp14
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 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<uint8_t>& 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);
+ }
}
}