use of com.android.settingslib.drawer.Tile in project android_packages_apps_Settings by crdroidandroid.
the class DashboardFeatureProviderImplTest method bindPreference_shouldBindAllData.
@Test
public void bindPreference_shouldBindAllData() {
final Preference preference = new Preference(ShadowApplication.getInstance().getApplicationContext());
final Tile tile = new Tile();
tile.title = "title";
tile.summary = "summary";
tile.icon = Icon.createWithBitmap(Bitmap.createBitmap(1, 1, Bitmap.Config.RGB_565));
tile.metaData = new Bundle();
tile.metaData.putString(SettingsActivity.META_DATA_KEY_FRAGMENT_CLASS, "HI");
tile.priority = 10;
mImpl.bindPreferenceToTile(mActivity, MetricsProto.MetricsEvent.SETTINGS_GESTURES, preference, tile, "123", Preference.DEFAULT_ORDER);
assertThat(preference.getTitle()).isEqualTo(tile.title);
assertThat(preference.getSummary()).isEqualTo(tile.summary);
assertThat(preference.getIcon()).isNotNull();
assertThat(preference.getFragment()).isEqualTo(tile.metaData.getString(SettingsActivity.META_DATA_KEY_FRAGMENT_CLASS));
assertThat(preference.getOrder()).isEqualTo(-tile.priority);
}
use of com.android.settingslib.drawer.Tile in project android_packages_apps_Settings by crdroidandroid.
the class DashboardFeatureProviderImplTest method getPreferences_hasTileForCategory_shouldReturnPrefList.
@Test
public void getPreferences_hasTileForCategory_shouldReturnPrefList() {
mImpl = new DashboardFeatureProviderImpl(mActivity);
ReflectionHelpers.setField(mImpl, "mCategoryManager", mCategoryManager);
final DashboardCategory category = new DashboardCategory();
category.tiles.add(new Tile());
when(mCategoryManager.getTilesByCategory(any(Context.class), eq(CategoryKey.CATEGORY_HOMEPAGE))).thenReturn(category);
assertThat(mImpl.getPreferencesForCategory(mActivity, ShadowApplication.getInstance().getApplicationContext(), MetricsProto.MetricsEvent.SETTINGS_GESTURES, CategoryKey.CATEGORY_HOMEPAGE).isEmpty()).isFalse();
}
use of com.android.settingslib.drawer.Tile in project android_packages_apps_Settings by crdroidandroid.
the class DashboardFragmentTest method tintTileIcon_noMetadata_shouldReturnPackageNameCheck.
@Test
public void tintTileIcon_noMetadata_shouldReturnPackageNameCheck() {
final Tile tile = new Tile();
tile.icon = mock(Icon.class);
final Intent intent = new Intent();
tile.intent = intent;
intent.setComponent(new ComponentName(ShadowApplication.getInstance().getApplicationContext().getPackageName(), "TestClass"));
assertThat(mTestFragment.tintTileIcon(tile)).isFalse();
intent.setComponent(new ComponentName("OtherPackage", "TestClass"));
assertThat(mTestFragment.tintTileIcon(tile)).isTrue();
}
use of com.android.settingslib.drawer.Tile in project android_packages_apps_Settings by crdroidandroid.
the class DashboardFragmentTest method tintTileIcon_noIcon_shouldReturnFalse.
@Test
public void tintTileIcon_noIcon_shouldReturnFalse() {
final Tile tile = new Tile();
final Bundle metaData = new Bundle();
tile.metaData = metaData;
assertThat(mTestFragment.tintTileIcon(tile)).isFalse();
}
use of com.android.settingslib.drawer.Tile in project android_packages_apps_Settings by crdroidandroid.
the class DashboardItemAnimatorTest method SetUp.
@Before
public void SetUp() {
final Context context = ShadowApplication.getInstance().getApplicationContext();
mDashboardItemAnimator = new DashboardItemAnimator();
mViewHolder = new ViewHolder(new TextView(context));
mViewHolder.itemView.setTag(new Tile());
}
Aggregations