Search in sources :

Example 16 with ResizeOptions

use of com.facebook.imagepipeline.common.ResizeOptions in project fresco by facebook.

the class ThumbnailBranchProducerTest method mockRequestWithResizeOptions.

private void mockRequestWithResizeOptions(int width, int height) {
    ResizeOptions resizeOptions = new ResizeOptions(width, height);
    when(mImageRequest.getResizeOptions()).thenReturn(resizeOptions);
}
Also used : ResizeOptions(com.facebook.imagepipeline.common.ResizeOptions)

Example 17 with ResizeOptions

use of com.facebook.imagepipeline.common.ResizeOptions in project fresco by facebook.

the class ThumbnailSizeCheckerTest method testWithImageNotBigEnoughForResizeOptions.

private static void testWithImageNotBigEnoughForResizeOptions(int[] imageWidths, int[] imageHeights, int startRotation, int additionalRequestWidth, int additionalRequestHeight) {
    for (int rotation = startRotation; rotation < 360; rotation += 180) {
        for (int i = 0; i < TEST_COUNT; i++) {
            ResizeOptions resizeOptions = new ResizeOptions(REQUEST_WIDTHS[i] + additionalRequestWidth, REQUEST_HEIGHTS[i] + additionalRequestHeight);
            EncodedImage encodedImage = mockImage(imageWidths[i], imageHeights[i], rotation);
            assertFalse(ThumbnailSizeChecker.isImageBigEnough(encodedImage, resizeOptions));
        }
    }
}
Also used : ResizeOptions(com.facebook.imagepipeline.common.ResizeOptions) EncodedImage(com.facebook.imagepipeline.image.EncodedImage)

Example 18 with ResizeOptions

use of com.facebook.imagepipeline.common.ResizeOptions in project fresco by facebook.

the class ThumbnailSizeCheckerTest method testWithImageBigEnoughForResizeOptions.

private static void testWithImageBigEnoughForResizeOptions(int[] imageWidths, int[] imageHeights, int startRotation) {
    for (int rotation = startRotation; rotation < 360; rotation += 180) {
        for (int i = 0; i < TEST_COUNT; i++) {
            EncodedImage encodedImage = mockImage(imageWidths[i], imageHeights[i], rotation);
            ResizeOptions resizeOptions = new ResizeOptions(REQUEST_WIDTHS[i], REQUEST_HEIGHTS[i]);
            assertTrue(ThumbnailSizeChecker.isImageBigEnough(encodedImage, resizeOptions));
        }
    }
}
Also used : ResizeOptions(com.facebook.imagepipeline.common.ResizeOptions) EncodedImage(com.facebook.imagepipeline.image.EncodedImage)

Example 19 with ResizeOptions

use of com.facebook.imagepipeline.common.ResizeOptions in project fresco by facebook.

the class ThumbnailSizeCheckerTest method testWithWidthAndHeightNotBigEnoughForResizeOptions.

private static void testWithWidthAndHeightNotBigEnoughForResizeOptions(int additionalRequestWidth, int additionalRequestHeight) {
    for (int i = 0; i < TEST_COUNT; i++) {
        ResizeOptions resizeOptions = new ResizeOptions(REQUEST_WIDTHS[i] + additionalRequestWidth, REQUEST_HEIGHTS[i] + additionalRequestHeight);
        assertFalse(ThumbnailSizeChecker.isImageBigEnough(IMAGE_WIDTHS[i], IMAGE_HEIGHTS[i], resizeOptions));
    }
}
Also used : ResizeOptions(com.facebook.imagepipeline.common.ResizeOptions)

Example 20 with ResizeOptions

use of com.facebook.imagepipeline.common.ResizeOptions in project fresco by facebook.

the class ThumbnailSizeCheckerTest method testWithWidthAndHeightAndResizeOptionsNotMoreThan133PercentOfActual.

@Test
public void testWithWidthAndHeightAndResizeOptionsNotMoreThan133PercentOfActual() {
    for (int i = 0; i < TEST_COUNT; i++) {
        ResizeOptions resizeOptions = new ResizeOptions(REQUEST_WIDTHS[i], REQUEST_HEIGHTS[i]);
        assertTrue(ThumbnailSizeChecker.isImageBigEnough(IMAGE_WIDTHS[i], IMAGE_HEIGHTS[i], resizeOptions));
    }
}
Also used : ResizeOptions(com.facebook.imagepipeline.common.ResizeOptions) Test(org.junit.Test)

Aggregations

ResizeOptions (com.facebook.imagepipeline.common.ResizeOptions)59 ImageRequest (com.facebook.imagepipeline.request.ImageRequest)27 Uri (android.net.Uri)12 Test (org.junit.Test)11 DraweeController (com.facebook.drawee.interfaces.DraweeController)10 ImageRequestBuilder (com.facebook.imagepipeline.request.ImageRequestBuilder)7 PipelineDraweeController (com.facebook.drawee.backends.pipeline.PipelineDraweeController)5 File (java.io.File)5 PipelineDraweeControllerBuilder (com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilder)4 Drawable (android.graphics.drawable.Drawable)3 CloseableReference (com.facebook.common.references.CloseableReference)3 GenericDraweeHierarchy (com.facebook.drawee.generic.GenericDraweeHierarchy)3 EncodedImage (com.facebook.imagepipeline.image.EncodedImage)3 FileSystemReference (im.actor.runtime.files.FileSystemReference)3 Context (android.content.Context)2 Canvas (android.graphics.Canvas)2 Point (android.graphics.Point)2 Animatable (android.graphics.drawable.Animatable)2 View (android.view.View)2 Spinner (android.widget.Spinner)2