use of com.android.launcher3.util.LauncherModelHelper.TEST_PACKAGE in project android_packages_apps_Launcher3 by ArrowOS.
the class WidgetsListHeaderViewHolderBinderTest method bindViewHolder_shouldAttachOnHeaderClickListener.
@Test
public void bindViewHolder_shouldAttachOnHeaderClickListener() {
WidgetsListHeaderHolder viewHolder = mViewHolderBinder.newViewHolder(new FrameLayout(mContext));
WidgetsListHeader widgetsListHeader = viewHolder.mWidgetsListHeader;
WidgetsListHeaderEntry entry = generateSampleAppHeader(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 WidgetsListHeaderViewHolderBinderTest method bindViewHolder_appWith3Widgets_shouldShowTheCorrectAppNameAndSubtitle.
@Test
public void bindViewHolder_appWith3Widgets_shouldShowTheCorrectAppNameAndSubtitle() {
WidgetsListHeaderHolder viewHolder = mViewHolderBinder.newViewHolder(new FrameLayout(mContext));
WidgetsListHeader widgetsListHeader = viewHolder.mWidgetsListHeader;
WidgetsListHeaderEntry entry = generateSampleAppHeader(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("3 widgets");
}
use of com.android.launcher3.util.LauncherModelHelper.TEST_PACKAGE in project android_packages_apps_Launcher3 by ArrowOS.
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_Launcher3 by ArrowOS.
the class PackageUserKeyTest method fromPackageItemInfo_shouldCreateExpectedObject.
@Test
public void fromPackageItemInfo_shouldCreateExpectedObject() {
PackageUserKey packageUserKey = PackageUserKey.fromPackageItemInfo(new PackageItemInfo(TEST_PACKAGE, UserHandle.CURRENT));
assertThat(packageUserKey.mPackageName).isEqualTo(TEST_PACKAGE);
assertThat(packageUserKey.mWidgetCategory).isEqualTo(NO_CATEGORY);
assertThat(packageUserKey.mUser).isEqualTo(UserHandle.CURRENT);
}
use of com.android.launcher3.util.LauncherModelHelper.TEST_PACKAGE in project android_packages_apps_Launcher3 by ProtonAOSP.
the class WidgetsListHeaderViewHolderBinderTest method bindViewHolder_appWith3Widgets_shouldShowTheCorrectAppNameAndSubtitle.
@Test
public void bindViewHolder_appWith3Widgets_shouldShowTheCorrectAppNameAndSubtitle() {
WidgetsListHeaderHolder viewHolder = mViewHolderBinder.newViewHolder(new FrameLayout(mContext));
WidgetsListHeader widgetsListHeader = viewHolder.mWidgetsListHeader;
WidgetsListHeaderEntry entry = generateSampleAppHeader(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("3 widgets");
}
Aggregations