OSDN Git Service

Merge "Also tint the settings icon in DashboardAdapter.setCategory()."
authorTreeHugger Robot <treehugger-gerrit@google.com>
Fri, 30 Jun 2017 20:07:40 +0000 (20:07 +0000)
committerAndroid (Google) Code Review <android-gerrit@google.com>
Fri, 30 Jun 2017 20:07:40 +0000 (20:07 +0000)
1  2 
src/com/android/settings/dashboard/DashboardAdapter.java
tests/robotests/src/com/android/settings/dashboard/DashboardAdapterTest.java

@@@ -366,8 -449,31 +366,30 @@@ public class DashboardAdapterTest 
      }
  
      @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);
 -        mDashboardAdapter = new DashboardAdapter(mContext, null, null);
 +        mDashboardAdapter = new DashboardAdapter(mContext, null, null, null, null);
          final List<Tile> suggestions = makeSuggestions("pkg1");
          final List<DashboardCategory> categories = new ArrayList<>();
          final DashboardCategory category = mock(DashboardCategory.class);