Search in sources :

Example 1 with AppIconMenuItem

use of com.android.launcher3.tapl.AppIconMenuItem in project android_packages_apps_Launcher3 by crdroidandroid.

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();
    }
}
Also used : AllApps(com.android.launcher3.tapl.AllApps) AppIconMenu(com.android.launcher3.tapl.AppIconMenu) AppIconMenuItem(com.android.launcher3.tapl.AppIconMenuItem) LargeTest(androidx.test.filters.LargeTest) Test(org.junit.Test)

Example 2 with AppIconMenuItem

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

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();
    }
}
Also used : AllApps(com.android.launcher3.tapl.AllApps) AppIconMenu(com.android.launcher3.tapl.AppIconMenu) AppIconMenuItem(com.android.launcher3.tapl.AppIconMenuItem) LargeTest(androidx.test.filters.LargeTest) Test(org.junit.Test)

Example 3 with AppIconMenuItem

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

the class TaplTestsLauncher3 method testLaunchMenuItem.

@Test
@PortraitLandscape
public void testLaunchMenuItem() throws Exception {
    final AllApps allApps = mLauncher.getWorkspace().switchToAllApps();
    allApps.freeze();
    try {
        final AppIconMenu menu = allApps.getAppIcon(APP_NAME).openDeepShortcutMenu();
        executeOnLauncher(launcher -> assertTrue("Launcher internal state didn't switch to Showing Menu", isOptionsPopupVisible(launcher)));
        final AppIconMenuItem menuItem = menu.getMenuItem(1);
        assertEquals("Wrong menu item", "Shortcut 2", menuItem.getText());
        menuItem.launch(getAppPackageName());
    } finally {
        allApps.unfreeze();
    }
}
Also used : AllApps(com.android.launcher3.tapl.AllApps) AppIconMenu(com.android.launcher3.tapl.AppIconMenu) AppIconMenuItem(com.android.launcher3.tapl.AppIconMenuItem) LargeTest(androidx.test.filters.LargeTest) Test(org.junit.Test)

Example 4 with AppIconMenuItem

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

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 AppIconMenuItem menuItem = allApps.getAppIcon(APP_NAME).openMenu().getMenuItem(0);
        final String shortcutName = menuItem.getText();
        menuItem.dragToWorkspace(false, false);
        mLauncher.getWorkspace().getWorkspaceAppIcon(shortcutName).launch(getAppPackageName());
    } finally {
        allApps.unfreeze();
    }
}
Also used : AllApps(com.android.launcher3.tapl.AllApps) AppIconMenuItem(com.android.launcher3.tapl.AppIconMenuItem) Test(org.junit.Test) LargeTest(androidx.test.filters.LargeTest)

Example 5 with AppIconMenuItem

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

the class TaplTestsLauncher3 method testLaunchMenuItem.

@Test
@PortraitLandscape
public void testLaunchMenuItem() throws Exception {
    final AllApps allApps = mLauncher.getWorkspace().switchToAllApps();
    allApps.freeze();
    try {
        final AppIconMenu menu = allApps.getAppIcon(APP_NAME).openDeepShortcutMenu();
        executeOnLauncher(launcher -> assertTrue("Launcher internal state didn't switch to Showing Menu", isOptionsPopupVisible(launcher)));
        final AppIconMenuItem menuItem = menu.getMenuItem(1);
        assertEquals("Wrong menu item", "Shortcut 2", menuItem.getText());
        menuItem.launch(getAppPackageName());
    } finally {
        allApps.unfreeze();
    }
}
Also used : AllApps(com.android.launcher3.tapl.AllApps) AppIconMenu(com.android.launcher3.tapl.AppIconMenu) AppIconMenuItem(com.android.launcher3.tapl.AppIconMenuItem) LargeTest(androidx.test.filters.LargeTest) Test(org.junit.Test)

Aggregations

LargeTest (androidx.test.filters.LargeTest)12 AllApps (com.android.launcher3.tapl.AllApps)12 AppIconMenuItem (com.android.launcher3.tapl.AppIconMenuItem)12 Test (org.junit.Test)12 AppIconMenu (com.android.launcher3.tapl.AppIconMenu)10