diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/pointing/test_pointing.cpp | 20 | ||||
-rw-r--r-- | tests/test_common/pointing_device_driver.c | 3 |
2 files changed, 22 insertions, 1 deletions
diff --git a/tests/pointing/test_pointing.cpp b/tests/pointing/test_pointing.cpp index d59d014925..bd886b18a2 100644 --- a/tests/pointing/test_pointing.cpp +++ b/tests/pointing/test_pointing.cpp @@ -12,6 +12,26 @@ using testing::_; class Pointing : public TestFixture {}; class PointingButtonsViaMousekeysParametrized : public ::testing::WithParamInterface<std::pair<KeymapKey, uint8_t>>, public Pointing {}; +TEST_F(Pointing, NoMovementOnInitFailure) { + TestDriver driver; + + pointing_device_set_status(POINTING_DEVICE_STATUS_INIT_FAILED); + pd_set_x(-50); + pd_set_y(100); + EXPECT_NO_MOUSE_REPORT(driver); + run_one_scan_loop(); + + pointing_device_set_status(POINTING_DEVICE_STATUS_SUCCESS); + EXPECT_MOUSE_REPORT(driver, (-50, 100, 0, 0, 0)); + run_one_scan_loop(); + + pd_clear_movement(); + // EXPECT_EMPTY_MOUSE_REPORT(driver); + run_one_scan_loop(); + + VERIFY_AND_CLEAR(driver); +} + TEST_F(Pointing, SendMouseIsNotCalledWithNoInput) { TestDriver driver; EXPECT_NO_MOUSE_REPORT(driver); diff --git a/tests/test_common/pointing_device_driver.c b/tests/test_common/pointing_device_driver.c index b64dbad506..42c7a814a4 100644 --- a/tests/test_common/pointing_device_driver.c +++ b/tests/test_common/pointing_device_driver.c @@ -22,8 +22,9 @@ typedef struct { static pd_config_t pd_config = {0}; -void pointing_device_driver_init(void) { +bool pointing_device_driver_init(void) { pd_set_init(true); + return pd_config.initiated; } report_mouse_t pointing_device_driver_get_report(report_mouse_t mouse_report) { |