Skip to content

Commit

Permalink
Update test image assets for branding. (#1244)
Browse files Browse the repository at this point in the history
  • Loading branch information
colinrtwhite committed Apr 20, 2022
1 parent efea134 commit 44b02cb
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 38 deletions.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 1 addition & 25 deletions coil-svg/src/androidTest/assets/instacart_logo.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
24 changes: 11 additions & 13 deletions coil-svg/src/androidTest/java/coil/decode/SvgDecoderTest.kt
Expand Up @@ -46,7 +46,7 @@ class SvgDecoderTest {

@Test
fun doesNotHandlePngMimeType() {
val result = context.assets.open("coil_logo_250.png").source().buffer()
val result = context.assets.open("coil_logo.png").source().buffer()
.asSourceResult(mimeType = "image/png")
assertNull(decoderFactory.create(result, Options(context), ImageLoader(context)))
}
Expand Down Expand Up @@ -82,13 +82,13 @@ class SvgDecoderTest {
var source = context.assets.open("coil_logo.svg").source().buffer()
assertNotNull(decoderFactory.create(source.asSourceResult(), options, imageLoader))

source = context.assets.open("coil_logo_250.png").source().buffer()
source = context.assets.open("coil_logo.png").source().buffer()
assertNull(decoderFactory.create(source.asSourceResult(), options, imageLoader))

source = context.assets.open("instacart_logo.svg").source().buffer()
assertNotNull(decoderFactory.create(source.asSourceResult(), options, imageLoader))

source = context.assets.open("instacart_logo_326.png").source().buffer()
source = context.assets.open("instacart_logo.png").source().buffer()
assertNull(decoderFactory.create(source.asSourceResult(), options, imageLoader))
}

Expand All @@ -111,7 +111,7 @@ class SvgDecoderTest {
assertTrue(result.isSampled)
val drawable = assertIs<BitmapDrawable>(result.drawable)

val expected = context.decodeBitmapAsset("coil_logo_250.png")
val expected = context.decodeBitmapAsset("coil_logo.png")
drawable.bitmap.assertIsSimilarTo(expected)
}

Expand All @@ -120,7 +120,7 @@ class SvgDecoderTest {
val source = context.assets.open("instacart_logo.svg").source().buffer()
val options = Options(
context = context,
size = Size(326, 50),
size = Size(600, 96),
scale = Scale.FILL
)
val result = assertNotNull(
Expand All @@ -134,18 +134,16 @@ class SvgDecoderTest {
assertTrue(result.isSampled)
val drawable = assertIs<BitmapDrawable>(result.drawable)

val expected = context.decodeBitmapAsset("instacart_logo_326.png")
val expected = context.decodeBitmapAsset("instacart_logo.png")
drawable.bitmap.assertIsSimilarTo(expected)
}

private fun BufferedSource.asSourceResult(
mimeType: String? = null,
dataSource: DataSource = DataSource.DISK
): SourceResult {
return SourceResult(
source = ImageSource(this, context),
mimeType = mimeType,
dataSource = dataSource
)
}
) = SourceResult(
source = ImageSource(this, context),
mimeType = mimeType,
dataSource = dataSource
)
}

0 comments on commit 44b02cb

Please sign in to comment.