use of com.android.launcher3.ui.TaplTestsLauncher3.getAppPackageName in project android_packages_apps_Trebuchet by LineageOS.
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", mDevice.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", mDevice.wait(Until.hasObject(By.pkg(mOtherLauncherActivity.packageName)), WAIT_TIME_MS));
}
use of com.android.launcher3.ui.TaplTestsLauncher3.getAppPackageName in project android_packages_apps_Launcher3 by ArrowOS.
the class TaplTestsQuickstep method testPressBack.
// TODO(b/204830798): test with all navigation modes(add @NavigationModeSwitch annotation)
// after the bug resolved.
@Ignore("b/205027405")
@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);
}
use of com.android.launcher3.ui.TaplTestsLauncher3.getAppPackageName in project android_packages_apps_Launcher3 by ArrowOS.
the class TaplTestsQuickstep method testOverviewForTablet.
@Test
@PortraitLandscape
public void testOverviewForTablet() throws Exception {
// TODO(b/210158657): Re-enable for OOP
if (!mLauncher.isTablet() || !TestHelpers.isInLauncherProcess()) {
return;
}
for (int i = 2; i <= 14; i++) {
startTestActivity(i);
}
Overview overview = mLauncher.pressHome().switchToOverview();
executeOnLauncher(launcher -> assertTrue("Don't have at least 13 tasks", getTaskCount(launcher) >= 13));
// Test scroll the first task off screen
overview.scrollCurrentTaskOffScreen();
assertTrue("Launcher internal state is not Overview", isInState(() -> LauncherState.OVERVIEW));
executeOnLauncher(launcher -> assertTrue("Current task in Overview is still 0", getCurrentOverviewPage(launcher) > 0));
// Test opening the task.
overview.getCurrentTask().open();
assertTrue("Test activity didn't open from Overview", mDevice.wait(Until.hasObject(By.pkg(getAppPackageName()).text("TestActivity8")), DEFAULT_UI_TIMEOUT));
// Scroll the task offscreen as it is now first
overview = mLauncher.pressHome().switchToOverview();
overview.scrollCurrentTaskOffScreen();
assertTrue("Launcher internal state is not Overview", isInState(() -> LauncherState.OVERVIEW));
executeOnLauncher(launcher -> assertTrue("Current task in Overview is still 0", getCurrentOverviewPage(launcher) > 0));
// Test dismissing the later task.
final Integer numTasks = getFromLauncher(this::getTaskCount);
overview.getCurrentTask().dismiss();
executeOnLauncher(launcher -> assertEquals("Dismissing a task didn't remove 1 task from Overview", numTasks - 1, getTaskCount(launcher)));
executeOnLauncher(launcher -> assertTrue("Grid did not rebalance after dismissal", (Math.abs(getTopRowTaskCountForTablet(launcher) - getBottomRowTaskCountForTablet(launcher)) <= 1)));
// Test dismissing more tasks.
assertTrue("Launcher internal state didn't remain in Overview", isInState(() -> LauncherState.OVERVIEW));
overview.getCurrentTask().dismiss();
assertTrue("Launcher internal state didn't remain in Overview", isInState(() -> LauncherState.OVERVIEW));
overview.getCurrentTask().dismiss();
executeOnLauncher(launcher -> assertTrue("Grid did not rebalance after multiple dismissals", (Math.abs(getTopRowTaskCountForTablet(launcher) - getBottomRowTaskCountForTablet(launcher)) <= 1)));
// Test dismissing all tasks.
mLauncher.pressHome().switchToOverview().dismissAllTasks();
assertTrue("Launcher internal state is not Home", isInState(() -> LauncherState.NORMAL));
executeOnLauncher(launcher -> assertEquals("Still have tasks after dismissing all", 0, getTaskCount(launcher)));
}
use of com.android.launcher3.ui.TaplTestsLauncher3.getAppPackageName in project android_packages_apps_Launcher3 by ArrowOS.
the class TaplTestsLauncher3 method runIconLaunchFromAllAppsTest.
public static void runIconLaunchFromAllAppsTest(AbstractLauncherUiTest test, AllApps allApps) {
allApps.freeze();
try {
final AppIcon app = allApps.getAppIcon("TestActivity7");
assertNotNull("AppIcon.launch returned null", app.launch(getAppPackageName()));
test.executeOnLauncher(launcher -> assertTrue("Launcher activity is the top activity; expecting another activity to be the " + "top " + "one", test.isInBackground(launcher)));
} finally {
allApps.unfreeze();
}
}
use of com.android.launcher3.ui.TaplTestsLauncher3.getAppPackageName in project android_packages_apps_Launcher3 by ArrowOS.
the class TaplTestsLauncher3 method testDragShortcut.
@Test
@PortraitLandscape
public void testDragShortcut() throws Throwable {
// 1. Open all apps and wait for load complete.
// 2. Find the app and long press it to show shortcuts.
// 3. Press icon center until shortcuts appear
final AllApps allApps = mLauncher.getWorkspace().switchToAllApps();
allApps.freeze();
try {
final AppIconMenu menu = allApps.getAppIcon(APP_NAME).openDeepShortcutMenu();
final AppIconMenuItem menuItem0 = menu.getMenuItem(0);
final AppIconMenuItem menuItem2 = menu.getMenuItem(2);
final AppIconMenuItem menuItem;
final String expectedShortcutName = "Shortcut 3";
if (menuItem0.getText().equals(expectedShortcutName)) {
menuItem = menuItem0;
} else {
final String shortcutName2 = menuItem2.getText();
assertEquals("Wrong menu item", expectedShortcutName, shortcutName2);
menuItem = menuItem2;
}
menuItem.dragToWorkspace(false, false);
mLauncher.getWorkspace().getWorkspaceAppIcon(expectedShortcutName).launch(getAppPackageName());
} finally {
allApps.unfreeze();
}
}
Aggregations