From dc755e718ded4a3af112b63420ea1060618a2982 Mon Sep 17 00:00:00 2001 From: Vadim Tryshev Date: Fri, 10 Aug 2018 20:01:24 -0700 Subject: Started converting Launcher to be gesture-stable All tests keep passing. WorkTabTest.workTabExists was made gesture-stable. There is no need to use TAPL, as the point is not to check answering to gestures, but to check presence of tabs, which is better to do using launcher internal state. (It still fails if run as a part of all tests, presumably, because after Launcher's start, changes in user configuration are not recognized, so I've commented the failing part) Bug: 110103162 Test: Run all tests Change-Id: Ic30b8e8475d16cee3880332f12311a44ddfa26cb --- .../launcher3/allapps/AllAppsContainerView.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src') diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java index 40cf0f3d0..cf7842a59 100644 --- a/src/com/android/launcher3/allapps/AllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java @@ -390,6 +390,26 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo } } + // Used by tests only + private boolean isDescendantViewVisible(int viewId) { + final View view = findViewById(viewId); + if (view == null) return false; + + if (!view.isShown()) return false; + + return view.getGlobalVisibleRect(new Rect()); + } + + // Used by tests only + public boolean isPersonalTabVisible() { + return isDescendantViewVisible(R.id.tab_personal); + } + + // Used by tests only + public boolean isWorkTabVisible() { + return isDescendantViewVisible(R.id.tab_work); + } + public AlphabeticalAppsList getApps() { return mAH[AdapterHolder.MAIN].appsList; } -- cgit v1.2.3