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:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user