Search in sources :

Example 61 with TEST_PACKAGE

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

the class DefaultLayoutProviderTest method testCustomProfileLoaded_with_icon_on_hotseat.

@Test
public void testCustomProfileLoaded_with_icon_on_hotseat() throws Exception {
    writeLayoutAndLoad(new LauncherLayoutBuilder().atHotseat(0).putApp(TEST_PACKAGE, TEST_PACKAGE));
    // Verify one item in hotseat
    assertEquals(1, mModelHelper.getBgDataModel().workspaceItems.size());
    ItemInfo info = mModelHelper.getBgDataModel().workspaceItems.get(0);
    assertEquals(LauncherSettings.Favorites.CONTAINER_HOTSEAT, info.container);
    assertEquals(LauncherSettings.Favorites.ITEM_TYPE_APPLICATION, info.itemType);
}
Also used : LauncherLayoutBuilder(com.android.launcher3.util.LauncherLayoutBuilder) ItemInfo(com.android.launcher3.model.data.ItemInfo) Test(org.junit.Test)

Example 62 with TEST_PACKAGE

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

the class DefaultLayoutProviderTest method setUp.

@Before
public void setUp() {
    mModelHelper = new LauncherModelHelper();
    mTargetContext = RuntimeEnvironment.application;
    shadowOf(mTargetContext.getPackageManager()).addActivityIfNotPresent(new ComponentName(TEST_PACKAGE, TEST_PACKAGE));
}
Also used : LauncherModelHelper(com.android.launcher3.util.LauncherModelHelper) ComponentName(android.content.ComponentName) Before(org.junit.Before)

Example 63 with TEST_PACKAGE

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

the class GridSizeMigrationTaskTest method setUp.

@Before
public void setUp() {
    mModelHelper = new LauncherModelHelper();
    mContext = RuntimeEnvironment.application;
    mDb = mModelHelper.provider.getDb();
    mValidPackages = new HashSet<>();
    mValidPackages.add(TEST_PACKAGE);
    mIdp = InvariantDeviceProfile.INSTANCE.get(mContext);
}
Also used : LauncherModelHelper(com.android.launcher3.util.LauncherModelHelper) Before(org.junit.Before)

Example 64 with TEST_PACKAGE

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

the class ModelMultiCallbacksTest method setupWorkspacePages.

private void setupWorkspacePages(int pageCount) throws Exception {
    // Create a layout with 3 pages
    LauncherLayoutBuilder builder = new LauncherLayoutBuilder();
    for (int i = 0; i < pageCount; i++) {
        builder.atWorkspace(1, 1, i).putApp(TEST_PACKAGE, TEST_PACKAGE);
    }
    mModelHelper.setupDefaultLayoutProvider(builder);
}
Also used : LauncherLayoutBuilder(com.android.launcher3.util.LauncherLayoutBuilder)

Example 65 with TEST_PACKAGE

use of com.android.launcher3.util.LauncherModelHelper.TEST_PACKAGE 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

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