Search in sources :

Example 21 with AppIcon

use of com.android.launcher3.tapl.AppIcon in project android_packages_apps_Trebuchet by LineageOS.

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();
    }
}
Also used : AppIcon(com.android.launcher3.tapl.AppIcon)

Example 22 with AppIcon

use of com.android.launcher3.tapl.AppIcon 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();
    }
}
Also used : AppIcon(com.android.launcher3.tapl.AppIcon)

Example 23 with AppIcon

use of com.android.launcher3.tapl.AppIcon in project android_packages_apps_Launcher3 by ArrowOS.

the class TaplTestsLauncher3 method testDeleteFromWorkspace.

@Test
@PortraitLandscape
public void testDeleteFromWorkspace() throws Exception {
    // test delete both built-in apps and user-installed app from workspace
    for (String appName : new String[] { "Gmail", "Play Store", APP_NAME }) {
        final AppIcon appIcon = createShortcutIfNotExist(appName);
        Workspace workspace = mLauncher.getWorkspace().deleteAppIcon(appIcon);
        assertNull(appName + " app was found after being deleted from workspace", workspace.tryGetWorkspaceAppIcon(appName));
    }
}
Also used : AppIcon(com.android.launcher3.tapl.AppIcon) Workspace(com.android.launcher3.tapl.Workspace) LargeTest(androidx.test.filters.LargeTest) Test(org.junit.Test)

Example 24 with AppIcon

use of com.android.launcher3.tapl.AppIcon in project android_packages_apps_Launcher3 by ProtonAOSP.

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();
    }
}
Also used : AppIcon(com.android.launcher3.tapl.AppIcon)

Example 25 with AppIcon

use of com.android.launcher3.tapl.AppIcon in project android_packages_apps_Launcher3 by ProtonAOSP.

the class TaplTestsLauncher3 method testWorkspace.

@Test
public void testWorkspace() throws Exception {
    final Workspace workspace = mLauncher.getWorkspace();
    // Test that ensureWorkspaceIsScrollable adds a page by dragging an icon there.
    executeOnLauncher(launcher -> assertFalse("Initial workspace state is scrollable", isWorkspaceScrollable(launcher)));
    assertNull("Chrome app was found on empty workspace", workspace.tryGetWorkspaceAppIcon("Chrome"));
    workspace.ensureWorkspaceIsScrollable();
    executeOnLauncher(launcher -> assertEquals("Ensuring workspace scrollable didn't switch to next screen", workspace.pagesPerScreen(), getCurrentWorkspacePage(launcher)));
    executeOnLauncher(launcher -> assertTrue("ensureScrollable didn't make workspace scrollable", isWorkspaceScrollable(launcher)));
    assertNotNull("ensureScrollable didn't add Chrome app", workspace.getWorkspaceAppIcon("Chrome"));
    // Test flinging workspace.
    workspace.flingBackward();
    assertTrue("Launcher internal state is not Home", isInState(() -> LauncherState.NORMAL));
    executeOnLauncher(launcher -> assertEquals("Flinging back didn't switch workspace to page #0", 0, getCurrentWorkspacePage(launcher)));
    workspace.flingForward();
    executeOnLauncher(launcher -> assertEquals("Flinging forward didn't switch workspace to next screen", workspace.pagesPerScreen(), getCurrentWorkspacePage(launcher)));
    assertTrue("Launcher internal state is not Home", isInState(() -> LauncherState.NORMAL));
    // Test starting a workspace app.
    final AppIcon app = workspace.getWorkspaceAppIcon("Chrome");
    assertNotNull("No Chrome app in workspace", app);
}
Also used : AppIcon(com.android.launcher3.tapl.AppIcon) Workspace(com.android.launcher3.tapl.Workspace) LargeTest(androidx.test.filters.LargeTest) Test(org.junit.Test)

Aggregations

AppIcon (com.android.launcher3.tapl.AppIcon)26 Test (org.junit.Test)17 LargeTest (androidx.test.filters.LargeTest)15 Workspace (com.android.launcher3.tapl.Workspace)15 AllApps (com.android.launcher3.tapl.AllApps)4 Folder (com.android.launcher3.tapl.Folder)4 FolderIcon (com.android.launcher3.tapl.FolderIcon)4 Ignore (org.junit.Ignore)4 PackageInstaller (android.content.pm.PackageInstaller)2 SessionInfo (android.content.pm.PackageInstaller.SessionInfo)2 SessionParams (android.content.pm.PackageInstaller.SessionParams)2 ItemInfo (com.android.launcher3.model.data.ItemInfo)2 LauncherLayoutBuilder (com.android.launcher3.util.LauncherLayoutBuilder)2