use of com.android.launcher3.tapl.AllApps in project Neo-Launcher by NeoApplications.
the class TaplTestsQuickstep method testAppIconLaunchFromAllAppsFromOverview.
@Test
public void testAppIconLaunchFromAllAppsFromOverview() throws Exception {
final AllApps allApps = mLauncher.getWorkspace().switchToOverview().switchToAllApps();
assertTrue("Launcher internal state is not All Apps", isInState(LauncherState.ALL_APPS));
TaplTestsLauncher3.runIconLaunchFromAllAppsTest(this, allApps);
}
use of com.android.launcher3.tapl.AllApps in project Neo-Launcher by NeoApplications.
the class TaplTestsQuickstep method testOverview.
@Test
@PortraitLandscape
public void testOverview() throws Exception {
startTestApps();
Overview overview = mLauncher.pressHome().switchToOverview();
assertTrue("Launcher internal state didn't switch to Overview", isInState(LauncherState.OVERVIEW));
executeOnLauncher(launcher -> assertTrue("Don't have at least 3 tasks", getTaskCount(launcher) >= 3));
// Test flinging forward and backward.
executeOnLauncher(launcher -> assertEquals("Current task in Overview is not 0", 0, getCurrentOverviewPage(launcher)));
overview.flingForward();
assertTrue("Launcher internal state is not Overview", isInState(LauncherState.OVERVIEW));
final Integer currentTaskAfterFlingForward = getFromLauncher(launcher -> getCurrentOverviewPage(launcher));
executeOnLauncher(launcher -> assertTrue("Current task in Overview is still 0", currentTaskAfterFlingForward > 0));
overview.flingBackward();
assertTrue("Launcher internal state is not Overview", isInState(LauncherState.OVERVIEW));
executeOnLauncher(launcher -> assertTrue("Flinging back in Overview did nothing", getCurrentOverviewPage(launcher) < currentTaskAfterFlingForward));
// Test opening a task.
OverviewTask task = mLauncher.pressHome().switchToOverview().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));
executeOnLauncher(launcher -> assertTrue("Launcher activity is the top activity; expecting another activity to be the top " + "one", isInBackground(launcher)));
// Test dismissing a task.
overview = mLauncher.pressHome().switchToOverview();
assertTrue("Launcher internal state didn't switch to Overview", isInState(LauncherState.OVERVIEW));
final Integer numTasks = getFromLauncher(launcher -> getTaskCount(launcher));
task = overview.getCurrentTask();
assertNotNull("overview.getCurrentTask() returned null (2)", task);
task.dismiss();
executeOnLauncher(launcher -> assertEquals("Dismissing a task didn't remove 1 task from Overview", numTasks - 1, getTaskCount(launcher)));
if (!TestHelpers.isInLauncherProcess() || getFromLauncher(launcher -> !launcher.getDeviceProfile().isLandscape)) {
// Test switching to all apps and back.
final AllAppsFromOverview allApps = overview.switchToAllApps();
assertNotNull("overview.switchToAllApps() returned null (1)", allApps);
assertTrue("Launcher internal state is not All Apps (1)", isInState(LauncherState.ALL_APPS));
overview = allApps.switchBackToOverview();
assertNotNull("allApps.switchBackToOverview() returned null", overview);
assertTrue("Launcher internal state didn't switch to Overview", isInState(LauncherState.OVERVIEW));
// Test UIDevice.pressBack()
overview.switchToAllApps();
assertNotNull("overview.switchToAllApps() returned null (2)", allApps);
assertTrue("Launcher internal state is not All Apps (2)", isInState(LauncherState.ALL_APPS));
mDevice.pressBack();
mLauncher.getOverview();
}
// Test UIDevice.pressHome, once we are in AllApps.
mDevice.pressHome();
waitForState("Launcher internal state didn't switch to Home", LauncherState.NORMAL);
// Test dismissing all tasks.
mLauncher.getWorkspace().switchToOverview().dismissAllTasks();
waitForState("Launcher internal state didn't switch to Home", LauncherState.NORMAL);
executeOnLauncher(launcher -> assertEquals("Still have tasks after dismissing all", 0, getTaskCount(launcher)));
}
use of com.android.launcher3.tapl.AllApps in project Neo-Launcher by NeoApplications.
the class LauncherModel method startLoader.
/**
* Starts the loader. Tries to bind {@params synchronousBindPage} synchronously if possible.
* @return true if the page could be bound synchronously.
*/
public boolean startLoader(int synchronousBindPage) {
// Enable queue before starting loader. It will get disabled in Launcher#finishBindingItems
InstallShortcutReceiver.enableInstallQueue(InstallShortcutReceiver.FLAG_LOADER_RUNNING);
synchronized (mLock) {
// Don't bother to start the thread if we know it's not going to do anything
if (mCallbacks != null && mCallbacks.get() != null) {
final Callbacks oldCallbacks = mCallbacks.get();
// Clear any pending bind-runnables from the synchronized load process.
MAIN_EXECUTOR.execute(oldCallbacks::clearPendingBinds);
// If there is already one running, tell it to stop.
stopLoader();
LoaderResults loaderResults = new LoaderResults(mApp, sBgDataModel, mBgAllAppsList, synchronousBindPage, mCallbacks);
if (mModelLoaded && !mIsLoaderTaskRunning) {
// Divide the set of loaded items into those that we are binding synchronously,
// and everything else that is to be bound normally (asynchronously).
loaderResults.bindWorkspace();
// For now, continue posting the binding of AllApps as there are other
// issues that arise from that.
loaderResults.bindAllApps();
loaderResults.bindDeepShortcuts();
loaderResults.bindWidgets();
Log.d(TAG, "Reloading apps...");
return true;
} else {
startLoaderForResults(loaderResults);
}
}
}
return false;
}
use of com.android.launcher3.tapl.AllApps in project Neo-Launcher by NeoApplications.
the class TaplTestsLauncher3 method runAllAppsTest.
public static void runAllAppsTest(AbstractLauncherUiTest test, AllApps allApps) {
allApps.freeze();
try {
assertNotNull("allApps parameter is null", allApps);
assertTrue("Launcher internal state is not All Apps", test.isInState(LauncherState.ALL_APPS));
// Test flinging forward and backward.
test.executeOnLauncher(launcher -> assertEquals("All Apps started in already scrolled state", 0, test.getAllAppsScroll(launcher)));
allApps.flingForward();
assertTrue("Launcher internal state is not All Apps", test.isInState(LauncherState.ALL_APPS));
final Integer flingForwardY = test.getFromLauncher(launcher -> test.getAllAppsScroll(launcher));
test.executeOnLauncher(launcher -> assertTrue("flingForward() didn't scroll App Apps", flingForwardY > 0));
allApps.flingBackward();
assertTrue("Launcher internal state is not All Apps", test.isInState(LauncherState.ALL_APPS));
final Integer flingBackwardY = test.getFromLauncher(launcher -> test.getAllAppsScroll(launcher));
test.executeOnLauncher(launcher -> assertTrue("flingBackward() didn't scroll App Apps", flingBackwardY < flingForwardY));
// Test scrolling down to YouTube.
assertNotNull("All apps: can't fine YouTube", allApps.getAppIcon("YouTube"));
// Test scrolling up to Camera.
assertNotNull("All apps: can't fine Camera", allApps.getAppIcon("Camera"));
// Test failing to find a non-existing app.
final AllApps allAppsFinal = allApps;
expectFail("All apps: could find a non-existing app", () -> allAppsFinal.getAppIcon("NO APP"));
assertTrue("Launcher internal state is not All Apps", test.isInState(LauncherState.ALL_APPS));
} finally {
allApps.unfreeze();
}
}
use of com.android.launcher3.tapl.AllApps in project Neo-Launcher by NeoApplications.
the class TaplTestsLauncher3 method testPressHomeOnAllAppsContextMenu.
@Test
@Ignore
public void testPressHomeOnAllAppsContextMenu() throws Exception {
final AllApps allApps = mLauncher.getWorkspace().switchToAllApps();
allApps.freeze();
try {
allApps.getAppIcon("TestActivity7").openMenu();
} finally {
allApps.unfreeze();
}
mLauncher.pressHome();
}
Aggregations