Search in sources :

Example 31 with ImageOptions

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

the class BitmapDrawableFactoryTest method testCreateDrawable_whenRoundAsCircleAndNativeRounding_thenReturnBitmapDrawable.

@Test
public void testCreateDrawable_whenRoundAsCircleAndNativeRounding_thenReturnBitmapDrawable() {
    final CloseableStaticBitmap closeableImage = mock(CloseableStaticBitmap.class);
    final Bitmap bitmap = mock(Bitmap.class);
    when(closeableImage.getUnderlyingBitmap()).thenReturn(bitmap);
    when(closeableImage.getExtras()).thenReturn(mImageExtrasRounded);
    final ImageOptions options = mock(ImageOptions.class);
    when(options.getRoundingOptions()).thenReturn(RoundingOptions.asCircle());
    Drawable drawable = mDrawableFactory.createDrawable(closeableImage, options);
    assertThat(drawable).isNotNull();
    assertThat(drawable).isInstanceOf(BitmapDrawable.class);
}
Also used : Bitmap(android.graphics.Bitmap) CloseableStaticBitmap(com.facebook.imagepipeline.image.CloseableStaticBitmap) BitmapDrawable(android.graphics.drawable.BitmapDrawable) Drawable(android.graphics.drawable.Drawable) RoundedBitmapDrawable(com.facebook.drawee.drawable.RoundedBitmapDrawable) ImageOptions(com.facebook.fresco.vito.options.ImageOptions) CloseableStaticBitmap(com.facebook.imagepipeline.image.CloseableStaticBitmap) Test(org.junit.Test)

Example 32 with ImageOptions

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

the class BitmapDrawableFactoryTest method testCreateDrawable_whenImageUnknown_thenReturnNull.

@Test
public void testCreateDrawable_whenImageUnknown_thenReturnNull() {
    final CloseableImage closeableImage = mock(CloseableImage.class);
    final ImageOptions options = mock(ImageOptions.class);
    Drawable drawable = mDrawableFactory.createDrawable(closeableImage, options);
    assertThat(drawable).isNull();
}
Also used : BitmapDrawable(android.graphics.drawable.BitmapDrawable) Drawable(android.graphics.drawable.Drawable) RoundedBitmapDrawable(com.facebook.drawee.drawable.RoundedBitmapDrawable) ImageOptions(com.facebook.fresco.vito.options.ImageOptions) CloseableImage(com.facebook.imagepipeline.image.CloseableImage) 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