Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix largeHeif test on API 33. #1488

Merged
merged 1 commit into from Oct 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
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.