Search in sources :

Example 1 with ImageOptionsDrawableFactory

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

the class BitmapDrawableFactoryTest method testCreateDrawable_whenRoundAsCircleAndJavaRounding_thenReturnRoundedBitmapDrawable.

@Test
public void testCreateDrawable_whenRoundAsCircleAndJavaRounding_thenReturnRoundedBitmapDrawable() {
    final CloseableStaticBitmap closeableImage = mock(CloseableStaticBitmap.class);
    final Bitmap bitmap = mock(Bitmap.class);
    when(closeableImage.getUnderlyingBitmap()).thenReturn(bitmap);
    final ImageOptions options = mock(ImageOptions.class);
    when(options.getRoundingOptions()).thenReturn(RoundingOptions.asCircle());
    ImageOptionsDrawableFactory factory = new BitmapDrawableFactory(mResources);
    Drawable drawable = factory.createDrawable(closeableImage, options);
    assertThat(drawable).isNotNull();
    assertThat(drawable).isInstanceOf(RoundedBitmapDrawable.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) ImageOptionsDrawableFactory(com.facebook.fresco.vito.options.ImageOptionsDrawableFactory) Test(org.junit.Test)

Aggregations

Bitmap (android.graphics.Bitmap)1 BitmapDrawable (android.graphics.drawable.BitmapDrawable)1 Drawable (android.graphics.drawable.Drawable)1 RoundedBitmapDrawable (com.facebook.drawee.drawable.RoundedBitmapDrawable)1 ImageOptions (com.facebook.fresco.vito.options.ImageOptions)1 ImageOptionsDrawableFactory (com.facebook.fresco.vito.options.ImageOptionsDrawableFactory)1 CloseableStaticBitmap (com.facebook.imagepipeline.image.CloseableStaticBitmap)1 Test (org.junit.Test)1