use of android.graphics.Bitmap in project glide by bumptech.
the class GifDrawableTest method testDoesNotDrawFrameAfterRecycle.
@Test
public void testDoesNotDrawFrameAfterRecycle() {
Bitmap bitmap = Bitmap.createBitmap(100, 112341, Bitmap.Config.RGB_565);
drawable.setVisible(true, true);
drawable.start();
when(frameLoader.getCurrentFrame()).thenReturn(bitmap);
drawable.onFrameReady();
drawable.recycle();
Canvas canvas = mock(Canvas.class);
drawable.draw(canvas);
verify(canvas, never()).drawBitmap(eq(bitmap), isARect(), isARect(), isAPaint());
}
use of android.graphics.Bitmap in project glide by bumptech.
the class DownsamplerTest method testAlwaysArgb8888.
@Test
public void testAlwaysArgb8888() throws IOException {
Bitmap rgb565 = Bitmap.createBitmap(100, 100, Bitmap.Config.RGB_565);
InputStream stream = compressBitmap(rgb565, Bitmap.CompressFormat.JPEG);
options.set(Downsampler.DECODE_FORMAT, DecodeFormat.PREFER_ARGB_8888);
Resource<Bitmap> result = downsampler.decode(stream, 100, 100, options);
assertEquals(Bitmap.Config.ARGB_8888, result.get().getConfig());
}
use of android.graphics.Bitmap in project glide by bumptech.
the class DownsamplerTest method testPreferRgb565.
@Test
public void testPreferRgb565() throws IOException {
Bitmap rgb565 = Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888);
InputStream stream = compressBitmap(rgb565, Bitmap.CompressFormat.JPEG);
options.set(Downsampler.DECODE_FORMAT, DecodeFormat.PREFER_RGB_565);
Resource<Bitmap> result = downsampler.decode(stream, 100, 100, options);
assertEquals(Bitmap.Config.RGB_565, result.get().getConfig());
}
use of android.graphics.Bitmap in project glide by bumptech.
the class FitCenterTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
bitmapWidth = 100;
bitmapHeight = 100;
Bitmap bitmap = Bitmap.createBitmap(bitmapWidth, bitmapHeight, Bitmap.Config.ARGB_8888);
when(resource.get()).thenReturn(bitmap);
pool = new BitmapPoolAdapter();
fitCenter = new FitCenter(pool);
}
use of android.graphics.Bitmap in project glide by bumptech.
the class TransformationUtilsTest method testRotateImageExifReturnsGivenBitmapIfRotationIsUndefined.
@Test
public void testRotateImageExifReturnsGivenBitmapIfRotationIsUndefined() {
Bitmap toRotate = Bitmap.createBitmap(100, 100, Bitmap.Config.RGB_565);
// Use assertTrue because Robolectric incorrectly implements equality for Bitmaps. We want
// not just an identical Bitmap, but our original Bitmap object back.
Bitmap rotated = TransformationUtils.rotateImageExif(bitmapPool, toRotate, ExifInterface.ORIENTATION_UNDEFINED);
assertTrue(toRotate == rotated);
}
Aggregations