diff options
author | vadimt <vadimt@google.com> | 2019-03-20 10:50:44 -0700 |
---|---|---|
committer | vadimt <vadimt@google.com> | 2019-03-20 10:50:44 -0700 |
commit | 6f647c7e6bc7c7e2aa5d367b954ffa41b568a7bc (patch) | |
tree | 67e579ed0538bd16450bc00c410cd4ef9dee6af8 /tests/tapl/com/android/launcher3/tapl/AllApps.java | |
parent | 7b43eba73097466626c7476b29b2ae22daad42cb (diff) | |
download | android_packages_apps_Trebuchet-6f647c7e6bc7c7e2aa5d367b954ffa41b568a7bc.tar.gz android_packages_apps_Trebuchet-6f647c7e6bc7c7e2aa5d367b954ffa41b568a7bc.tar.bz2 android_packages_apps_Trebuchet-6f647c7e6bc7c7e2aa5d367b954ffa41b568a7bc.zip |
Finding icon in All Apps makes sure the icon is not covered by navbar
Change-Id: I24f8bd9871f7cf8f1313f7eb7a11f1b3f71a099b
Diffstat (limited to 'tests/tapl/com/android/launcher3/tapl/AllApps.java')
-rw-r--r-- | tests/tapl/com/android/launcher3/tapl/AllApps.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tests/tapl/com/android/launcher3/tapl/AllApps.java b/tests/tapl/com/android/launcher3/tapl/AllApps.java index 1353a23bd..122151e9d 100644 --- a/tests/tapl/com/android/launcher3/tapl/AllApps.java +++ b/tests/tapl/com/android/launcher3/tapl/AllApps.java @@ -44,6 +44,13 @@ public class AllApps extends LauncherInstrumentation.VisibleContainer { return LauncherInstrumentation.ContainerType.ALL_APPS; } + private boolean hasClickableIcon(UiObject2 allAppsContainer, BySelector appIconSelector) { + final UiObject2 icon = allAppsContainer.findObject(appIconSelector); + if (icon == null) return false; + final UiObject2 navBar = mLauncher.waitForSystemUiObject("navigation_bar_frame"); + return icon.getVisibleBounds().bottom < navBar.getVisibleBounds().top; + } + /** * Finds an icon. Fails if the icon doesn't exist. Scrolls the app list when needed to make * sure the icon is visible. @@ -55,10 +62,10 @@ public class AllApps extends LauncherInstrumentation.VisibleContainer { public AppIcon getAppIcon(String appName) { final UiObject2 allAppsContainer = verifyActiveContainer(); final BySelector appIconSelector = AppIcon.getAppIconSelector(appName, mLauncher); - if (!allAppsContainer.hasObject(appIconSelector)) { + if (!hasClickableIcon(allAppsContainer, appIconSelector)) { scrollBackToBeginning(); int attempts = 0; - while (!allAppsContainer.hasObject(appIconSelector) && + while (!hasClickableIcon(allAppsContainer, appIconSelector) && allAppsContainer.scroll(Direction.DOWN, 0.8f)) { LauncherInstrumentation.assertTrue( "Exceeded max scroll attempts: " + MAX_SCROLL_ATTEMPTS, |