Search in sources :

Example 16 with ImageOptions

use of com.facebook.fresco.vito.options.ImageOptions in project fresco by facebook.

the class HierarcherImplTest method testBuildErrorDrawable_whenNotSet_thenReturnNopDrawable.

@Test
public void testBuildErrorDrawable_whenNotSet_thenReturnNopDrawable() {
    ImageOptions options = ImageOptions.create().build();
    Drawable errorDrawable = mHierarcher.buildErrorDrawable(mResources, options);
    assertThat(errorDrawable).isNull();
}
Also used : ColorDrawable(android.graphics.drawable.ColorDrawable) BitmapDrawable(android.graphics.drawable.BitmapDrawable) Drawable(android.graphics.drawable.Drawable) ScaleTypeDrawable(com.facebook.drawee.drawable.ScaleTypeDrawable) RoundedColorDrawable(com.facebook.drawee.drawable.RoundedColorDrawable) RoundedBitmapDrawable(com.facebook.drawee.drawable.RoundedBitmapDrawable) ImageOptions(com.facebook.fresco.vito.options.ImageOptions) Test(org.junit.Test)

Example 17 with ImageOptions

use of com.facebook.fresco.vito.options.ImageOptions in project fresco by facebook.

the class ImagePipelineUtilsImplTest method testBuildImageRequest_whenNoRoundingOptions_thenDoNotRound.

@Test
public void testBuildImageRequest_whenNoRoundingOptions_thenDoNotRound() {
    final ImageOptions imageOptions = ImageOptions.create().build();
    ImageRequest imageRequest = mImagePipelineUtils.buildImageRequest(URI, imageOptions);
    assertThat(imageRequest).isNotNull();
    assertThat(imageRequest.getSourceUri()).isEqualTo(URI);
    assertThat(imageRequest.getImageDecodeOptions()).isEqualTo(ImageDecodeOptions.defaults());
}
Also used : ImageRequest(com.facebook.imagepipeline.request.ImageRequest) ImageOptions(com.facebook.fresco.vito.options.ImageOptions) Test(org.junit.Test)

Example 18 with ImageOptions

use of com.facebook.fresco.vito.options.ImageOptions in project fresco by facebook.

the class ImagePipelineUtilsImplTest method testBuildImageRequest_whenRoundAsCircleAndRoundingDisabled_thenDoNothing.

@Test
public void testBuildImageRequest_whenRoundAsCircleAndRoundingDisabled_thenDoNothing() {
    final ImageOptions imageOptions = ImageOptions.create().round(RoundingOptions.asCircle()).build();
    ImageRequest imageRequest = mImagePipelineUtilsNoNativeRounding.buildImageRequest(URI, imageOptions);
    assertThat(imageRequest).isNotNull();
    assertThat(imageRequest.getSourceUri()).isEqualTo(URI);
    ImageDecodeOptions imageDecodeOptions = imageRequest.getImageDecodeOptions();
    assertThat(imageDecodeOptions).isEqualTo(ImageDecodeOptions.defaults());
}
Also used : ImageRequest(com.facebook.imagepipeline.request.ImageRequest) ImageOptions(com.facebook.fresco.vito.options.ImageOptions) ImageDecodeOptions(com.facebook.imagepipeline.common.ImageDecodeOptions) Test(org.junit.Test)

Example 19 with ImageOptions

use of com.facebook.fresco.vito.options.ImageOptions in project fresco by facebook.

the class ImagePipelineUtilsImplTest method testBuildImageRequest_whenRoundAsCircleWithAntiAliasingAndRoundingDisabled_thenDoNothing.

@Test
public void testBuildImageRequest_whenRoundAsCircleWithAntiAliasingAndRoundingDisabled_thenDoNothing() {
    final ImageOptions imageOptions = ImageOptions.create().round(RoundingOptions.asCircle(true)).build();
    ImageRequest imageRequest = mImagePipelineUtilsNoNativeRounding.buildImageRequest(URI, imageOptions);
    assertThat(imageRequest).isNotNull();
    assertThat(imageRequest.getSourceUri()).isEqualTo(URI);
    ImageDecodeOptions imageDecodeOptions = imageRequest.getImageDecodeOptions();
    assertThat(imageDecodeOptions).isEqualTo(ImageDecodeOptions.defaults());
}
Also used : ImageRequest(com.facebook.imagepipeline.request.ImageRequest) ImageOptions(com.facebook.fresco.vito.options.ImageOptions) ImageDecodeOptions(com.facebook.imagepipeline.common.ImageDecodeOptions) Test(org.junit.Test)

Example 20 with ImageOptions

use of com.facebook.fresco.vito.options.ImageOptions in project fresco by facebook.

the class ImagePipelineUtilsImplTest method testBuildImageRequest_whenRoundAsCircle_thenApplyRoundingParameters.

@Test
public void testBuildImageRequest_whenRoundAsCircle_thenApplyRoundingParameters() {
    final ImageOptions imageOptions = ImageOptions.create().round(RoundingOptions.asCircle()).build();
    ImageRequest imageRequest = mImagePipelineUtils.buildImageRequest(URI, imageOptions);
    assertThat(imageRequest).isNotNull();
    assertThat(imageRequest.getSourceUri()).isEqualTo(URI);
    ImageDecodeOptions imageDecodeOptions = imageRequest.getImageDecodeOptions();
    assertThat(imageDecodeOptions).isEqualTo(mRoundingDecodeOptions);
}
Also used : ImageRequest(com.facebook.imagepipeline.request.ImageRequest) ImageOptions(com.facebook.fresco.vito.options.ImageOptions) ImageDecodeOptions(com.facebook.imagepipeline.common.ImageDecodeOptions) Test(org.junit.Test)

Aggregations

ImageOptions (com.facebook.fresco.vito.options.ImageOptions)32 Test (org.junit.Test)32 BitmapDrawable (android.graphics.drawable.BitmapDrawable)21 Drawable (android.graphics.drawable.Drawable)21 RoundedBitmapDrawable (com.facebook.drawee.drawable.RoundedBitmapDrawable)21 ColorDrawable (android.graphics.drawable.ColorDrawable)14 RoundedColorDrawable (com.facebook.drawee.drawable.RoundedColorDrawable)14 ScaleTypeDrawable (com.facebook.drawee.drawable.ScaleTypeDrawable)14 Bitmap (android.graphics.Bitmap)8 ImageRequest (com.facebook.imagepipeline.request.ImageRequest)7 CloseableStaticBitmap (com.facebook.imagepipeline.image.CloseableStaticBitmap)6 ImageDecodeOptions (com.facebook.imagepipeline.common.ImageDecodeOptions)4 Resources (android.content.res.Resources)2 PointF (android.graphics.PointF)2 ImageSource (com.facebook.fresco.vito.source.ImageSource)2 BorderOptions (com.facebook.fresco.vito.options.BorderOptions)1 ImageOptionsDrawableFactory (com.facebook.fresco.vito.options.ImageOptionsDrawableFactory)1 ResizeOptions (com.facebook.imagepipeline.common.ResizeOptions)1 RotationOptions (com.facebook.imagepipeline.common.RotationOptions)1 CloseableImage (com.facebook.imagepipeline.image.CloseableImage)1