mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-11 07:29:14 +01:00
address review: keep one unbounded cover axis undefined instead of forcing a square
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package com.subtracks.ui.components
|
||||
|
||||
import android.content.Context
|
||||
import androidx.compose.ui.unit.IntSize
|
||||
import androidx.test.core.app.ApplicationProvider
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import com.subtracks.data.model.CoverArtRef
|
||||
@@ -16,12 +15,23 @@ class CoverArtRequestTest {
|
||||
val context = ApplicationProvider.getApplicationContext<Context>()
|
||||
val ref = CoverArtRef(url = "http://example.test/art", cacheKey = "1:art:false")
|
||||
|
||||
val request = imageRequest(context, ref, crossfade = false, size = IntSize(600, 800))
|
||||
val request = imageRequest(context, ref, crossfade = false, width = 600, height = 800)
|
||||
|
||||
assertEquals("1:art:false:600x800", request.memoryCacheKey)
|
||||
assertEquals(ref.cacheKey, request.diskCacheKey)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun oneUnboundedAxisIsNotForcedSquare() {
|
||||
val context = ApplicationProvider.getApplicationContext<Context>()
|
||||
val ref = CoverArtRef(url = "http://example.test/art", cacheKey = "1:art:false")
|
||||
|
||||
val request = imageRequest(context, ref, crossfade = false, width = 600)
|
||||
|
||||
assertEquals("1:art:false:600xu", request.memoryCacheKey)
|
||||
assertEquals(ref.cacheKey, request.diskCacheKey)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun unsizedRequestKeepsTheIdentityMemoryKey() {
|
||||
val context = ApplicationProvider.getApplicationContext<Context>()
|
||||
|
||||
Reference in New Issue
Block a user