use of com.facebook.fresco.vito.options.ImageOptions in project fresco by facebook.
the class ImagePipelineUtilsImplTest method testBuildImageRequest_whenRotatingEnabled_thenSetRotateOptions.
@Test
public void testBuildImageRequest_whenRotatingEnabled_thenSetRotateOptions() {
RotationOptions rotationOptions = RotationOptions.forceRotation(RotationOptions.ROTATE_270);
final ImageOptions imageOptions = ImageOptions.create().rotate(rotationOptions).build();
ImageRequest imageRequest = mImagePipelineUtils.buildImageRequest(URI, imageOptions);
assertThat(imageRequest).isNotNull();
assertThat(imageRequest.getSourceUri()).isEqualTo(URI);
assertThat(imageRequest.getRotationOptions()).isEqualTo(rotationOptions);
}
use of com.facebook.fresco.vito.options.ImageOptions in project fresco by facebook.
the class HierarcherImplTest method testBuildErrorDrawable_whenScaleTypeSet_thenReturnScaleTypeDrawable.
@Test
public void testBuildErrorDrawable_whenScaleTypeSet_thenReturnScaleTypeDrawable() {
PointF focusPoint = new PointF(100, 234);
ImageOptions options = ImageOptions.create().errorRes(RES_ID).errorScaleType(ScalingUtils.ScaleType.FOCUS_CROP).errorFocusPoint(focusPoint).build();
Drawable errorDrawable = mHierarcher.buildErrorDrawable(mResources, options);
assertThat(errorDrawable).isNotNull();
assertThat(errorDrawable).isInstanceOf(ScaleTypeDrawable.class);
ScaleTypeDrawable scaleTypeDrawable = (ScaleTypeDrawable) errorDrawable;
assertThat(scaleTypeDrawable.getScaleType()).isEqualTo(ScalingUtils.ScaleType.FOCUS_CROP);
assertThat(scaleTypeDrawable.getFocusPoint()).isEqualTo(focusPoint);
assertThat(scaleTypeDrawable.getCurrent()).isEqualTo(mDrawable);
}
use of com.facebook.fresco.vito.options.ImageOptions in project fresco by facebook.
the class HierarcherImplTest method testBuildOverlayDrawable_whenInvalidResId_thenThrowNotFoundException.
@Test(expected = Resources.NotFoundException.class)
public void testBuildOverlayDrawable_whenInvalidResId_thenThrowNotFoundException() {
ImageOptions options = ImageOptions.create().overlayRes(INVALID_RES_ID).build();
mHierarcher.buildOverlayDrawable(mResources, options);
}
use of com.facebook.fresco.vito.options.ImageOptions in project fresco by facebook.
the class HierarcherImplTest method testBuildActualImageWrapper.
@Test
public void testBuildActualImageWrapper() {
final PointF expectedFocusPoint = new PointF(1, 2);
final ImageOptions imageOptions = ImageOptions.create().scale(ScalingUtils.ScaleType.FIT_CENTER).focusPoint(expectedFocusPoint).build();
final Drawable actual = mHierarcher.buildActualImageWrapper(imageOptions, null);
assertThat(actual).isInstanceOf(ScaleTypeDrawable.class);
final ScaleTypeDrawable scaleTypeActual = (ScaleTypeDrawable) actual;
assertThat(scaleTypeActual.getScaleType()).isEqualTo(ScalingUtils.ScaleType.FIT_CENTER);
assertThat(scaleTypeActual.getFocusPoint()).isEqualTo(expectedFocusPoint);
}
use of com.facebook.fresco.vito.options.ImageOptions in project fresco by facebook.
the class HierarcherImplTest method testBuildPlaceholderDrawableScale.
@Test
public void testBuildPlaceholderDrawableScale() {
final Drawable expected = new ColorDrawable(Color.YELLOW);
ImageOptions options = ImageOptions.create().placeholder(expected).placeholderScaleType(ScalingUtils.ScaleType.CENTER).build();
final Drawable result = mHierarcher.buildPlaceholderDrawable(mResources, options);
assertThat(result).isExactlyInstanceOf(ScaleTypeDrawable.class);
assertThat(result.getCurrent()).isEqualTo(expected);
}
Aggregations