@SuppressWarnings("UnnecessaryBoxing") @Test public void loadVideoResourceId_fromInteger_decodesFrame() { Drawable frame = concurrency.get( Glide.with(context) .load(new Integer(ResourceIds.raw.video)) .submit()); assertThat(frame).isNotNull(); }
@Test public void loadVideoResourceId_fromInt_decodesFrame() { Drawable frame = concurrency.get( Glide.with(context) .load(ResourceIds.raw.video) .submit()); assertThat(frame).isNotNull(); }
@Test public void load_withShapeDrawableResourceId_asDrawable_producesNonNullDrawable() throws ExecutionException, InterruptedException { Drawable drawable = Glide.with(context) .load(ResourceIds.drawable.shape_drawable) .submit() .get(); assertThat(drawable).isNotNull(); }
@Test public void load_withStateListDrawableResourceId_asDrawable_producesNonNullDrawable() throws ExecutionException, InterruptedException { Drawable drawable = Glide.with(context) .load(ResourceIds.drawable.state_list_drawable) .submit() .get(); assertThat(drawable).isNotNull(); }
@Override public void run() throws Throwable { Glide.with(context) .load(ResourceIds.drawable.shape_drawable) .apply(centerCropTransform()) .submit() .get(); } });
@Test public void loadBitmap_asBytes_providesBytesOfBitmap() { Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), ResourceIds.raw.canonical); byte[] data = concurrency.get( Glide.with(context) .as(byte[].class) .load(bitmap) .submit()); assertThat(data).isNotNull(); assertThat(BitmapFactory.decodeByteArray(data, 0, data.length)).isNotNull(); }
@Test public void load_withShapeDrawableResourceId_asDrawable_withTransformation_validSize_succeeds() throws ExecutionException, InterruptedException { Drawable drawable = Glide.with(context) .load(ResourceIds.drawable.shape_drawable) .apply(bitmapTransform(new RoundedCorners(10))) .submit(100, 200) .get(); assertThat(drawable).isNotNull(); assertThat(drawable.getIntrinsicWidth()).isEqualTo(100); assertThat(drawable.getIntrinsicHeight()).isEqualTo(200); }
@Test public void load_withStateListDrawableResourceId_asDrawable_withTransformation_nonNullDrawable() throws ExecutionException, InterruptedException { Drawable drawable = Glide.with(context) .load(ResourceIds.drawable.state_list_drawable) .apply(centerCropTransform()) .submit() .get(); assertThat(drawable).isNotNull(); }
@Test public void load_withVectorDrawableResourceId_asDrawable_withTransformation_nonNullDrawable() throws ExecutionException, InterruptedException { Drawable drawable = Glide.with(context) .load(ResourceIds.drawable.vector_drawable) .apply(centerCropTransform()) .submit() .get(); assertThat(drawable).isNotNull(); }
@Test public void load_withBitmapAliasResourceId_asDrawable_withTransformation_producesNonNullDrawable() throws ExecutionException, InterruptedException { Drawable drawable = Glide.with(context) .load(ResourceIds.drawable.bitmap_alias) .apply(centerCropTransform()) .submit() .get(); assertThat(drawable).isNotNull(); }
@Test public void load_withWideGamutImage_returnsWideGamutBitmap() { Bitmap bitmap = concurrency.get( Glide.with(context) .asBitmap() .load(ResourceIds.raw.webkit_logo_p3) .submit()); assertThat(bitmap.getConfig()).isEqualTo(Bitmap.Config.RGBA_F16); }
@Test public void loadVideoFilePath_asBytes_providesByteOfFrame() throws IOException { byte[] data = concurrency.get( Glide.with(context) .as(byte[].class) .load(writeVideoToFile().getAbsolutePath()) .submit()); assertThat(data).isNotNull(); assertThat(BitmapFactory.decodeByteArray(data, 0, data.length)).isNotNull(); }
@Test public void loadVideoResourceId_asBitmap_decodesFrame() { Bitmap frame = concurrency.get( Glide.with(context) .asBitmap() .load(ResourceIds.raw.video) .submit()); assertThat(frame).isNotNull(); }
@Test public void load_withBitmapAliasResourceId_asBitmap_producesNonNullBitmap() throws ExecutionException, InterruptedException { Bitmap bitmap = Glide.with(context) .asBitmap() .load(ResourceIds.drawable.bitmap_alias) .submit() .get(); assertThat(bitmap).isNotNull(); }
@Test public void load_withBitmapResourceId_asBitmap_producesNonNullBitmap() throws ExecutionException, InterruptedException { Bitmap bitmap = Glide.with(context) .asBitmap() .load(android.R.drawable.star_big_off) .submit() .get(); assertThat(bitmap).isNotNull(); }
@Test public void load_withJpegAsDataUriString_returnsBitmap() { Bitmap bitmap = concurrency.get( Glide.with(context) .asBitmap() .load(getDataUriString(CompressFormat.JPEG)) .submit()); assertThat(bitmap).isNotNull(); }
@Test public void load_withPngAsDataUri_returnsBitmap() { Bitmap bitmap = concurrency.get( Glide.with(context) .asBitmap() .load(getDataUri(CompressFormat.PNG)) .submit()); assertThat(bitmap).isNotNull(); }
@Test public void load_withPngDataUriString_returnsBitmap() { Bitmap bitmap = concurrency.get( Glide.with(context) .asBitmap() .load(getDataUriString(CompressFormat.PNG)) .submit()); assertThat(bitmap).isNotNull(); }
@Test public void load_withJpegAsDataUri_returnsBitmap() { Bitmap bitmap = concurrency.get( Glide.with(context) .asBitmap() .load(getDataUri(CompressFormat.JPEG)) .submit()); assertThat(bitmap).isNotNull(); }
@Test public void loadTransparentGifResource_withNoOtherLoaders_fromBytes_decodesResource() { byte[] data = getBytes(ResourceIds.raw.transparent_gif); Bitmap bitmap = concurrency.get( Glide.with(context) .asBitmap() .load(data) .submit()); assertThat(bitmap).isNotNull(); }