use of com.android.launcher3.util.LauncherModelHelper.TEST_PACKAGE in project android_packages_apps_Launcher3 by ArrowOS.
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_Launcher3 by ArrowOS.
the class WidgetsListSearchHeaderViewHolderBinderTest method bindViewHolder_appWith3Widgets_shouldShowTheCorrectAppNameAndSubtitle.
@Test
public void bindViewHolder_appWith3Widgets_shouldShowTheCorrectAppNameAndSubtitle() {
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);
TextView appTitle = widgetsListHeader.findViewById(R.id.app_title);
TextView appSubtitle = widgetsListHeader.findViewById(R.id.app_subtitle);
assertThat(appTitle.getText()).isEqualTo(APP_NAME);
assertThat(appSubtitle.getText()).isEqualTo(".SampleWidget0, .SampleWidget1, .SampleWidget2");
}
use of com.android.launcher3.util.LauncherModelHelper.TEST_PACKAGE in project android_packages_apps_Launcher3 by ArrowOS.
the class WidgetsListTableViewHolderBinderTest method bindViewHolder_appWith3Widgets_shouldHave3Widgets.
@Test
public void bindViewHolder_appWith3Widgets_shouldHave3Widgets() throws Exception {
WidgetsRowViewHolder viewHolder = mViewHolderBinder.newViewHolder(new FrameLayout(mContext));
WidgetsListContentEntry entry = generateSampleAppWithWidgets(APP_NAME, TEST_PACKAGE, /* numOfWidgets= */
3);
mViewHolderBinder.bindViewHolder(viewHolder, entry, /* position= */
0, EMPTY_LIST);
Executors.MAIN_EXECUTOR.submit(() -> {
}).get();
// THEN the table container has one row, which contains 3 widgets.
// View: .SampleWidget0 | .SampleWidget1 | .SampleWidget2
assertThat(viewHolder.tableContainer.getChildCount()).isEqualTo(1);
TableRow row = (TableRow) viewHolder.tableContainer.getChildAt(0);
assertThat(row.getChildCount()).isEqualTo(3);
// Widget 0 label is .SampleWidget0.
assertWidgetCellWithLabel(row.getChildAt(0), ".SampleWidget0");
// Widget 1 label is .SampleWidget1.
assertWidgetCellWithLabel(row.getChildAt(1), ".SampleWidget1");
// Widget 2 label is .SampleWidget2.
assertWidgetCellWithLabel(row.getChildAt(2), ".SampleWidget2");
}
use of com.android.launcher3.util.LauncherModelHelper.TEST_PACKAGE in project android_packages_apps_Launcher3 by ArrowOS.
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_Launcher3 by ProtonAOSP.
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