@Test public void testPlaceholderDrawableIsSet() { Drawable expected = new ColorDrawable(Color.RED); MockTarget target = new MockTarget(); harness.placeholderDrawable = expected; harness.target = target; GenericRequest request = harness.getRequest(); request.begin(); assertEquals(expected, target.currentPlaceholder); }
@Test public void testErrorDrawableIsSetOnLoadFailed() { Drawable expected = new ColorDrawable(Color.RED); MockTarget target = new MockTarget(); harness.errorDrawable = expected; harness.target = target; GenericRequest request = harness.getRequest(); request.onException(null); assertEquals(expected, target.currentPlaceholder); }
@Test public void setTestPlaceholderDrawableSetOnNullModel() { Drawable placeholder = new ColorDrawable(Color.RED); MockTarget target = new MockTarget(); harness.placeholderDrawable = placeholder; harness.target = target; harness.model = null; GenericRequest request = harness.getRequest(); request.begin(); assertEquals(placeholder, target.currentPlaceholder); }
@Test public void testPlaceholderResourceIsSet() { final int expectedId = 12345; Drawable expected = new ColorDrawable(Color.RED); Context context = mockContextToReturn(expectedId, expected); MockTarget target = new MockTarget(); harness.context = context; harness.placeholderResourceId = expectedId; harness.target = target; GenericRequest request = harness.getRequest(); request.begin(); assertEquals(expected, target.currentPlaceholder); }