Implement pressing back button and swiping back
This CL implements a pressBack function to press back button or swiping
back in gesture navigation mode.
Bug: 199120092
Test: atest -c Launcher3Tests:com.android.launcher3.ui.TaplTestsLauncher3#testPressBack &&
atest -c NexusLauncherTests:com.android.quickstep.TaplTestsQuickstep#testPressBack
Change-Id: I001cea17d09ae1ab7952d04ee394a2afa5bf1e67
This commit is contained in:
@@ -31,6 +31,7 @@ import androidx.test.uiautomator.Until;
|
||||
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.LauncherState;
|
||||
import com.android.launcher3.tapl.AllApps;
|
||||
import com.android.launcher3.tapl.Background;
|
||||
import com.android.launcher3.tapl.LauncherInstrumentation.NavigationModel;
|
||||
import com.android.launcher3.tapl.Overview;
|
||||
@@ -49,6 +50,9 @@ import org.junit.runner.RunWith;
|
||||
@LargeTest
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class TaplTestsQuickstep extends AbstractQuickStepTest {
|
||||
|
||||
private static final String APP_NAME = "LauncherTestApp";
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
@@ -286,6 +290,30 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest {
|
||||
getAndAssertBackground();
|
||||
}
|
||||
|
||||
// TODO(b/204830798): test with all navigation modes(add @NavigationModeSwitch annotation)
|
||||
// after the bug resolved.
|
||||
@Test
|
||||
@PortraitLandscape
|
||||
@ScreenRecord
|
||||
public void testPressBack() throws Exception {
|
||||
mLauncher.getWorkspace().switchToAllApps();
|
||||
mLauncher.pressBack();
|
||||
mLauncher.getWorkspace();
|
||||
waitForState("Launcher internal state didn't switch to Home", () -> LauncherState.NORMAL);
|
||||
|
||||
AllApps allApps = mLauncher.getWorkspace().switchToAllApps();
|
||||
allApps.freeze();
|
||||
try {
|
||||
allApps.getAppIcon(APP_NAME).dragToWorkspace(false, false);
|
||||
} finally {
|
||||
allApps.unfreeze();
|
||||
}
|
||||
mLauncher.getWorkspace().getWorkspaceAppIcon(APP_NAME).launch(getAppPackageName());
|
||||
mLauncher.pressBack();
|
||||
mLauncher.getWorkspace();
|
||||
waitForState("Launcher internal state didn't switch to Home", () -> LauncherState.NORMAL);
|
||||
}
|
||||
|
||||
@Test
|
||||
@PortraitLandscape
|
||||
public void testOverviewForTablet() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user