summaryrefslogtreecommitdiffstats
path: root/tests/tapl/com/android/launcher3/tapl/Background.java
diff options
context:
space:
mode:
Diffstat (limited to 'tests/tapl/com/android/launcher3/tapl/Background.java')
-rw-r--r--tests/tapl/com/android/launcher3/tapl/Background.java32
1 files changed, 22 insertions, 10 deletions
diff --git a/tests/tapl/com/android/launcher3/tapl/Background.java b/tests/tapl/com/android/launcher3/tapl/Background.java
index 6c4619235..c9eaf276d 100644
--- a/tests/tapl/com/android/launcher3/tapl/Background.java
+++ b/tests/tapl/com/android/launcher3/tapl/Background.java
@@ -87,16 +87,24 @@ public class Background extends LauncherInstrumentation.VisibleContainer {
}
case TWO_BUTTON: {
- final int centerX = mLauncher.getDevice().getDisplayWidth() / 2;
- final int startY = getSwipeStartY();
- final int swipeHeight = mLauncher.getTestInfo(getSwipeHeightRequestName()).
- getInt(TestProtocol.TEST_INFO_RESPONSE_FIELD);
-
- mLauncher.swipeToState(
- centerX, startY, centerX,
- startY - swipeHeight - mLauncher.getTouchSlop(),
- 10,
- expectedState);
+ final int startX;
+ final int startY;
+ final int endX;
+ final int endY;
+ final int swipeLength = mLauncher.getTestInfo(getSwipeHeightRequestName()).
+ getInt(TestProtocol.TEST_INFO_RESPONSE_FIELD) + mLauncher.getTouchSlop();
+
+ if (mLauncher.getDevice().isNaturalOrientation()) {
+ startX = endX = mLauncher.getDevice().getDisplayWidth() / 2;
+ startY = getSwipeStartY();
+ endY = startY - swipeLength;
+ } else {
+ startX = getSwipeStartX();
+ endX = startX - swipeLength;
+ startY = endY = mLauncher.getDevice().getDisplayHeight() / 2;
+ }
+
+ mLauncher.swipeToState(startX, startY, endX, endY, 10, expectedState);
break;
}
@@ -111,6 +119,10 @@ public class Background extends LauncherInstrumentation.VisibleContainer {
return TestProtocol.REQUEST_BACKGROUND_TO_OVERVIEW_SWIPE_HEIGHT;
}
+ protected int getSwipeStartX() {
+ return mLauncher.getRealDisplaySize().x - 1;
+ }
+
protected int getSwipeStartY() {
return mLauncher.getRealDisplaySize().y - 1;
}