use of com.facebook.imagepipeline.core.CloseableReferenceFactory in project fresco by facebook.
the class DecodeProducerTest method setUp.
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
mProgressiveJpegConfig = new SimpleProgressiveJpegConfig(new SimpleProgressiveJpegConfig.DynamicValueConfig() {
public List<Integer> getScansToDecode() {
return Arrays.asList(PREVIEW_SCAN, GOOD_ENOUGH_SCAN);
}
public int getGoodEnoughScanNumber() {
return GOOD_ENOUGH_SCAN;
}
});
PowerMockito.mockStatic(ProgressiveJpegParser.class);
PowerMockito.whenNew(ProgressiveJpegParser.class).withAnyArguments().thenReturn(mProgressiveJpegParser);
PowerMockito.mockStatic(JobScheduler.class);
PowerMockito.whenNew(JobScheduler.class).withAnyArguments().thenReturn(mJobScheduler);
when(mConfig.getExperiments()).thenReturn(mPipelineExperiments);
mDecodeProducer = new DecodeProducer(mByteArrayPool, mExecutor, mImageDecoder, mProgressiveJpegConfig, false, /* Set downsampleEnabled to false */
false, /* Set resizeAndRotateForNetwork to false */
false, /* We don't cancel when the request is cancelled */
mInputProducer, MAX_BITMAP_SIZE, new CloseableReferenceFactory(new NoOpCloseableReferenceLeakTracker()), null, Suppliers.BOOLEAN_FALSE);
PooledByteBuffer pooledByteBuffer = mockPooledByteBuffer(IMAGE_SIZE);
mByteBufferRef = CloseableReference.of(pooledByteBuffer);
mEncodedImage = new EncodedImage(mByteBufferRef);
mEncodedImage.setImageFormat(DefaultImageFormats.JPEG);
mEncodedImage.setWidth(IMAGE_WIDTH);
mEncodedImage.setHeight(IMAGE_HEIGHT);
mEncodedImage.setRotationAngle(IMAGE_ROTATION_ANGLE);
mEncodedImage.setExifOrientation(IMAGE_EXIF_ORIENTATION);
}
Aggregations