Loading services/inputflinger/tests/InputDispatcher_test.cpp +33 −0 Original line number Original line Diff line number Diff line Loading @@ -4682,6 +4682,38 @@ TEST_F(InputDispatcherDisplayProjectionTest, SynthesizeHoverEnterExitWithCorrect firstWindow->assertNoEvents(); firstWindow->assertNoEvents(); } } // Same as above, but while the window is being mirrored. TEST_F(InputDispatcherDisplayProjectionTest, SynthesizeHoverEnterExitWithCorrectCoordinatesWhenMirrored) { auto [firstWindow, secondWindow] = setupScaledDisplayScenario(); const std::array<float, 9> matrix = {1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 0.0, 0.0, 1.0}; ui::Transform secondDisplayTransform; secondDisplayTransform.set(matrix); addDisplayInfo(SECOND_DISPLAY_ID, secondDisplayTransform); sp<FakeWindowHandle> secondWindowClone = secondWindow->clone(SECOND_DISPLAY_ID); secondWindowClone->setWindowTransform(1.1, 2.2, 3.3, 4.4); addWindow(secondWindowClone); // Send hover move to the second window, and ensure it shows up as hover enter. mDispatcher->notifyMotion(generateMotionArgs(ACTION_HOVER_MOVE, AINPUT_SOURCE_STYLUS, ADISPLAY_ID_DEFAULT, {PointF{150, 220}})); secondWindow->consumeMotionEvent(AllOf(WithMotionAction(ACTION_HOVER_ENTER), WithCoords(100, 80), WithRawCoords(300, 880))); // Touch down at the same location and ensure a hover exit is synthesized for the correct // display. mDispatcher->notifyMotion(generateMotionArgs(ACTION_DOWN, AINPUT_SOURCE_STYLUS, ADISPLAY_ID_DEFAULT, {PointF{150, 220}})); secondWindow->consumeMotionEvent(AllOf(WithMotionAction(ACTION_HOVER_EXIT), WithCoords(100, 80), WithRawCoords(300, 880))); secondWindow->consumeMotionEvent( AllOf(WithMotionAction(ACTION_DOWN), WithCoords(100, 80), WithRawCoords(300, 880))); secondWindow->assertNoEvents(); firstWindow->assertNoEvents(); } TEST_F(InputDispatcherDisplayProjectionTest, SynthesizeHoverCancelationWithCorrectCoordinates) { TEST_F(InputDispatcherDisplayProjectionTest, SynthesizeHoverCancelationWithCorrectCoordinates) { auto [firstWindow, secondWindow] = setupScaledDisplayScenario(); auto [firstWindow, secondWindow] = setupScaledDisplayScenario(); Loading @@ -4699,6 +4731,7 @@ TEST_F(InputDispatcherDisplayProjectionTest, SynthesizeHoverCancelationWithCorre firstWindow->assertNoEvents(); firstWindow->assertNoEvents(); } } // Same as above, but while the window is being mirrored. TEST_F(InputDispatcherDisplayProjectionTest, TEST_F(InputDispatcherDisplayProjectionTest, SynthesizeHoverCancelationWithCorrectCoordinatesWhenMirrored) { SynthesizeHoverCancelationWithCorrectCoordinatesWhenMirrored) { auto [firstWindow, secondWindow] = setupScaledDisplayScenario(); auto [firstWindow, secondWindow] = setupScaledDisplayScenario(); Loading Loading
services/inputflinger/tests/InputDispatcher_test.cpp +33 −0 Original line number Original line Diff line number Diff line Loading @@ -4682,6 +4682,38 @@ TEST_F(InputDispatcherDisplayProjectionTest, SynthesizeHoverEnterExitWithCorrect firstWindow->assertNoEvents(); firstWindow->assertNoEvents(); } } // Same as above, but while the window is being mirrored. TEST_F(InputDispatcherDisplayProjectionTest, SynthesizeHoverEnterExitWithCorrectCoordinatesWhenMirrored) { auto [firstWindow, secondWindow] = setupScaledDisplayScenario(); const std::array<float, 9> matrix = {1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 0.0, 0.0, 1.0}; ui::Transform secondDisplayTransform; secondDisplayTransform.set(matrix); addDisplayInfo(SECOND_DISPLAY_ID, secondDisplayTransform); sp<FakeWindowHandle> secondWindowClone = secondWindow->clone(SECOND_DISPLAY_ID); secondWindowClone->setWindowTransform(1.1, 2.2, 3.3, 4.4); addWindow(secondWindowClone); // Send hover move to the second window, and ensure it shows up as hover enter. mDispatcher->notifyMotion(generateMotionArgs(ACTION_HOVER_MOVE, AINPUT_SOURCE_STYLUS, ADISPLAY_ID_DEFAULT, {PointF{150, 220}})); secondWindow->consumeMotionEvent(AllOf(WithMotionAction(ACTION_HOVER_ENTER), WithCoords(100, 80), WithRawCoords(300, 880))); // Touch down at the same location and ensure a hover exit is synthesized for the correct // display. mDispatcher->notifyMotion(generateMotionArgs(ACTION_DOWN, AINPUT_SOURCE_STYLUS, ADISPLAY_ID_DEFAULT, {PointF{150, 220}})); secondWindow->consumeMotionEvent(AllOf(WithMotionAction(ACTION_HOVER_EXIT), WithCoords(100, 80), WithRawCoords(300, 880))); secondWindow->consumeMotionEvent( AllOf(WithMotionAction(ACTION_DOWN), WithCoords(100, 80), WithRawCoords(300, 880))); secondWindow->assertNoEvents(); firstWindow->assertNoEvents(); } TEST_F(InputDispatcherDisplayProjectionTest, SynthesizeHoverCancelationWithCorrectCoordinates) { TEST_F(InputDispatcherDisplayProjectionTest, SynthesizeHoverCancelationWithCorrectCoordinates) { auto [firstWindow, secondWindow] = setupScaledDisplayScenario(); auto [firstWindow, secondWindow] = setupScaledDisplayScenario(); Loading @@ -4699,6 +4731,7 @@ TEST_F(InputDispatcherDisplayProjectionTest, SynthesizeHoverCancelationWithCorre firstWindow->assertNoEvents(); firstWindow->assertNoEvents(); } } // Same as above, but while the window is being mirrored. TEST_F(InputDispatcherDisplayProjectionTest, TEST_F(InputDispatcherDisplayProjectionTest, SynthesizeHoverCancelationWithCorrectCoordinatesWhenMirrored) { SynthesizeHoverCancelationWithCorrectCoordinatesWhenMirrored) { auto [firstWindow, secondWindow] = setupScaledDisplayScenario(); auto [firstWindow, secondWindow] = setupScaledDisplayScenario(); Loading