fix test for a11y change in supporting -1 page
Bug: 140406263
Change-Id: I0a39db135a5e5b0fe570ace55a368a7f4b6cb453
Test: run TaplTestLauncher3 locally
diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java
index 5c790f3..34b102c 100644
--- a/src/com/android/launcher3/PagedView.java
+++ b/src/com/android/launcher3/PagedView.java
@@ -1708,4 +1708,11 @@
mTmpIntPair[1] = rightChild;
return mTmpIntPair;
}
+
+ /**
+ * Returns true if overscroll is allowed, otherwise false.
+ */
+ public boolean allowOverScroll() {
+ return mAllowOverScroll;
+ }
}
diff --git a/src/com/android/launcher3/testing/TestInformationHandler.java b/src/com/android/launcher3/testing/TestInformationHandler.java
index 0d1d1a6..d62b591 100644
--- a/src/com/android/launcher3/testing/TestInformationHandler.java
+++ b/src/com/android/launcher3/testing/TestInformationHandler.java
@@ -15,9 +15,10 @@
*/
package com.android.launcher3.testing;
-import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
import static android.graphics.Bitmap.Config.ARGB_8888;
+import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
+
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Color;
@@ -81,6 +82,14 @@
break;
}
+ case TestProtocol.REQUEST_DOES_WORKSPACE_HAVE_SECOND_PAGE: {
+ if (mLauncher == null) return null;
+
+ response.putBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD,
+ mLauncher.getWorkspace().getPageCount() > 1);
+ break;
+ }
+
case TestProtocol.REQUEST_IS_LAUNCHER_INITIALIZED: {
response.putBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD, true);
break;
diff --git a/src/com/android/launcher3/testing/TestProtocol.java b/src/com/android/launcher3/testing/TestProtocol.java
index 19c557c..a68a140 100644
--- a/src/com/android/launcher3/testing/TestProtocol.java
+++ b/src/com/android/launcher3/testing/TestProtocol.java
@@ -66,6 +66,8 @@
"all-apps-to-overview-swipe-height";
public static final String REQUEST_HOME_TO_ALL_APPS_SWIPE_HEIGHT =
"home-to-all-apps-swipe-height";
+ public static final String REQUEST_DOES_WORKSPACE_HAVE_SECOND_PAGE =
+ "does-workspace-have-second-page";
public static final String REQUEST_HOTSEAT_TOP = "hotseat-top";
public static final String REQUEST_IS_LAUNCHER_INITIALIZED = "is-launcher-initialized";
public static final String REQUEST_FREEZE_APP_LIST = "freeze-app-list";
diff --git a/tests/tapl/com/android/launcher3/tapl/Workspace.java b/tests/tapl/com/android/launcher3/tapl/Workspace.java
index 510ea14..d556afc 100644
--- a/tests/tapl/com/android/launcher3/tapl/Workspace.java
+++ b/tests/tapl/com/android/launcher3/tapl/Workspace.java
@@ -22,6 +22,7 @@
import android.graphics.Point;
import android.graphics.Rect;
+import android.os.Bundle;
import android.os.SystemClock;
import android.view.KeyEvent;
import android.view.MotionEvent;
@@ -125,7 +126,7 @@
*/
public void ensureWorkspaceIsScrollable() {
final UiObject2 workspace = verifyActiveContainer();
- if (!isWorkspaceScrollable(workspace)) {
+ if (!isWorkspaceScrollable()) {
try (LauncherInstrumentation.Closable c = mLauncher.addContextLayer(
"dragging icon to a second page of workspace to make it scrollable")) {
dragIconToWorkspace(
@@ -137,12 +138,12 @@
verifyActiveContainer();
}
}
- assertTrue("Home screen workspace didn't become scrollable",
- isWorkspaceScrollable(workspace));
+ assertTrue("Home screen workspace didn't become scrollable", isWorkspaceScrollable());
}
- private boolean isWorkspaceScrollable(UiObject2 workspace) {
- return workspace.isScrollable();
+ private boolean isWorkspaceScrollable() {
+ Bundle result = mLauncher.getTestInfo(TestProtocol.REQUEST_DOES_WORKSPACE_HAVE_SECOND_PAGE);
+ return result.getBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD, false);
}
@NonNull