Skip to content

Commit

Permalink
Fix largeHeif test on API 33. (#1488)
Browse files Browse the repository at this point in the history
  • Loading branch information
colinrtwhite authored Oct 1, 2022
1 parent 0a0fef6 commit 456d1fc
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,13 @@ class BitmapFactoryDecoderTest {

/** Regression test: https://github.com/coil-kt/coil/issues/619 */
@Test
fun heicExifMetadata() = runTest {
// HEIC files are not supported before API 30.
fun heifExifMetadata() = runTest {
// HEIF files are not supported before API 30.
assumeTrue(SDK_INT >= 30)

// Ensure this completes and doesn't end up in an infinite loop.
val normal = context.decodeBitmapAsset("exif/basic.heic")
val actual = decodeBitmap("exif/basic.heic", Size.ORIGINAL)
val normal = context.decodeBitmapAsset("exif/basic.heif")
val actual = decodeBitmap("exif/basic.heif", Size.ORIGINAL)
normal.assertIsSimilarTo(actual)
}

Expand Down Expand Up @@ -324,31 +324,31 @@ class BitmapFactoryDecoderTest {
}

@Test
fun largeHeic() = runTest {
// HEIC files are not supported before API 30.
fun largeHeif() = runTest {
// HEIF files are not supported before API 30.
assumeTrue(SDK_INT >= 30)

decodeBitmap("large.heic", Size(1080, 1920))
decodeBitmap("large.heif", Size(1080, 1920))
}

private suspend fun decodeBitmap(
assetName: String,
size: Size,
scale: Scale = Scale.FILL,
factory: BitmapFactoryDecoder.Factory = this.decoderFactory
factory: BitmapFactoryDecoder.Factory = decoderFactory
): Bitmap = assertIs<BitmapDrawable>(decode(assetName, size, scale, factory).drawable).bitmap

private suspend fun decodeBitmap(
assetName: String,
options: Options,
factory: BitmapFactoryDecoder.Factory = this.decoderFactory
factory: BitmapFactoryDecoder.Factory = decoderFactory
): Bitmap = assertIs<BitmapDrawable>(decode(assetName, options, factory).drawable).bitmap

private suspend fun decode(
assetName: String,
size: Size,
scale: Scale = Scale.FILL,
factory: BitmapFactoryDecoder.Factory = this.decoderFactory
factory: BitmapFactoryDecoder.Factory = decoderFactory
): DecodeResult = decode(assetName, Options(context, size = size, scale = scale), factory)

private suspend fun decode(
Expand Down
File renamed without changes.
Binary file removed coil-test/src/main/assets/large.heic
Binary file not shown.
Binary file added coil-test/src/main/assets/large.heif
Binary file not shown.

0 comments on commit 456d1fc

Please sign in to comment.