Merge "Don't crash in SecondaryUserController." into oc-dev am: aa3685fe14

am: 129eb1773a

Change-Id: Iae6c55f2e6f26dc6b147d70c070109398c528636
This commit is contained in:
Daniel Nishi
2017-04-12 19:23:12 +00:00
committed by android-build-merger
2 changed files with 25 additions and 3 deletions

View File

@@ -211,4 +211,20 @@ public class SecondaryUserControllerTest {
Preference preference = argumentCaptor.getValue();
assertThat(preference.getIcon()).isEqualTo(drawable);
}
@Test
public void setIcon_doesntNpeOnNullPreference() throws Exception {
SparseArray<Drawable> icons = new SparseArray<>();
Bitmap userBitmap =
BitmapFactory.decodeResource(
RuntimeEnvironment.application.getResources(), R.drawable.home);
UserIconDrawable drawable = new UserIconDrawable(100 /* size */).setIcon(userBitmap).bake();
icons.put(10, drawable);
mPrimaryUser.name = TEST_NAME;
mPrimaryUser.id = 10;
mController.handleUserIcons(icons);
// Doesn't crash
}
}