summary refs log tree commit diff
path: root/tests/test_common/keyboard_report_util.cpp
diff options
context:
space:
mode:
authorCallum Oakley <callum@pusher.com>2017-08-19 10:34:45 +0100
committerCallum Oakley <callum@pusher.com>2017-08-19 10:34:45 +0100
commita6845036e25c4f4d936dcd12cd0ddedd2894b30e (patch)
treeb23b4e8d9d757aa3c0d42be561572533ae0d126c /tests/test_common/keyboard_report_util.cpp
parent84a8aabe5bf8807595f98de44d18f6a31b892edf (diff)
parent7277f09bbadcce120f819132dec8ff7172caacc4 (diff)
Merge branch 'master' of https://github.com/qmk/qmk_firmware
Diffstat (limited to 'tests/test_common/keyboard_report_util.cpp')
-rw-r--r--tests/test_common/keyboard_report_util.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/tests/test_common/keyboard_report_util.cpp b/tests/test_common/keyboard_report_util.cpp
index aca4433dd..bf728b9a2 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 <http://www.gnu.org/licenses/>.
  */
 
- #include "keyboard_report_util.h"
+ #include "keyboard_report_util.hpp"
  #include <vector>
  #include <algorithm>
  using namespace testing;
@@ -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);
+        }
     }
 }