use of com.android.launcher3.util.LauncherModelHelper.TEST_PACKAGE in project android_packages_apps_Launcher3 by ProtonAOSP.
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_ACTIVITY));
// 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);
}
use of com.android.launcher3.util.LauncherModelHelper.TEST_PACKAGE in project android_packages_apps_Launcher3 by AOSPA.
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 AOSPA.
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 AOSPA.
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 AOSPA.
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");
}
Aggregations