Search in sources :

Example 76 with ImageRequest

use of com.facebook.imagepipeline.request.ImageRequest 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 77 with ImageRequest

use of com.facebook.imagepipeline.request.ImageRequest 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 78 with ImageRequest

use of com.facebook.imagepipeline.request.ImageRequest 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 79 with ImageRequest

use of com.facebook.imagepipeline.request.ImageRequest 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)

Example 80 with ImageRequest

use of com.facebook.imagepipeline.request.ImageRequest in project fresco by facebook.

the class ImagePipelineUtilsImplTest method testBuildImageRequest_whenUriNull_thenReturnNull.

@Test
public void testBuildImageRequest_whenUriNull_thenReturnNull() {
    ImageRequest imageRequest = mImagePipelineUtils.buildImageRequest(null, ImageOptions.defaults());
    assertThat(imageRequest).isNull();
}
Also used : ImageRequest(com.facebook.imagepipeline.request.ImageRequest) Test(org.junit.Test)

Aggregations

ImageRequest (com.facebook.imagepipeline.request.ImageRequest)100 ResizeOptions (com.facebook.imagepipeline.common.ResizeOptions)26 DraweeController (com.facebook.drawee.interfaces.DraweeController)25 CloseableReference (com.facebook.common.references.CloseableReference)24 Uri (android.net.Uri)18 ImagePipeline (com.facebook.imagepipeline.core.ImagePipeline)17 Test (org.junit.Test)14 Bitmap (android.graphics.Bitmap)13 CacheKey (com.facebook.cache.common.CacheKey)12 File (java.io.File)11 DataSource (com.facebook.datasource.DataSource)10 BaseBitmapDataSubscriber (com.facebook.imagepipeline.datasource.BaseBitmapDataSubscriber)9 CloseableImage (com.facebook.imagepipeline.image.CloseableImage)8 ImageRequestBuilder (com.facebook.imagepipeline.request.ImageRequestBuilder)8 Animatable (android.graphics.drawable.Animatable)7 PipelineDraweeController (com.facebook.drawee.backends.pipeline.PipelineDraweeController)7 BaseControllerListener (com.facebook.drawee.controller.BaseControllerListener)7 ImageOptions (com.facebook.fresco.vito.options.ImageOptions)7 ImageInfo (com.facebook.imagepipeline.image.ImageInfo)7 EncodedImage (com.facebook.imagepipeline.image.EncodedImage)6