Also tint the settings icon in DashboardAdapter.setCategory().
When suggestion loader takes longer time to complete, we will first show the dashboard with just the categories, and refresh the UI when the suggestion is ready. However, we only tint the icon when we update both the categories and suggestions, and hence in some case, some tile results with icon not being tinted. Change-Id: I023d50655349731b03c7d7aff153d2cbbd8c63e0 Fix: 37456962 Test: make RunSettingsRoboTests
This commit is contained in:
@@ -448,6 +448,28 @@ public class DashboardAdapterTest {
|
||||
verify(mockIcon).setTint(eq(0x89000000));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetCategories_iconTinted() {
|
||||
TypedArray mockTypedArray = mock(TypedArray.class);
|
||||
doReturn(mockTypedArray).when(mContext).obtainStyledAttributes(any(int[].class));
|
||||
doReturn(0x89000000).when(mockTypedArray).getColor(anyInt(), anyInt());
|
||||
|
||||
final List<DashboardCategory> categories = new ArrayList<>();
|
||||
final DashboardCategory category = mock(DashboardCategory.class);
|
||||
final List<Tile> tiles = new ArrayList<>();
|
||||
final Icon mockIcon = mock(Icon.class);
|
||||
final Tile tile = new Tile();
|
||||
tile.isIconTintable = true;
|
||||
tile.icon = mockIcon;
|
||||
tiles.add(tile);
|
||||
category.tiles = tiles;
|
||||
categories.add(category);
|
||||
|
||||
mDashboardAdapter.setCategory(categories);
|
||||
|
||||
verify(mockIcon).setTint(eq(0x89000000));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBindConditionAndSuggestion_shouldSetSuggestionAdapterAndNoCrash() {
|
||||
when(mFactory.dashboardFeatureProvider.combineSuggestionAndCondition()).thenReturn(true);
|
||||
@@ -458,6 +480,7 @@ public class DashboardAdapterTest {
|
||||
final List<Tile> tiles = new ArrayList<>();
|
||||
tiles.add(mock(Tile.class));
|
||||
category.tiles = tiles;
|
||||
categories.add(category);
|
||||
mDashboardAdapter.setCategoriesAndSuggestions(categories, suggestions);
|
||||
|
||||
final RecyclerView data = mock(RecyclerView.class);
|
||||
|
Reference in New Issue
Block a user