Merge "TAPL: switching dismissing tasks to a model-time gesture" into ub-launcher3-qt-dev

This commit is contained in:
Vadim Tryshev
2019-06-20 20:05:33 +00:00
committed by Android (Google) Code Review
2 changed files with 7 additions and 4 deletions
@@ -692,7 +692,7 @@ public final class LauncherInstrumentation {
// Inject a swipe gesture. Inject exactly 'steps' motion points, incrementing event time by a
// fixed interval each time.
private void linearGesture(int startX, int startY, int endX, int endY, int steps) {
void linearGesture(int startX, int startY, int endX, int endY, int steps) {
final long downTime = SystemClock.uptimeMillis();
final Point start = new Point(startX, startY);
final Point end = new Point(endX, endY);
@@ -16,7 +16,8 @@
package com.android.launcher3.tapl;
import androidx.test.uiautomator.Direction;
import android.graphics.Rect;
import androidx.test.uiautomator.UiObject2;
import androidx.test.uiautomator.Until;
@@ -26,7 +27,6 @@ import com.android.launcher3.testing.TestProtocol;
* A recent task in the overview panel carousel.
*/
public final class OverviewTask {
static final int FLING_SPEED = 3000;
private static final long WAIT_TIME_MS = 60000;
private final LauncherInstrumentation mLauncher;
private final UiObject2 mTask;
@@ -51,7 +51,10 @@ public final class OverviewTask {
"want to dismiss a task")) {
verifyActiveContainer();
// Dismiss the task via flinging it up.
mTask.fling(Direction.DOWN, (int) (FLING_SPEED * mLauncher.getDisplayDensity()));
final Rect taskBounds = mTask.getVisibleBounds();
final int centerX = taskBounds.centerX();
final int centerY = taskBounds.centerY();
mLauncher.linearGesture(centerX, centerY, centerX, 0, 10);
mLauncher.waitForIdle();
}
}