Search in sources :

Example 6 with BaseOverview

use of com.android.launcher3.tapl.BaseOverview in project android_packages_apps_Launcher3 by AOSPA.

the class FallbackRecentsTest method testOverview.

// b/143488140
// @NavigationModeSwitch
@Test
public void testOverview() {
    startAppFast(getAppPackageName());
    startAppFast(resolveSystemApp(Intent.CATEGORY_APP_CALCULATOR));
    startTestActivity(2);
    Wait.atMost("Expected three apps in the task list", () -> mLauncher.getRecentTasks().size() >= 3, DEFAULT_ACTIVITY_TIMEOUT, mLauncher);
    BaseOverview overview = mLauncher.getBackground().switchToOverview();
    executeOnRecents(recents -> {
        assertTrue("Don't have at least 3 tasks", getTaskCount(recents) >= 3);
    });
    // Test flinging forward and backward.
    overview.flingForward();
    final Integer currentTaskAfterFlingForward = getFromRecents(this::getCurrentOverviewPage);
    executeOnRecents(recents -> assertTrue("Current task in Overview is still 0", currentTaskAfterFlingForward > 0));
    overview.flingBackward();
    executeOnRecents(recents -> assertTrue("Flinging back in Overview did nothing", getCurrentOverviewPage(recents) < currentTaskAfterFlingForward));
    // Test opening a task.
    overview = pressHomeAndGoToOverview();
    OverviewTask task = overview.getCurrentTask();
    assertNotNull("overview.getCurrentTask() returned null (1)", task);
    assertNotNull("OverviewTask.open returned null", task.open());
    assertTrue("Test activity didn't open from Overview", TestHelpers.wait(Until.hasObject(By.pkg(getAppPackageName()).text("TestActivity2")), DEFAULT_UI_TIMEOUT));
    // Test dismissing a task.
    overview = pressHomeAndGoToOverview();
    final Integer numTasks = getFromRecents(this::getTaskCount);
    task = overview.getCurrentTask();
    assertNotNull("overview.getCurrentTask() returned null (2)", task);
    task.dismiss();
    executeOnRecents(recents -> assertEquals("Dismissing a task didn't remove 1 task from Overview", numTasks - 1, getTaskCount(recents)));
    // Test dismissing all tasks.
    pressHomeAndGoToOverview().dismissAllTasks();
    assertTrue("Fallback Launcher not visible", TestHelpers.wait(Until.hasObject(By.pkg(mOtherLauncherActivity.packageName)), WAIT_TIME_MS));
}
Also used : OverviewTask(com.android.launcher3.tapl.OverviewTask) BaseOverview(com.android.launcher3.tapl.BaseOverview) LargeTest(androidx.test.filters.LargeTest) Test(org.junit.Test)

Aggregations

LargeTest (androidx.test.filters.LargeTest)6 BaseOverview (com.android.launcher3.tapl.BaseOverview)6 OverviewTask (com.android.launcher3.tapl.OverviewTask)6 Test (org.junit.Test)6