use of com.facebook.imagepipeline.request.RepeatedPostprocessorRunner in project fresco by facebook.
the class AnimatedRepeatedPostprocessorProducerTest method testNonStaticBitmapIsPassedOn.
@Test
public void testNonStaticBitmapIsPassedOn() {
RepeatedPostprocessorConsumer postprocessorConsumer = produceResults();
RepeatedPostprocessorRunner repeatedPostprocessorRunner = getRunner();
CloseableAnimatedImage sourceCloseableAnimatedImage = mock(CloseableAnimatedImage.class);
CloseableReference<CloseableImage> sourceCloseableImageRef = CloseableReference.<CloseableImage>of(sourceCloseableAnimatedImage);
postprocessorConsumer.onNewResult(sourceCloseableImageRef, true);
sourceCloseableImageRef.close();
mTestExecutorService.runUntilIdle();
mInOrder.verify(mConsumer).onNewResult(any(CloseableReference.class), eq(false));
mInOrder.verifyNoMoreInteractions();
assertEquals(1, mResults.size());
CloseableReference<CloseableImage> res0 = mResults.get(0);
assertTrue(CloseableReference.isValid(res0));
assertSame(sourceCloseableAnimatedImage, res0.get());
res0.close();
performCancelAndVerifyOnCancellation();
verify(sourceCloseableAnimatedImage).close();
}
use of com.facebook.imagepipeline.request.RepeatedPostprocessorRunner in project fresco by facebook.
the class RepeatedPostprocessorProducerTest method testIntermediateImageIsNotProcessed.
@Test
public void testIntermediateImageIsNotProcessed() {
RepeatedPostprocessorConsumer postprocessorConsumer = produceResults();
RepeatedPostprocessorRunner repeatedPostprocessorRunner = getRunner();
setupNewSourceImage();
postprocessorConsumer.onNewResult(mSourceCloseableImageRef, false);
mSourceCloseableImageRef.close();
mTestExecutorService.runUntilIdle();
mInOrder.verifyNoMoreInteractions();
assertEquals(0, mResults.size());
verify(mSourceCloseableStaticBitmap).close();
// final result should be post-processed
performNewResult(postprocessorConsumer, true);
verifyNewResultProcessed(0);
performCancelAndVerifyOnCancellation();
verify(mSourceCloseableStaticBitmap).close();
}
use of com.facebook.imagepipeline.request.RepeatedPostprocessorRunner in project fresco by facebook.
the class RepeatedPostprocessorProducerTest method runPostprocessAgainWhenDirty.
@Test
public void runPostprocessAgainWhenDirty() {
final RepeatedPostprocessorConsumer postprocessorConsumer = produceResults();
final RepeatedPostprocessorRunner repeatedPostprocessorRunner = getRunner();
performNewResult(postprocessorConsumer, false);
Bitmap destBitmap0 = mDestinationBitmap;
performUpdateDuringTheNextPostprocessing(repeatedPostprocessorRunner);
mTestExecutorService.runNextPendingCommand();
verifyNewResultProcessed(0, destBitmap0);
Bitmap destBitmap1 = mDestinationBitmap;
performUpdateDuringTheNextPostprocessing(repeatedPostprocessorRunner);
mTestExecutorService.runNextPendingCommand();
verifyNewResultProcessed(1, destBitmap1);
Bitmap destBitmap2 = mDestinationBitmap;
mTestExecutorService.runNextPendingCommand();
verifyNewResultProcessed(2, destBitmap2);
}
use of com.facebook.imagepipeline.request.RepeatedPostprocessorRunner in project fresco by facebook.
the class RepeatedPostprocessorProducerTest method testPostprocessSuccessful.
@Test
public void testPostprocessSuccessful() {
RepeatedPostprocessorConsumer postprocessorConsumer = produceResults();
RepeatedPostprocessorRunner repeatedPostprocessorRunner = getRunner();
performNewResult(postprocessorConsumer, true);
verifyNewResultProcessed(0);
performCancelAndVerifyOnCancellation();
verify(mSourceCloseableStaticBitmap).close();
}
use of com.facebook.imagepipeline.request.RepeatedPostprocessorRunner in project fresco by facebook.
the class RepeatedPostprocessorProducerTest method testMultiplePostprocessThenClose.
@Test
public void testMultiplePostprocessThenClose() {
RepeatedPostprocessorConsumer postprocessorConsumer = produceResults();
RepeatedPostprocessorRunner repeatedPostprocessorRunner = getRunner();
performNewResult(postprocessorConsumer, true);
verifyNewResultProcessed(0);
performUpdate(repeatedPostprocessorRunner, true);
verifyNewResultProcessed(1);
performUpdate(repeatedPostprocessorRunner, true);
verifyNewResultProcessed(2);
performUpdate(repeatedPostprocessorRunner, true);
verifyNewResultProcessed(3);
performCancelAndVerifyOnCancellation();
verify(mSourceCloseableStaticBitmap).close();
// Can't update now that the request is cancelled.
performUpdate(repeatedPostprocessorRunner, true);
mInOrder.verifyNoMoreInteractions();
}
Aggregations