@@ -1167,6 +1167,38 @@ TEST_F(GestureConverterTest, FlingTapDown) {
11671167 ASSERT_TRUE (mFakePointerController ->isPointerShown ());
11681168}
11691169
1170+ TEST_F (GestureConverterTest, FlingTapDownAfterScrollStopsFling) {
1171+ InputDeviceContext deviceContext (*mDevice , EVENTHUB_ID);
1172+ input_flags::enable_touchpad_fling_stop (true );
1173+ GestureConverter converter (*mReader ->getContext (), deviceContext, DEVICE_ID);
1174+ converter.setDisplayId (ADISPLAY_ID_DEFAULT);
1175+
1176+ Gesture scrollGesture (kGestureScroll , ARBITRARY_GESTURE_TIME, ARBITRARY_GESTURE_TIME, 0 , -10 );
1177+ std::list<NotifyArgs> args =
1178+ converter.handleGesture (ARBITRARY_TIME, READ_TIME, ARBITRARY_TIME, scrollGesture);
1179+ Gesture flingGesture (kGestureFling , ARBITRARY_GESTURE_TIME, ARBITRARY_GESTURE_TIME, 1 , 1 ,
1180+ GESTURES_FLING_START);
1181+ args = converter.handleGesture (ARBITRARY_TIME, READ_TIME, ARBITRARY_TIME, flingGesture);
1182+
1183+ Gesture tapDownGesture (kGestureFling , ARBITRARY_GESTURE_TIME, ARBITRARY_GESTURE_TIME,
1184+ /* vx=*/ 0 .f , /* vy=*/ 0 .f , GESTURES_FLING_TAP_DOWN);
1185+ args = converter.handleGesture (ARBITRARY_TIME, READ_TIME, ARBITRARY_TIME, tapDownGesture);
1186+ ASSERT_THAT (args,
1187+ ElementsAre (VariantWith<NotifyMotionArgs>(
1188+ WithMotionAction (AMOTION_EVENT_ACTION_HOVER_EXIT)),
1189+ VariantWith<NotifyMotionArgs>(
1190+ WithMotionAction (AMOTION_EVENT_ACTION_DOWN)),
1191+ VariantWith<NotifyMotionArgs>(
1192+ WithMotionAction (AMOTION_EVENT_ACTION_CANCEL)),
1193+ VariantWith<NotifyMotionArgs>(
1194+ AllOf (WithMotionAction (AMOTION_EVENT_ACTION_HOVER_ENTER),
1195+ WithMotionClassification (MotionClassification::NONE)))));
1196+ ASSERT_THAT (args,
1197+ Each (VariantWith<NotifyMotionArgs>(AllOf (WithCoords (POINTER_X, POINTER_Y),
1198+ WithToolType (ToolType::FINGER),
1199+ WithDisplayId (ADISPLAY_ID_DEFAULT)))));
1200+ }
1201+
11701202TEST_F (GestureConverterTest, Tap) {
11711203 // Tap should produce button press/release events
11721204 InputDeviceContext deviceContext (*mDevice , EVENTHUB_ID);
@@ -2556,6 +2588,38 @@ TEST_F(GestureConverterTestWithChoreographer, FlingTapDown) {
25562588 WithButtonState (0 ), WithPressure (0 .0f ), WithDisplayId (ADISPLAY_ID_DEFAULT)));
25572589}
25582590
2591+ TEST_F (GestureConverterTestWithChoreographer, FlingTapDownAfterScrollStopsFling) {
2592+ InputDeviceContext deviceContext (*mDevice , EVENTHUB_ID);
2593+ input_flags::enable_touchpad_fling_stop (true );
2594+ GestureConverter converter (*mReader ->getContext (), deviceContext, DEVICE_ID);
2595+ converter.setDisplayId (ADISPLAY_ID_DEFAULT);
2596+
2597+ Gesture scrollGesture (kGestureScroll , ARBITRARY_GESTURE_TIME, ARBITRARY_GESTURE_TIME, 0 , -10 );
2598+ std::list<NotifyArgs> args =
2599+ converter.handleGesture (ARBITRARY_TIME, READ_TIME, ARBITRARY_TIME, scrollGesture);
2600+ Gesture flingGesture (kGestureFling , ARBITRARY_GESTURE_TIME, ARBITRARY_GESTURE_TIME, 1 , 1 ,
2601+ GESTURES_FLING_START);
2602+ args = converter.handleGesture (ARBITRARY_TIME, READ_TIME, ARBITRARY_TIME, flingGesture);
2603+
2604+ Gesture tapDownGesture (kGestureFling , ARBITRARY_GESTURE_TIME, ARBITRARY_GESTURE_TIME,
2605+ /* vx=*/ 0 .f , /* vy=*/ 0 .f , GESTURES_FLING_TAP_DOWN);
2606+ args = converter.handleGesture (ARBITRARY_TIME, READ_TIME, ARBITRARY_TIME, tapDownGesture);
2607+ ASSERT_THAT (args,
2608+ ElementsAre (VariantWith<NotifyMotionArgs>(
2609+ WithMotionAction (AMOTION_EVENT_ACTION_HOVER_EXIT)),
2610+ VariantWith<NotifyMotionArgs>(
2611+ WithMotionAction (AMOTION_EVENT_ACTION_DOWN)),
2612+ VariantWith<NotifyMotionArgs>(
2613+ WithMotionAction (AMOTION_EVENT_ACTION_CANCEL)),
2614+ VariantWith<NotifyMotionArgs>(
2615+ AllOf (WithMotionAction (AMOTION_EVENT_ACTION_HOVER_ENTER),
2616+ WithMotionClassification (MotionClassification::NONE)))));
2617+ ASSERT_THAT (args,
2618+ Each (VariantWith<NotifyMotionArgs>(AllOf (WithCoords (0 , 0 ),
2619+ WithToolType (ToolType::FINGER),
2620+ WithDisplayId (ADISPLAY_ID_DEFAULT)))));
2621+ }
2622+
25592623TEST_F (GestureConverterTestWithChoreographer, Tap) {
25602624 // Tap should produce button press/release events
25612625 InputDeviceContext deviceContext (*mDevice , EVENTHUB_ID);
0 commit comments