use of com.android.launcher3.util.LauncherModelHelper.TEST_PACKAGE in project android_packages_apps_404Launcher by P-404.
the class WidgetsListSearchHeaderViewHolderBinderTest method bindViewHolder_shouldAttachOnHeaderClickListener.
@Test
public void bindViewHolder_shouldAttachOnHeaderClickListener() {
WidgetsListSearchHeaderHolder viewHolder = mViewHolderBinder.newViewHolder(new FrameLayout(mContext));
WidgetsListHeader widgetsListHeader = viewHolder.mWidgetsListHeader;
WidgetsListSearchHeaderEntry entry = generateSampleSearchHeader(APP_NAME, TEST_PACKAGE, /* numOfWidgets= */
3);
mViewHolderBinder.bindViewHolder(viewHolder, entry, /* position= */
0, EMPTY_LIST);
widgetsListHeader.callOnClick();
verify(mOnHeaderClickListener).onHeaderClicked(eq(true), eq(PackageUserKey.fromPackageItemInfo(entry.mPkgItem)));
}
use of com.android.launcher3.util.LauncherModelHelper.TEST_PACKAGE in project android_packages_apps_404Launcher by P-404.
the class WidgetsTableUtilsTest method initTestShortcuts.
private void initTestShortcuts() {
PackageManager packageManager = mContext.getPackageManager();
mShortcut1 = new WidgetItem(new TestShortcutConfigActivityInfo(ComponentName.createRelative(TEST_PACKAGE, ".shortcut1"), UserHandle.CURRENT), mIconCache, packageManager);
mShortcut2 = new WidgetItem(new TestShortcutConfigActivityInfo(ComponentName.createRelative(TEST_PACKAGE, ".shortcut2"), UserHandle.CURRENT), mIconCache, packageManager);
mShortcut3 = new WidgetItem(new TestShortcutConfigActivityInfo(ComponentName.createRelative(TEST_PACKAGE, ".shortcut3"), UserHandle.CURRENT), mIconCache, packageManager);
}
use of com.android.launcher3.util.LauncherModelHelper.TEST_PACKAGE in project android_packages_apps_404Launcher by P-404.
the class WidgetsTableUtilsTest method initTestWidgets.
private void initTestWidgets() {
List<Point> widgetSizes = List.of(new Point(1, 1), new Point(2, 2), new Point(2, 3), new Point(2, 4), new Point(4, 4));
ArrayList<WidgetItem> widgetItems = new ArrayList<>();
widgetSizes.stream().forEach(widgetSize -> {
AppWidgetProviderInfo info = createAppWidgetProviderInfo(ComponentName.createRelative(TEST_PACKAGE, ".WidgetProvider_" + widgetSize.x + "x" + widgetSize.y));
LauncherAppWidgetProviderInfo widgetInfo = LauncherAppWidgetProviderInfo.fromProviderInfo(mContext, info);
widgetInfo.spanX = widgetSize.x;
widgetInfo.spanY = widgetSize.y;
widgetItems.add(new WidgetItem(widgetInfo, mTestProfile, mIconCache));
});
mWidget1x1 = widgetItems.get(0);
mWidget2x2 = widgetItems.get(1);
mWidget2x3 = widgetItems.get(2);
mWidget2x4 = widgetItems.get(3);
mWidget4x4 = widgetItems.get(4);
}
use of com.android.launcher3.util.LauncherModelHelper.TEST_PACKAGE in project android_packages_apps_404Launcher by P-404.
the class DefaultLayoutProviderTest method testCustomProfileLoaded_with_folder.
@Test
public void testCustomProfileLoaded_with_folder() throws Exception {
writeLayoutAndLoad(new LauncherLayoutBuilder().atHotseat(0).putFolder(android.R.string.copy).addApp(TEST_PACKAGE, TEST_ACTIVITY).addApp(TEST_PACKAGE, TEST_ACTIVITY).addApp(TEST_PACKAGE, TEST_ACTIVITY).build());
// Verify folder
assertEquals(1, mModelHelper.getBgDataModel().workspaceItems.size());
ItemInfo info = mModelHelper.getBgDataModel().workspaceItems.get(0);
assertEquals(LauncherSettings.Favorites.ITEM_TYPE_FOLDER, info.itemType);
assertEquals(3, ((FolderInfo) info).contents.size());
}
use of com.android.launcher3.util.LauncherModelHelper.TEST_PACKAGE in project android_packages_apps_404Launcher by P-404.
the class DefaultLayoutProviderTest method testCustomProfileLoaded_with_folder_custom_title.
@Test
public void testCustomProfileLoaded_with_folder_custom_title() throws Exception {
writeLayoutAndLoad(new LauncherLayoutBuilder().atHotseat(0).putFolder("CustomFolder").addApp(TEST_PACKAGE, TEST_ACTIVITY).addApp(TEST_PACKAGE, TEST_ACTIVITY).addApp(TEST_PACKAGE, TEST_ACTIVITY).build());
// Verify folder
assertEquals(1, mModelHelper.getBgDataModel().workspaceItems.size());
ItemInfo info = mModelHelper.getBgDataModel().workspaceItems.get(0);
assertEquals(LauncherSettings.Favorites.ITEM_TYPE_FOLDER, info.itemType);
assertEquals(3, ((FolderInfo) info).contents.size());
assertEquals("CustomFolder", info.title.toString());
}
Aggregations