Skip to content

Commit 8621cfa

Browse files
committed
Fix x coordinate of the ACTION_UP event in TouchUtils.drag() method
The ACTION_UP event was fired at the "fromX" position instead of being fired at the "toX" position which is the current value of local var "x". This bug had no real impact as the VelocityTracker always ignores the last MotionEvent when it received more than 3 events...
1 parent 8ab11f8 commit 8621cfa

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test-runner/android/test/TouchUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,7 @@ public static void drag(InstrumentationTestCase test, float fromX, float toX, fl
773773
float xStep = (toX - fromX) / stepCount;
774774

775775
MotionEvent event = MotionEvent.obtain(downTime, eventTime,
776-
MotionEvent.ACTION_DOWN, fromX, y, 0);
776+
MotionEvent.ACTION_DOWN, x, y, 0);
777777
inst.sendPointerSync(event);
778778
inst.waitForIdleSync();
779779

@@ -787,7 +787,7 @@ public static void drag(InstrumentationTestCase test, float fromX, float toX, fl
787787
}
788788

789789
eventTime = SystemClock.uptimeMillis();
790-
event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_UP, fromX, y, 0);
790+
event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_UP, x, y, 0);
791791
inst.sendPointerSync(event);
792792
inst.waitForIdleSync();
793793
}

0 commit comments

Comments
 (0)