Search in sources :

Example 56 with TEST_PACKAGE

use of com.android.launcher3.util.LauncherModelHelper.TEST_PACKAGE in project android_packages_apps_Launcher3 by crdroidandroid.

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(createAndStartNewLooper("tempMain"));
    ShadowLooperExecutor sle = Shadow.extract(Executors.MAIN_EXECUTOR);
    sle.setHandler(mTempMainExecutor.getHandler());
}
Also used : LooperExecutor(com.android.launcher3.util.LooperExecutor) ShadowLooperExecutor(com.android.launcher3.shadows.ShadowLooperExecutor) LauncherModelHelper(com.android.launcher3.util.LauncherModelHelper) ShadowLooperExecutor(com.android.launcher3.shadows.ShadowLooperExecutor) Before(org.junit.Before)

Example 57 with TEST_PACKAGE

use of com.android.launcher3.util.LauncherModelHelper.TEST_PACKAGE in project android_packages_apps_Launcher3 by crdroidandroid.

the class SDWorkModeTest method setup.

@Before
public void setup() throws Exception {
    mModelHelper = new LauncherModelHelper();
    mTargetContext = RuntimeEnvironment.application;
    mIdp = InvariantDeviceProfile.INSTANCE.get(mTargetContext);
    Settings.Global.putFloat(mTargetContext.getContentResolver(), Settings.Global.WINDOW_ANIMATION_SCALE, 0);
    mModelHelper.installApp(TEST_PACKAGE);
}
Also used : LauncherModelHelper(com.android.launcher3.util.LauncherModelHelper) Before(org.junit.Before)

Example 58 with TEST_PACKAGE

use of com.android.launcher3.util.LauncherModelHelper.TEST_PACKAGE in project android_packages_apps_Launcher3 by crdroidandroid.

the class LauncherUIScrollTest method testAllAppsScroll.

@Test
public void testAllAppsScroll() throws Exception {
    // Install 100 apps
    for (int i = 0; i < 100; i++) {
        mModelHelper.installApp(TEST_PACKAGE + i);
    }
    // Bind and open all-apps
    Launcher launcher = loadLauncher();
    launcher.getStateManager().goToState(LauncherState.ALL_APPS, false);
    doLayout(launcher);
    int currentScroll = launcher.getAppsView().getActiveRecyclerView().getCurrentScrollY();
    launcher.dispatchGenericMotionEvent(createScrollEvent(-1));
    int newScroll = launcher.getAppsView().getActiveRecyclerView().getCurrentScrollY();
    assertNotEquals("All Apps was not scrolled", currentScroll, newScroll);
    assertEquals("Workspace was scrolled", 0, launcher.getWorkspace().getNextPage());
}
Also used : LauncherUIHelper.buildAndBindLauncher(com.android.launcher3.util.LauncherUIHelper.buildAndBindLauncher) Launcher(com.android.launcher3.Launcher) Test(org.junit.Test)

Example 59 with TEST_PACKAGE

use of com.android.launcher3.util.LauncherModelHelper.TEST_PACKAGE in project android_packages_apps_Launcher3 by crdroidandroid.

the class LauncherUIScrollTest method setup.

@Before
public void setup() throws Exception {
    mModelHelper = new LauncherModelHelper();
    mTargetContext = RuntimeEnvironment.application;
    mIdp = InvariantDeviceProfile.INSTANCE.get(mTargetContext);
    Settings.Global.putFloat(mTargetContext.getContentResolver(), Settings.Global.WINDOW_ANIMATION_SCALE, 0);
    mModelHelper.installApp(TEST_PACKAGE);
    // LayoutBuilder with 3 workspace pages
    mLayoutBuilder = new LauncherLayoutBuilder().atWorkspace(0, mIdp.numRows - 1, 0).putApp(TEST_PACKAGE, TEST_PACKAGE).atWorkspace(0, mIdp.numRows - 1, 1).putApp(TEST_PACKAGE, TEST_PACKAGE).atWorkspace(0, mIdp.numRows - 1, 2).putApp(TEST_PACKAGE, TEST_PACKAGE);
}
Also used : LauncherLayoutBuilder(com.android.launcher3.util.LauncherLayoutBuilder) LauncherModelHelper(com.android.launcher3.util.LauncherModelHelper) Before(org.junit.Before)

Example 60 with TEST_PACKAGE

use of com.android.launcher3.util.LauncherModelHelper.TEST_PACKAGE in project Neo-Launcher by NeoApplications.

the class GridSizeMigrationTaskTest method setUp.

@Before
public void setUp() {
    mValidPackages = new HashSet<>();
    mValidPackages.add(TEST_PACKAGE);
    mIdp = new InvariantDeviceProfile();
}
Also used : InvariantDeviceProfile(com.android.launcher3.InvariantDeviceProfile) Before(org.junit.Before)

Aggregations

Test (org.junit.Test)55 SmallTest (androidx.test.filters.SmallTest)36 LauncherLayoutBuilder (com.android.launcher3.util.LauncherLayoutBuilder)29 FrameLayout (android.widget.FrameLayout)25 Before (org.junit.Before)19 ItemInfo (com.android.launcher3.model.data.ItemInfo)18 LauncherModelHelper (com.android.launcher3.util.LauncherModelHelper)18 FolderInfo (com.android.launcher3.model.data.FolderInfo)12 TextView (android.widget.TextView)10 WidgetItem (com.android.launcher3.model.WidgetItem)10 WidgetsListHeaderEntry (com.android.launcher3.widget.model.WidgetsListHeaderEntry)10 WidgetsListSearchHeaderEntry (com.android.launcher3.widget.model.WidgetsListSearchHeaderEntry)10 Launcher (com.android.launcher3.Launcher)6 LauncherUIHelper.buildAndBindLauncher (com.android.launcher3.util.LauncherUIHelper.buildAndBindLauncher)6 AppWidgetProviderInfo (android.appwidget.AppWidgetProviderInfo)5 PackageManager (android.content.pm.PackageManager)5 Point (android.graphics.Point)5 TableRow (android.widget.TableRow)5 LauncherAppWidgetProviderInfo (com.android.launcher3.widget.LauncherAppWidgetProviderInfo)5 WidgetsListContentEntry (com.android.launcher3.widget.model.WidgetsListContentEntry)5