Slowing down gestures to get rid of flakiness
Change-Id: If36476e21629fba1a0cf26fb9d2c172097a9c0b5
diff --git a/tests/tapl/com/android/launcher3/tapl/AllApps.java b/tests/tapl/com/android/launcher3/tapl/AllApps.java
index 82ea8be..1353a23 100644
--- a/tests/tapl/com/android/launcher3/tapl/AllApps.java
+++ b/tests/tapl/com/android/launcher3/tapl/AllApps.java
@@ -29,7 +29,7 @@
public class AllApps extends LauncherInstrumentation.VisibleContainer {
private static final int MAX_SCROLL_ATTEMPTS = 40;
private static final int MIN_INTERACT_SIZE = 100;
- private static final int FLING_SPEED = 12000;
+ private static final int FLING_SPEED = 3000;
private final int mHeight;
@@ -120,7 +120,7 @@
final UiObject2 allAppsContainer = verifyActiveContainer();
// Start the gesture in the center to avoid starting at elements near the top.
allAppsContainer.setGestureMargins(0, 0, 0, mHeight / 2);
- allAppsContainer.fling(Direction.DOWN, FLING_SPEED);
+ allAppsContainer.fling(Direction.DOWN, (int) (FLING_SPEED * mLauncher.getDisplayDensity()));
verifyActiveContainer();
}
@@ -131,7 +131,7 @@
final UiObject2 allAppsContainer = verifyActiveContainer();
// Start the gesture in the center, for symmetry with forward.
allAppsContainer.setGestureMargins(0, mHeight / 2, 0, 0);
- allAppsContainer.fling(Direction.UP, FLING_SPEED);
+ allAppsContainer.fling(Direction.UP, (int) (FLING_SPEED * mLauncher.getDisplayDensity()));
verifyActiveContainer();
}
}
diff --git a/tests/tapl/com/android/launcher3/tapl/BaseOverview.java b/tests/tapl/com/android/launcher3/tapl/BaseOverview.java
index 0ff3070..6e92dad 100644
--- a/tests/tapl/com/android/launcher3/tapl/BaseOverview.java
+++ b/tests/tapl/com/android/launcher3/tapl/BaseOverview.java
@@ -28,7 +28,7 @@
* Common overview pane for both Launcher and fallback recents
*/
public class BaseOverview extends LauncherInstrumentation.VisibleContainer {
- private static final int DEFAULT_FLING_SPEED = 15000;
+ private static final int FLING_SPEED = 1500;
private static final int FLINGS_FOR_DISMISS_LIMIT = 5;
BaseOverview(LauncherInstrumentation launcher) {
@@ -46,7 +46,7 @@
public void flingForward() {
final UiObject2 overview = verifyActiveContainer();
LauncherInstrumentation.log("Overview.flingForward before fling");
- overview.fling(Direction.LEFT, DEFAULT_FLING_SPEED);
+ overview.fling(Direction.LEFT, (int) (FLING_SPEED * mLauncher.getDisplayDensity()));
mLauncher.waitForIdle();
verifyActiveContainer();
}
@@ -73,7 +73,7 @@
public void flingBackward() {
final UiObject2 overview = verifyActiveContainer();
LauncherInstrumentation.log("Overview.flingBackward before fling");
- overview.fling(Direction.RIGHT, DEFAULT_FLING_SPEED);
+ overview.fling(Direction.RIGHT, (int) (FLING_SPEED * mLauncher.getDisplayDensity()));
mLauncher.waitForIdle();
verifyActiveContainer();
}
diff --git a/tests/tapl/com/android/launcher3/tapl/Widgets.java b/tests/tapl/com/android/launcher3/tapl/Widgets.java
index 77555a3..89affd1 100644
--- a/tests/tapl/com/android/launcher3/tapl/Widgets.java
+++ b/tests/tapl/com/android/launcher3/tapl/Widgets.java
@@ -23,7 +23,7 @@
* All widgets container.
*/
public final class Widgets extends LauncherInstrumentation.VisibleContainer {
- private static final int FLING_SPEED = 6000;
+ private static final int FLING_SPEED = 1500;
Widgets(LauncherInstrumentation launcher) {
super(launcher);
@@ -36,7 +36,7 @@
public void flingForward() {
final UiObject2 widgetsContainer = verifyActiveContainer();
widgetsContainer.setGestureMargin(100);
- widgetsContainer.fling(Direction.DOWN, FLING_SPEED);
+ widgetsContainer.fling(Direction.DOWN, (int) (FLING_SPEED * mLauncher.getDisplayDensity()));
verifyActiveContainer();
}
@@ -46,7 +46,7 @@
public void flingBackward() {
final UiObject2 widgetsContainer = verifyActiveContainer();
widgetsContainer.setGestureMargin(100);
- widgetsContainer.fling(Direction.UP, FLING_SPEED);
+ widgetsContainer.fling(Direction.UP, (int) (FLING_SPEED * mLauncher.getDisplayDensity()));
mLauncher.waitForIdle();
verifyActiveContainer();
}