Search in sources :

Example 46 with TaplTestsLauncher3.getAppPackageName

use of com.android.launcher3.ui.TaplTestsLauncher3.getAppPackageName in project Neo-Launcher by NeoApplications.

the class AddWidgetTest method testDragIcon.

@Test
@PortraitLandscape
public void testDragIcon() throws Throwable {
    clearHomescreen();
    mDevice.pressHome();
    final LauncherAppWidgetProviderInfo widgetInfo = TestViewHelpers.findWidgetProvider(this, false);
    mLauncher.getWorkspace().openAllWidgets().getWidget(widgetInfo.getLabel(mTargetContext.getPackageManager())).dragToWorkspace();
    assertTrue(mActivityMonitor.itemExists((info, view) -> info instanceof LauncherAppWidgetInfo && ((LauncherAppWidgetInfo) info).providerName.getClassName().equals(widgetInfo.provider.getClassName())).call());
    final Widget widget = mLauncher.getWorkspace().tryGetWidget(widgetInfo.label, DEFAULT_UI_TIMEOUT);
    assertNotNull("Widget not found on the workspace", widget);
    widget.launch(getAppPackageName());
}
Also used : LauncherAppWidgetProviderInfo(com.android.launcher3.LauncherAppWidgetProviderInfo) Widget(com.android.launcher3.tapl.Widget) LauncherAppWidgetInfo(com.android.launcher3.LauncherAppWidgetInfo) Test(org.junit.Test) AbstractLauncherUiTest(com.android.launcher3.ui.AbstractLauncherUiTest) LargeTest(androidx.test.filters.LargeTest)

Example 47 with TaplTestsLauncher3.getAppPackageName

use of com.android.launcher3.ui.TaplTestsLauncher3.getAppPackageName in project Neo-Launcher by NeoApplications.

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).openMenu();
        executeOnLauncher(launcher -> assertTrue("Launcher internal state didn't switch to Showing Menu", isOptionsPopupVisible(launcher)));
        menu.getMenuItem(1).launch(getAppPackageName());
    } finally {
        allApps.unfreeze();
    }
}
Also used : AllApps(com.android.launcher3.tapl.AllApps) AppIconMenu(com.android.launcher3.tapl.AppIconMenu) LargeTest(androidx.test.filters.LargeTest) Test(org.junit.Test)

Example 48 with TaplTestsLauncher3.getAppPackageName

use of com.android.launcher3.ui.TaplTestsLauncher3.getAppPackageName in project Neo-Launcher by NeoApplications.

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();
        mLauncher.getWorkspace().getWorkspaceAppIcon(shortcutName).launch(getAppPackageName());
    } finally {
        allApps.unfreeze();
    }
}
Also used : AllApps(com.android.launcher3.tapl.AllApps) AppIconMenuItem(com.android.launcher3.tapl.AppIconMenuItem) LargeTest(androidx.test.filters.LargeTest) Test(org.junit.Test)

Example 49 with TaplTestsLauncher3.getAppPackageName

use of com.android.launcher3.ui.TaplTestsLauncher3.getAppPackageName in project Neo-Launcher by NeoApplications.

the class TaplTestsLauncher3 method testDragAppIcon.

@Test
@PortraitLandscape
public void testDragAppIcon() throws Throwable {
    // 1. Open all apps and wait for load complete.
    // 2. Drag icon to homescreen.
    // 3. Verify that the icon works on homescreen.
    final AllApps allApps = mLauncher.getWorkspace().switchToAllApps();
    allApps.freeze();
    try {
        allApps.getAppIcon(APP_NAME).dragToWorkspace();
        mLauncher.getWorkspace().getWorkspaceAppIcon(APP_NAME).launch(getAppPackageName());
    } finally {
        allApps.unfreeze();
    }
    executeOnLauncher(launcher -> assertTrue("Launcher activity is the top activity; expecting another activity to be the top " + "one", isInBackground(launcher)));
}
Also used : AllApps(com.android.launcher3.tapl.AllApps) LargeTest(androidx.test.filters.LargeTest) Test(org.junit.Test)

Example 50 with TaplTestsLauncher3.getAppPackageName

use of com.android.launcher3.ui.TaplTestsLauncher3.getAppPackageName in project android_packages_apps_Trebuchet by LineageOS.

the class AddWidgetTest method testDragIcon.

@Test
@PortraitLandscape
public void testDragIcon() throws Throwable {
    clearHomescreen();
    mDevice.pressHome();
    final LauncherAppWidgetProviderInfo widgetInfo = TestViewHelpers.findWidgetProvider(this, false);
    mLauncher.getWorkspace().openAllWidgets().getWidget(widgetInfo.getLabel(mTargetContext.getPackageManager())).dragToWorkspace(false, false);
    assertTrue(mActivityMonitor.itemExists((info, view) -> info instanceof LauncherAppWidgetInfo && ((LauncherAppWidgetInfo) info).providerName.getClassName().equals(widgetInfo.provider.getClassName())).call());
    final Widget widget = mLauncher.getWorkspace().tryGetWidget(widgetInfo.label, DEFAULT_UI_TIMEOUT);
    assertNotNull("Widget not found on the workspace", widget);
    widget.launch(getAppPackageName());
}
Also used : LauncherAppWidgetProviderInfo(com.android.launcher3.LauncherAppWidgetProviderInfo) Widget(com.android.launcher3.tapl.Widget) LauncherAppWidgetInfo(com.android.launcher3.model.data.LauncherAppWidgetInfo) Test(org.junit.Test) AbstractLauncherUiTest(com.android.launcher3.ui.AbstractLauncherUiTest) LargeTest(androidx.test.filters.LargeTest)

Aggregations

LargeTest (androidx.test.filters.LargeTest)55 Test (org.junit.Test)55 AllApps (com.android.launcher3.tapl.AllApps)33 OverviewTask (com.android.launcher3.tapl.OverviewTask)13 AppIconMenu (com.android.launcher3.tapl.AppIconMenu)12 AppIconMenuItem (com.android.launcher3.tapl.AppIconMenuItem)12 Overview (com.android.launcher3.tapl.Overview)11 Intent (android.content.Intent)9 Ignore (org.junit.Ignore)9 PendingIntent (android.app.PendingIntent)7 AddToHomeScreenPrompt (com.android.launcher3.tapl.AddToHomeScreenPrompt)7 AppIcon (com.android.launcher3.tapl.AppIcon)7 Widget (com.android.launcher3.tapl.Widget)7 RequestPinItemActivity (com.android.launcher3.testcomponent.RequestPinItemActivity)7 AbstractLauncherUiTest (com.android.launcher3.ui.AbstractLauncherUiTest)7 LauncherAppWidgetInfo (com.android.launcher3.model.data.LauncherAppWidgetInfo)6 BaseOverview (com.android.launcher3.tapl.BaseOverview)6 SessionInfo (android.content.pm.PackageInstaller.SessionInfo)5 Process.myUserHandle (android.os.Process.myUserHandle)5 UserHandle (android.os.UserHandle)5