Fix testDisableRotationCheck
Move it to the NexusLauncherTests and launch app before rotation check
Bug: 241017339
Test: testDisableRotationCheck
Change-Id: Ia9b5d6738a8c725c68bb6422ab44cbed5ecbc0a6
diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
index 159b65f..fc64df2 100644
--- a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
+++ b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
@@ -21,6 +21,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeFalse;
import static org.junit.Assume.assumeTrue;
import android.content.Intent;
@@ -32,6 +33,7 @@
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
+import com.android.launcher3.tapl.AllApps;
import com.android.launcher3.tapl.LaunchedAppState;
import com.android.launcher3.tapl.LauncherInstrumentation.NavigationModel;
import com.android.launcher3.tapl.Overview;
@@ -404,4 +406,26 @@
launcher -> assertEquals("Still have tasks after dismissing all",
0, getTaskCount(launcher)));
}
+
+ @Test
+ public void testDisableRotationCheckForPhone() throws Exception {
+ assumeFalse(mLauncher.isTablet());
+ try {
+ mLauncher.setExpectedRotationCheckEnabled(false);
+ mLauncher.setEnableRotation(false);
+ final AllApps allApps = mLauncher.getWorkspace().switchToAllApps();
+ allApps.freeze();
+ try {
+ allApps.getAppIcon("TestActivity7").launch(getAppPackageName());
+ } finally {
+ allApps.unfreeze();
+ }
+ mLauncher.getDevice().setOrientationLeft();
+ mLauncher.goHome();
+ } finally {
+ mLauncher.setExpectedRotationCheckEnabled(true);
+ mLauncher.setEnableRotation(true);
+ mLauncher.getDevice().setOrientationNatural();
+ }
+ }
}
diff --git a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java
index f46d78f..14e16ab 100644
--- a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java
+++ b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java
@@ -432,22 +432,6 @@
}
@Test
- public void testDisableRotationCheck() throws Exception {
- try {
- mLauncher.setExpectedRotationCheckEnabled(false);
- mLauncher.setEnableRotation(false);
- final AllApps allApps = mLauncher.getWorkspace().switchToAllApps();
- final AppIcon app = allApps.getAppIcon("TestActivity7");
- mLauncher.getDevice().setOrientationLeft();
- mLauncher.goHome();
- } finally {
- mLauncher.setExpectedRotationCheckEnabled(true);
- mLauncher.setEnableRotation(true);
- mLauncher.getDevice().setOrientationNatural();
- }
- }
-
- @Test
@PortraitLandscape
public void testDeleteFromWorkspace() throws Exception {
// test delete both built-in apps and user-installed app from workspace