use of com.facebook.fresco.vito.options.ImageOptions in project fresco by facebook.
the class BitmapDrawableFactoryTest method testCreateDrawable_whenRoundWithCornerRadius_thenReturnBitmapDrawable.
@Test
public void testCreateDrawable_whenRoundWithCornerRadius_thenReturnBitmapDrawable() {
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.forCornerRadiusPx(123));
when(closeableImage.getExtras()).thenReturn(mImageExtrasNotRounded);
Drawable drawable = mDrawableFactory.createDrawable(closeableImage, options);
assertThat(drawable).isNotNull();
assertThat(drawable).isInstanceOf(RoundedBitmapDrawable.class);
assertThat(((RoundedBitmapDrawable) drawable).getRadii()).isEqualTo(new float[] { 123, 123, 123, 123, 123, 123, 123, 123 });
}
use of com.facebook.fresco.vito.options.ImageOptions 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);
}
use of com.facebook.fresco.vito.options.ImageOptions in project fresco by facebook.
the class BitmapDrawableFactoryTest method testCreateDrawable_whenImageIsStaticBitmap_thenReturnBitmapDrawable.
@Test
public void testCreateDrawable_whenImageIsStaticBitmap_thenReturnBitmapDrawable() {
final CloseableStaticBitmap closeableImage = mock(CloseableStaticBitmap.class);
final Bitmap bitmap = mock(Bitmap.class);
when(closeableImage.getUnderlyingBitmap()).thenReturn(bitmap);
final ImageOptions options = mock(ImageOptions.class);
Drawable drawable = mDrawableFactory.createDrawable(closeableImage, options);
assertThat(drawable).isNotNull();
assertThat(drawable).isInstanceOf(BitmapDrawable.class);
}
use of com.facebook.fresco.vito.options.ImageOptions in project fresco by facebook.
the class VitoImageRequestTest method testHashCode.
@Test
public void testHashCode() {
Resources res = mock(Resources.class);
ImageSource is = mock(ImageSource.class);
ImageOptions options = mock(ImageOptions.class);
VitoImageRequest a = new VitoImageRequest(res, is, options, null, null);
VitoImageRequest b = new VitoImageRequest(res, is, options, null, null);
assertThat(a.hashCode()).isEqualTo(b.hashCode());
}
use of com.facebook.fresco.vito.options.ImageOptions in project fresco by facebook.
the class VitoImageRequestTest method testEquals.
@Test
public void testEquals() {
Resources res = mock(Resources.class);
ImageSource is = mock(ImageSource.class);
ImageOptions options = mock(ImageOptions.class);
VitoImageRequest a = new VitoImageRequest(res, is, options, null, null);
VitoImageRequest b = new VitoImageRequest(res, is, options, null, null);
assertThat(a).isEqualTo(b);
}
Aggregations