Search in sources :

Example 26 with Wait

use of com.android.launcher3.util.Wait 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 27 with Wait

use of com.android.launcher3.util.Wait 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 28 with Wait

use of com.android.launcher3.util.Wait in project android_packages_apps_Trebuchet by LineageOS.

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(false, false);
        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) Test(org.junit.Test) LargeTest(androidx.test.filters.LargeTest)

Example 29 with Wait

use of com.android.launcher3.util.Wait in project android_packages_apps_Trebuchet by LineageOS.

the class LauncherModelHelper method loadModelSync.

/**
 * Loads the model in memory synchronously
 */
public void loadModelSync() throws ExecutionException, InterruptedException {
    // Since robolectric tests run on main thread, we run the loader-UI calls on a temp thread,
    // so that we can wait appropriately for the loader to complete.
    ReflectionHelpers.setField(getModel(), "mMainExecutor", Executors.UI_HELPER_EXECUTOR);
    Callbacks mockCb = mock(Callbacks.class);
    getModel().addCallbacksAndLoad(mockCb);
    Executors.MODEL_EXECUTOR.submit(() -> {
    }).get();
    Executors.UI_HELPER_EXECUTOR.submit(() -> {
    }).get();
    ReflectionHelpers.setField(getModel(), "mMainExecutor", Executors.MAIN_EXECUTOR);
    getModel().removeCallbacks(mockCb);
}
Also used : Callbacks(com.android.launcher3.model.BgDataModel.Callbacks)

Example 30 with Wait

use of com.android.launcher3.util.Wait in project android_packages_apps_Trebuchet by LineageOS.

the class ModelMultiCallbacksTest method setUp.

@Before
public void setUp() throws Exception {
    mModelHelper = new LauncherModelHelper();
    mModelHelper.installApp(TEST_PACKAGE);
    mSpm = shadowOf(RuntimeEnvironment.application.getPackageManager());
    // Since robolectric tests run on main thread, we run the loader-UI calls on a temp thread,
    // so that we can wait appropriately for the loader to complete.
    mTempMainExecutor = new LooperExecutor(createAndStartNewForegroundLooper("tempMain"));
    ReflectionHelpers.setField(mModelHelper.getModel(), "mMainExecutor", mTempMainExecutor);
}
Also used : LooperExecutor(com.android.launcher3.util.LooperExecutor) LauncherModelHelper(com.android.launcher3.util.LauncherModelHelper) Before(org.junit.Before)

Aggregations

LargeTest (androidx.test.filters.LargeTest)14 AllApps (com.android.launcher3.tapl.AllApps)14 Test (org.junit.Test)14 View (android.view.View)11 AbstractFloatingView (com.android.launcher3.AbstractFloatingView)11 RecentsView (com.android.quickstep.views.RecentsView)11 TaskView (com.android.quickstep.views.TaskView)11 AppWidgetProviderInfo (android.appwidget.AppWidgetProviderInfo)8 ComponentName (android.content.ComponentName)8 CancellationException (java.util.concurrent.CancellationException)8 ContentResolver (android.content.ContentResolver)7 Context (android.content.Context)7 Intent (android.content.Intent)7 SessionInfo (android.content.pm.PackageInstaller.SessionInfo)7 ShortcutInfo (android.content.pm.ShortcutInfo)7 UserHandle (android.os.UserHandle)7 LongSparseArray (android.util.LongSparseArray)7 OnDrawListener (android.view.ViewTreeObserver.OnDrawListener)7 FolderGridOrganizer (com.android.launcher3.folder.FolderGridOrganizer)7 ShortcutKey (com.android.launcher3.shortcuts.ShortcutKey)7