提交 acbeb5b5 编写于 作者: S Sam Judd

Don't replace thumbnails with placeholders.

上级 b46fae74
......@@ -20,7 +20,7 @@ public class ThumbnailRequestCoordinator implements RequestCoordinator, Request
@Override
public boolean canSetPlaceholder(Request request) {
return request == full;
return request == full && !isAnyRequestComplete();
}
@Override
......
......@@ -572,7 +572,7 @@ public class GenericRequestTest {
}
@Test
public void testCallsEngingWithOverrideWidthAndHeightIfSet() {
public void testCallsEngineWithOverrideWidthAndHeightIfSet() {
harness.overrideWidth = 1;
harness.overrideHeight = 2;
GenericRequest<Object, Object, Object, Object> request = harness.getRequest();
......@@ -584,6 +584,16 @@ public class GenericRequestTest {
any(Priority.class), anyBoolean(), any(ResourceCallback.class));
}
@Test
public void testDoesNotSetErrorDrawableIfRequestCoordinatorDoesntAllowIt() {
harness.errorDrawable = new ColorDrawable(Color.RED);
GenericRequest<Object, Object, Object, Object> request = harness.getRequest();
when(harness.requestCoordinator.canSetPlaceholder(any(Request.class))).thenReturn(false);
request.onException(new IOException("Test"));
verify(harness.target, never()).setPlaceholder(any(Drawable.class));
}
private Context mockContextToReturn(int resourceId, Drawable drawable) {
Resources resources = mock(Resources.class);
Context context = mock(Context.class);
......
......@@ -80,4 +80,20 @@ public class ThumbnailRequestCoordinatorTest {
verify(thumb,never()).run();
}
@Test
public void testDoesNotAllowThumbToSetPlaceholder() {
assertFalse(coordinator.canSetPlaceholder(thumb));
}
@Test
public void testAllowsFullToSetPlaceholder() {
assertTrue(coordinator.canSetPlaceholder(full));
}
@Test
public void testDoesNotAllowFullToSetPlaceholderIfThumbComplete() {
when(thumb.isComplete()).thenReturn(true);
assertFalse(coordinator.canSetPlaceholder(full));
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册