Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8fe224c9 authored by Nataniel Borges's avatar Nataniel Borges
Browse files

Fix testDisableRotationCheck

Move it to the NexusLauncherTests and launch app before rotation check

Bug: 241017339
Test: testDisableRotationCheck
Change-Id: Ia9b5d6738a8c725c68bb6422ab44cbed5ecbc0a6
parent d60735bd
Loading
Loading
Loading
Loading
+24 −0
Original line number Original line Diff line number Diff line
@@ -21,6 +21,7 @@ import static com.android.launcher3.ui.TaplTestsLauncher3.getAppPackageName;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeFalse;
import static org.junit.Assume.assumeTrue;
import static org.junit.Assume.assumeTrue;


import android.content.Intent;
import android.content.Intent;
@@ -32,6 +33,7 @@ import androidx.test.uiautomator.Until;


import com.android.launcher3.Launcher;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.LauncherState;
import com.android.launcher3.tapl.AllApps;
import com.android.launcher3.tapl.LaunchedAppState;
import com.android.launcher3.tapl.LaunchedAppState;
import com.android.launcher3.tapl.LauncherInstrumentation.NavigationModel;
import com.android.launcher3.tapl.LauncherInstrumentation.NavigationModel;
import com.android.launcher3.tapl.Overview;
import com.android.launcher3.tapl.Overview;
@@ -404,4 +406,26 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest {
                launcher -> assertEquals("Still have tasks after dismissing all",
                launcher -> assertEquals("Still have tasks after dismissing all",
                        0, getTaskCount(launcher)));
                        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();
        }
    }
}
}
+0 −16
Original line number Original line Diff line number Diff line
@@ -431,22 +431,6 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest {
        waitForState("Launcher internal state didn't switch to Home", () -> LauncherState.NORMAL);
        waitForState("Launcher internal state didn't switch to Home", () -> LauncherState.NORMAL);
    }
    }


    @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
    @Test
    @PortraitLandscape
    @PortraitLandscape
    public void testDeleteFromWorkspace() throws Exception {
    public void testDeleteFromWorkspace() throws Exception {