diff options
author | Vadim Tryshev <vadimt@google.com> | 2018-07-25 16:29:06 -0700 |
---|---|---|
committer | Vadim Tryshev <vadimt@google.com> | 2018-08-02 14:15:05 -0700 |
commit | ff3fa34a7ab5feb0bbe11893022a832be73536d5 (patch) | |
tree | 4ef7e91e914194cf9e1a19dc27b945c871473a28 /tests/tapl/com/android/launcher3/tapl/AllApps.java | |
parent | 899c08aee8dba224ac12b5dce27ec1635f4ad07e (diff) | |
download | android_packages_apps_Trebuchet-ff3fa34a7ab5feb0bbe11893022a832be73536d5.tar.gz android_packages_apps_Trebuchet-ff3fa34a7ab5feb0bbe11893022a832be73536d5.tar.bz2 android_packages_apps_Trebuchet-ff3fa34a7ab5feb0bbe11893022a832be73536d5.zip |
Fixing scrolling up in App Apps.
Done by scrolling only when scroll position is not zero. This way, the
scroll gesture can't close All Apps.
Bug: 110103162
Test: TaplTests suite
Change-Id: Icfe47d2bcc0210ae221df169d6c35cd1be10ff86
Diffstat (limited to 'tests/tapl/com/android/launcher3/tapl/AllApps.java')
-rw-r--r-- | tests/tapl/com/android/launcher3/tapl/AllApps.java | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/tests/tapl/com/android/launcher3/tapl/AllApps.java b/tests/tapl/com/android/launcher3/tapl/AllApps.java index d849e2d80..e270b4605 100644 --- a/tests/tapl/com/android/launcher3/tapl/AllApps.java +++ b/tests/tapl/com/android/launcher3/tapl/AllApps.java @@ -72,28 +72,33 @@ public class AllApps extends LauncherInstrumentation.VisibleContainer { return new AppIcon(mLauncher, appIcon); } - protected int getBottomMarginForSwipeUp() { - return 5; - } - private void scrollBackToBeginning() { final UiObject2 allAppsContainer = verifyActiveContainer(); + final UiObject2 searchBox = + mLauncher.waitForObjectInContainer(allAppsContainer, "search_container_all_apps"); int attempts = 0; - allAppsContainer.setGestureMargins(5, 600, 5, getBottomMarginForSwipeUp()); + allAppsContainer.setGestureMargins(0, searchBox.getVisibleBounds().bottom + 1, 0, 5); - while (allAppsContainer.scroll(Direction.UP, 0.5f)) { - mLauncher.waitForIdle(); - verifyActiveContainer(); + for (int scroll = getScroll(allAppsContainer); + scroll != 0; + scroll = getScroll(allAppsContainer)) { + assertTrue("Negative scroll position", scroll > 0); assertTrue("Exceeded max scroll attempts: " + MAX_SCROLL_ATTEMPTS, ++attempts <= MAX_SCROLL_ATTEMPTS); + + allAppsContainer.scroll(Direction.UP, 1); } - mLauncher.waitForIdle(); verifyActiveContainer(); } + private int getScroll(UiObject2 allAppsContainer) { + return mLauncher.getAnswerFromLauncher(allAppsContainer, "TAPL_GET_SCROLL"). + getInt("scrollY", -1); + } + private void ensureIconVisible(UiObject2 appIcon, UiObject2 allAppsContainer) { final int appHeight = appIcon.getVisibleBounds().height(); if (appHeight < MIN_INTERACT_SIZE) { |