use of com.facebook.fresco.vito.options.ImageOptions in project fresco by facebook.
the class HierarcherImplTest method testApplyRoundingOptions_whenRoundAsCircle_thenReturnDrawable.
@Test
public void testApplyRoundingOptions_whenRoundAsCircle_thenReturnDrawable() {
final Drawable drawable = new ColorDrawable(Color.YELLOW);
when(mResources.getDrawable(RES_ID)).thenReturn(drawable);
ImageOptions options = mock(ImageOptions.class);
when(options.getRoundingOptions()).thenReturn(RoundingOptions.asCircle());
when(options.getPlaceholderDrawable()).thenReturn(drawable);
when(options.getPlaceholderApplyRoundingOptions()).thenReturn(true);
Drawable result = mHierarcher.buildPlaceholderDrawable(mResources, options);
assertThat(result).isExactlyInstanceOf(RoundedColorDrawable.class);
when(options.getPlaceholderDrawable()).thenReturn(null);
when(options.getPlaceholderRes()).thenReturn(RES_ID);
result = mHierarcher.buildPlaceholderDrawable(mResources, options);
assertThat(result).isExactlyInstanceOf(RoundedColorDrawable.class);
}
use of com.facebook.fresco.vito.options.ImageOptions in project fresco by facebook.
the class HierarcherImplTest method testBuildOverlayRes_whenSet_thenReturnDrawable.
@Test
public void testBuildOverlayRes_whenSet_thenReturnDrawable() {
ImageOptions options = ImageOptions.create().overlayRes(RES_ID).build();
Drawable overlayDrawable = mHierarcher.buildOverlayDrawable(mResources, options);
assertThat(overlayDrawable).isEqualTo(mDrawable);
}
use of com.facebook.fresco.vito.options.ImageOptions in project fresco by facebook.
the class ImagePipelineUtilsImplTest method testBuildImageRequest_whenRoundAsCircleWithAntiAliasing_thenApplyRoundingParameters.
@Test
public void testBuildImageRequest_whenRoundAsCircleWithAntiAliasing_thenApplyRoundingParameters() {
final ImageOptions imageOptions = ImageOptions.create().round(RoundingOptions.asCircle(true)).build();
ImageRequest imageRequest = mImagePipelineUtils.buildImageRequest(URI, imageOptions);
assertThat(imageRequest).isNotNull();
assertThat(imageRequest.getSourceUri()).isEqualTo(URI);
ImageDecodeOptions imageDecodeOptions = imageRequest.getImageDecodeOptions();
assertThat(imageDecodeOptions).isEqualTo(mRoundingDecodeOptionsAntiAliased);
}
use of com.facebook.fresco.vito.options.ImageOptions in project fresco by facebook.
the class ImagePipelineUtilsImplTest method testBuildImageRequest_whenResizingEnabled_thenSetResizeOptions.
@Test
public void testBuildImageRequest_whenResizingEnabled_thenSetResizeOptions() {
ResizeOptions resizeOptions = ResizeOptions.forDimensions(123, 234);
final ImageOptions imageOptions = ImageOptions.create().resize(resizeOptions).build();
ImageRequest imageRequest = mImagePipelineUtils.buildImageRequest(URI, imageOptions);
assertThat(imageRequest).isNotNull();
assertThat(imageRequest.getSourceUri()).isEqualTo(URI);
assertThat(imageRequest.getResizeOptions()).isEqualTo(resizeOptions);
}
use of com.facebook.fresco.vito.options.ImageOptions in project fresco by facebook.
the class HierarcherImplTest method testBuildOverlayRes_whenUnset_thenReturnNull.
@Test
public void testBuildOverlayRes_whenUnset_thenReturnNull() {
ImageOptions options = ImageOptions.create().build();
Drawable overlayDrawable = mHierarcher.buildOverlayDrawable(mResources, options);
assertThat(overlayDrawable).isNull();
}
Aggregations