use of com.bumptech.glide.load.resource.gif.GifFrameLoader.DelayTarget in project glide by bumptech.
the class GifFrameLoaderTest method testOnFrameReadyWithNullResourceDoesNotClearPreviousFrame.
@Test
public void testOnFrameReadyWithNullResourceDoesNotClearPreviousFrame() {
// Force the loader to create a real Handler by passing null.
loader = createGifFrameLoader(null);
DelayTarget previous = mock(DelayTarget.class);
Request previousRequest = mock(Request.class);
when(previous.getRequest()).thenReturn(previousRequest);
when(previous.getResource()).thenReturn(Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888));
DelayTarget current = mock(DelayTarget.class);
when(current.getResource()).thenReturn(null);
loader.onFrameReady(previous);
loader.onFrameReady(current);
verify(previousRequest, never()).clear();
}
use of com.bumptech.glide.load.resource.gif.GifFrameLoader.DelayTarget in project glide by bumptech.
the class GifFrameLoaderTest method testClearsCompletedLoadOnFrameReadyIfCleared.
@Test
public void testClearsCompletedLoadOnFrameReadyIfCleared() {
// Force the loader to create a real Handler by passing null;
loader = createGifFrameLoader(null);
loader.clear();
DelayTarget delayTarget = mock(DelayTarget.class);
Request request = mock(Request.class);
when(delayTarget.getRequest()).thenReturn(request);
loader.onFrameReady(delayTarget);
verify(requestManager).clear(eq(delayTarget));
}
Aggregations