Use pointer source in MotionEventTest#testEventRotation

Only pointer sources have event rotation applied to them by MotionEvent.
We need to a pointer source like SOURCE_TOUCHSCREEN to ensure the event
is rotated as expected.

Bug: 179274888
Test: atest MotionEventTest

Change-Id: I610858c50bfbd42ecfeb326d162b17a3cb93f544
This commit is contained in:
Prabir Pradhan
2021-08-25 13:12:31 -07:00
parent a3cd005f0f
commit 034c4b8428

View File

@@ -174,6 +174,7 @@ public class MotionEventTest {
public void testEventRotation() {
final MotionEvent event = MotionEvent.obtain(0 /* downTime */, 0 /* eventTime */,
ACTION_DOWN, 30 /* x */, 50 /* y */, 0 /* metaState */);
event.setSource(InputDevice.SOURCE_TOUCHSCREEN);
MotionEvent rot90 = MotionEvent.obtain(event);
rot90.transform(MotionEvent.createRotateMatrix(/* 90 deg */1, 1000, 600));
assertEquals(50, (int) rot90.getX());