diff options
| author | Ryan <fauxpark@gmail.com> | 2022-09-03 05:38:27 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-02 20:38:27 +0100 |
| commit | 09d668eb0ed3ff6fa48ce1db98910b022bca2d90 (patch) | |
| tree | da13eca69e7e24e439c4bccdd1296fc4de212085 /tests/test_common | |
| parent | 0ceaaaae8e71f4713d232ac1b657906f4a45833f (diff) | |
Simplify extrakeys sending at the host driver level (#18230)
* Simplify extrakeys sending at the host driver level
* There are two arguments here
* Wrong syntax
* Adjust keyboards which use a custom host driver
Diffstat (limited to 'tests/test_common')
| -rw-r--r-- | tests/test_common/test_driver.cpp | 10 | ||||
| -rw-r--r-- | tests/test_common/test_driver.hpp | 6 |
2 files changed, 5 insertions, 11 deletions
diff --git a/tests/test_common/test_driver.cpp b/tests/test_common/test_driver.cpp index 86644ab6bd..7ecd4931ed 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) { | |||
| 31 | } | 31 | } |
| 32 | } // namespace | 32 | } // namespace |
| 33 | 33 | ||
| 34 | TestDriver::TestDriver() : m_driver{&TestDriver::keyboard_leds, &TestDriver::send_keyboard, &TestDriver::send_mouse, &TestDriver::send_system, &TestDriver::send_consumer} { | 34 | TestDriver::TestDriver() : m_driver{&TestDriver::keyboard_leds, &TestDriver::send_keyboard, &TestDriver::send_mouse, &TestDriver::send_extra} { |
| 35 | host_set_driver(&m_driver); | 35 | host_set_driver(&m_driver); |
| 36 | m_this = this; | 36 | m_this = this; |
| 37 | } | 37 | } |
| @@ -53,12 +53,8 @@ void TestDriver::send_mouse(report_mouse_t* report) { | |||
| 53 | m_this->send_mouse_mock(*report); | 53 | m_this->send_mouse_mock(*report); |
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | void TestDriver::send_system(uint16_t data) { | 56 | void TestDriver::send_extra(uint8_t report_id, uint16_t data) { |
| 57 | m_this->send_system_mock(data); | 57 | m_this->send_extra_mock(report_id, data); |
| 58 | } | ||
| 59 | |||
| 60 | void TestDriver::send_consumer(uint16_t data) { | ||
| 61 | m_this->send_consumer(data); | ||
| 62 | } | 58 | } |
| 63 | 59 | ||
| 64 | namespace internal { | 60 | namespace internal { |
diff --git a/tests/test_common/test_driver.hpp b/tests/test_common/test_driver.hpp index b58cfd1ebc..666bfb1fba 100644 --- a/tests/test_common/test_driver.hpp +++ b/tests/test_common/test_driver.hpp | |||
| @@ -32,15 +32,13 @@ class TestDriver { | |||
| 32 | 32 | ||
| 33 | MOCK_METHOD1(send_keyboard_mock, void(report_keyboard_t&)); | 33 | MOCK_METHOD1(send_keyboard_mock, void(report_keyboard_t&)); |
| 34 | MOCK_METHOD1(send_mouse_mock, void(report_mouse_t&)); | 34 | MOCK_METHOD1(send_mouse_mock, void(report_mouse_t&)); |
| 35 | MOCK_METHOD1(send_system_mock, void(uint16_t)); | 35 | MOCK_METHOD2(send_extra_mock, void(uint8_t, uint16_t)); |
| 36 | MOCK_METHOD1(send_consumer_mock, void(uint16_t)); | ||
| 37 | 36 | ||
| 38 | private: | 37 | private: |
| 39 | static uint8_t keyboard_leds(void); | 38 | static uint8_t keyboard_leds(void); |
| 40 | static void send_keyboard(report_keyboard_t* report); | 39 | static void send_keyboard(report_keyboard_t* report); |
| 41 | static void send_mouse(report_mouse_t* report); | 40 | static void send_mouse(report_mouse_t* report); |
| 42 | static void send_system(uint16_t data); | 41 | static void send_extra(uint8_t report_id, uint16_t data); |
| 43 | static void send_consumer(uint16_t data); | ||
| 44 | host_driver_t m_driver; | 42 | host_driver_t m_driver; |
| 45 | uint8_t m_leds = 0; | 43 | uint8_t m_leds = 0; |
| 46 | static TestDriver* m_this; | 44 | static TestDriver* m_this; |
