diff options
author | Luca Stefani <luca.stefani.ge1@gmail.com> | 2020-03-07 13:43:59 +0100 |
---|---|---|
committer | Luca Stefani <luca.stefani.ge1@gmail.com> | 2020-03-07 13:43:59 +0100 |
commit | 0007a046cf4f4bfed563aa52ffab9ec5e94ee6f0 (patch) | |
tree | 2bc4acf2f54df560a34dcc7b7844d9d18cc58131 /quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java | |
parent | 744d192669a148bde24d36bef02deb05c2f7a1fa (diff) | |
parent | 02826bbe04d9dc1e6111f5d6ffd8706ac1f8f908 (diff) | |
download | android_packages_apps_Trebuchet-0007a046cf4f4bfed563aa52ffab9ec5e94ee6f0.tar.gz android_packages_apps_Trebuchet-0007a046cf4f4bfed563aa52ffab9ec5e94ee6f0.tar.bz2 android_packages_apps_Trebuchet-0007a046cf4f4bfed563aa52ffab9ec5e94ee6f0.zip |
Merge tag 'android-10.0.0_r31' into HEAD
Android 10.0.0 release 31
* tag 'android-10.0.0_r31': (218 commits)
Increase drag distance threshold when drag starts from deep press
Fix shortcut componentname in workspace layout logging
Fix shortcut componentname in workspace layout logging
perform accessbility focus when the recyclerview doesn't gain focus after fragment replacement in SettingsActivity
Persist predicted items when dragged to workspace
Import translations. DO NOT MERGE
Import translations. DO NOT MERGE
Align badging logic with platform IconDrawableFactory.
Fix bug where icon remains invisible after returning home.
Fix quick switch from home biased towards returning home
Fix recents scale sometimes lagging behind window scale
Fix folder open/close animation when grid size is small.
fix custom shortcut test
Improve quick switch from home by tracking both x and y motion
Move shelf peeking anim code to ShelfPeekAnim class
Fix folder available height calculation
Tapl: AllApps: ensuring a minimal vertical size of an icon
Enable a11y scrolling with item drag
disable custom shortcut test in oop
include predicted_rank in app launch logging
...
Change-Id: Id824c350cd133c4c8fa91de0f8793faed9003393
Diffstat (limited to 'quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java')
-rw-r--r-- | quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java | 58 |
1 files changed, 54 insertions, 4 deletions
diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java index 885fdbf42..8cd3bb61b 100644 --- a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java +++ b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java @@ -17,6 +17,7 @@ package com.android.quickstep; import static com.android.launcher3.ui.TaplTestsLauncher3.getAppPackageName; + import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; @@ -34,6 +35,7 @@ import com.android.launcher3.LauncherState; import com.android.launcher3.tapl.AllApps; import com.android.launcher3.tapl.AllAppsFromOverview; import com.android.launcher3.tapl.Background; +import com.android.launcher3.tapl.LauncherInstrumentation.NavigationModel; import com.android.launcher3.tapl.Overview; import com.android.launcher3.tapl.OverviewTask; import com.android.launcher3.tapl.TestHelpers; @@ -210,16 +212,21 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest { @PortraitLandscape public void testBackground() throws Exception { startAppFast(resolveSystemApp(Intent.CATEGORY_APP_CALCULATOR)); + final Background background = getAndAssertBackground(); + + assertNotNull("Background.switchToOverview() returned null", background.switchToOverview()); + assertTrue("Launcher internal state didn't switch to Overview", + isInState(LauncherState.OVERVIEW)); + } + + private Background getAndAssertBackground() { final Background background = mLauncher.getBackground(); assertNotNull("Launcher.getBackground() returned null", background); executeOnLauncher(launcher -> assertTrue( "Launcher activity is the top activity; expecting another activity to be the top " + "one", isInBackground(launcher))); - - assertNotNull("Background.switchToOverview() returned null", background.switchToOverview()); - assertTrue("Launcher internal state didn't switch to Overview", - isInState(LauncherState.OVERVIEW)); + return background; } @Test @@ -237,4 +244,47 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest { assertTrue("Launcher internal state is not Home", isInState(LauncherState.NORMAL)); assertNotNull("getHome returned null", mLauncher.getWorkspace()); } + + @Test + @NavigationModeSwitch + @PortraitLandscape + public void testQuickSwitchFromApp() throws Exception { + startTestActivity(2); + startTestActivity(3); + startTestActivity(4); + + Background background = getAndAssertBackground(); + background.quickSwitchToPreviousApp(); + assertTrue("The first app we should have quick switched to is not running", + isTestActivityRunning(3)); + + background = getAndAssertBackground(); + background.quickSwitchToPreviousApp(); + if (mLauncher.getNavigationModel() == NavigationModel.THREE_BUTTON) { + // 3-button mode toggles between 2 apps, rather than going back further. + assertTrue("Second quick switch should have returned to the first app.", + isTestActivityRunning(4)); + } else { + assertTrue("The second app we should have quick switched to is not running", + isTestActivityRunning(2)); + } + getAndAssertBackground(); + } + + private boolean isTestActivityRunning(int activityNumber) { + return mDevice.wait(Until.hasObject(By.pkg(getAppPackageName()) + .text("TestActivity" + activityNumber)), + DEFAULT_UI_TIMEOUT); + } + + @Test + @NavigationModeSwitch + @PortraitLandscape + public void testQuickSwitchFromHome() throws Exception { + startTestActivity(2); + mLauncher.pressHome().quickSwitchToPreviousApp(); + assertTrue("The most recent task is not running after quick switching from home", + isTestActivityRunning(2)); + getAndAssertBackground(); + } } |