use of com.bumptech.glide.request.Request in project glide by bumptech.
the class RequestBuilderTest method testRemovesPreviousRequestFromRequestTracker.
@Test
public void testRemovesPreviousRequestFromRequestTracker() {
Request previous = mock(Request.class);
Target<Object> target = mock(Target.class);
when(target.getRequest()).thenReturn(previous);
getNullModelRequest().into(target);
verify(requestManager).clear(eq(target));
}
use of com.bumptech.glide.request.Request 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.request.Request 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));
}
use of com.bumptech.glide.request.Request in project glide by bumptech.
the class ViewTargetTest method testCanSetAndRetrieveRequest.
@Test
public void testCanSetAndRetrieveRequest() {
Request request = mock(Request.class);
target.setRequest(request);
assertEquals(request, target.getRequest());
}
use of com.bumptech.glide.request.Request in project glide by bumptech.
the class RequestTrackerTest method testDoesNotRestartCompletedRequestsWhenResumed.
@Test
public void testDoesNotRestartCompletedRequestsWhenResumed() {
Request request = mock(Request.class);
when(request.isComplete()).thenReturn(true);
tracker.addRequest(request);
tracker.resumeRequests();
verify(request, never()).begin();
}
Aggregations