PointerChoreographerTest: Use builders to generate motion and key args
NotifyMotionArgs in particular have specific requirements, like needing
at least one pointer. Use a builder to generate these, instead of
relying on the default-constructed object.
Bug: 309479677
Test: atest inputflinger_tests
Change-Id: I5eccaff0eff2d87aa8d6c13a9659eed34e45c3da
diff --git a/services/inputflinger/tests/PointerChoreographer_test.cpp b/services/inputflinger/tests/PointerChoreographer_test.cpp
index 193b84d..86853bc 100644
--- a/services/inputflinger/tests/PointerChoreographer_test.cpp
+++ b/services/inputflinger/tests/PointerChoreographer_test.cpp
@@ -145,15 +145,18 @@
};
TEST_F(PointerChoreographerTest, ForwardsArgsToInnerListener) {
- const std::vector<NotifyArgs> allArgs{NotifyInputDevicesChangedArgs{},
- NotifyConfigurationChangedArgs{},
- NotifyKeyArgs{},
- NotifyMotionArgs{},
- NotifySensorArgs{},
- NotifySwitchArgs{},
- NotifyDeviceResetArgs{},
- NotifyPointerCaptureChangedArgs{},
- NotifyVibratorStateArgs{}};
+ const std::vector<NotifyArgs>
+ allArgs{NotifyInputDevicesChangedArgs{},
+ NotifyConfigurationChangedArgs{},
+ KeyArgsBuilder(AKEY_EVENT_ACTION_DOWN, AINPUT_SOURCE_KEYBOARD).build(),
+ MotionArgsBuilder(AMOTION_EVENT_ACTION_DOWN, AINPUT_SOURCE_TOUCHSCREEN)
+ .pointer(FIRST_TOUCH_POINTER)
+ .build(),
+ NotifySensorArgs{},
+ NotifySwitchArgs{},
+ NotifyDeviceResetArgs{},
+ NotifyPointerCaptureChangedArgs{},
+ NotifyVibratorStateArgs{}};
for (auto notifyArgs : allArgs) {
mChoreographer.notify(notifyArgs);