use of com.android.launcher3.util.LauncherModelHelper.TEST_PACKAGE in project android_packages_apps_404Launcher by P-404.
the class GridSizeMigrationTaskV2Test method setUp.
@Before
public void setUp() {
mModelHelper = new LauncherModelHelper();
mContext = mModelHelper.sandboxContext;
mDb = mModelHelper.provider.getDb();
mValidPackages = new HashSet<>();
mValidPackages.add(TEST_PACKAGE);
mValidPackages.add(testPackage1);
mValidPackages.add(testPackage2);
mValidPackages.add(testPackage3);
mValidPackages.add(testPackage4);
mValidPackages.add(testPackage5);
mValidPackages.add(testPackage6);
mValidPackages.add(testPackage7);
mValidPackages.add(testPackage8);
mValidPackages.add(testPackage9);
mValidPackages.add(testPackage10);
mIdp = InvariantDeviceProfile.INSTANCE.get(mContext);
long userSerial = UserCache.INSTANCE.get(mContext).getSerialNumberForUser(Process.myUserHandle());
dropTable(mDb, LauncherSettings.Favorites.TMP_TABLE);
LauncherSettings.Favorites.addTableToDb(mDb, userSerial, false, LauncherSettings.Favorites.TMP_TABLE);
}
use of com.android.launcher3.util.LauncherModelHelper.TEST_PACKAGE in project android_packages_apps_404Launcher by P-404.
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);
}
use of com.android.launcher3.util.LauncherModelHelper.TEST_PACKAGE in project android_packages_apps_404Launcher by P-404.
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 crdroidandroid.
the class WidgetsListHeaderViewHolderBinderTest method bindViewHolder_appWith3Widgets_shouldShowTheCorrectAppNameAndSubtitle.
@Test
public void bindViewHolder_appWith3Widgets_shouldShowTheCorrectAppNameAndSubtitle() {
WidgetsListHeaderHolder viewHolder = mViewHolderBinder.newViewHolder(new FrameLayout(mTestActivity));
WidgetsListHeader widgetsListHeader = viewHolder.mWidgetsListHeader;
WidgetsListHeaderEntry entry = generateSampleAppHeader(APP_NAME, TEST_PACKAGE, /* numOfWidgets= */
3);
mViewHolderBinder.bindViewHolder(viewHolder, entry, /* position= */
0);
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 crdroidandroid.
the class WidgetsListTableViewHolderBinderTest method bindViewHolder_appWith3Widgets_shouldHave3Widgets.
@Test
public void bindViewHolder_appWith3Widgets_shouldHave3Widgets() {
WidgetsRowViewHolder viewHolder = mViewHolderBinder.newViewHolder(new FrameLayout(mTestActivity));
WidgetsListContentEntry entry = generateSampleAppWithWidgets(APP_NAME, TEST_PACKAGE, /* numOfWidgets= */
3);
mViewHolderBinder.bindViewHolder(viewHolder, entry, /* position= */
0);
shadowOf(getMainLooper()).idle();
// THEN the table container has one row, which contains 3 widgets.
// View: .SampleWidget0 | .SampleWidget1 | .SampleWidget2
assertThat(viewHolder.mTableContainer.getChildCount()).isEqualTo(1);
TableRow row = (TableRow) viewHolder.mTableContainer.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");
}
Aggregations