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);
}
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));
}
}
}
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));
}
}
}
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));
}
}
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));
}
}
Aggregations