mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-10 23:21:59 +01:00
default to the Material You dark scheme instead of black and white
This commit is contained in:
@@ -68,7 +68,9 @@ class ArtworkExtractionTest {
|
||||
val ref = CoverArtRef(url = "art", cacheKey = "art")
|
||||
var colors: ArtworkColors? = null
|
||||
composeRule.setContent {
|
||||
colors = rememberArtworkColors(ref)
|
||||
SubtracksTheme {
|
||||
colors = rememberArtworkColors(ref)
|
||||
}
|
||||
}
|
||||
composeRule.waitUntil(timeoutMillis = 5_000) { colors != null }
|
||||
assertNotNull(colors)
|
||||
@@ -99,15 +101,18 @@ class ArtworkExtractionTest {
|
||||
val artwork = mutableStateOf<ArtworkColors?>(null)
|
||||
val seen = mutableListOf<androidx.compose.ui.graphics.Color>()
|
||||
composeRule.setContent {
|
||||
val colors = rememberAnimatedArtworkColors(artwork.value)
|
||||
SideEffect { seen += colors.scheme.background }
|
||||
SubtracksTheme {
|
||||
val colors = rememberAnimatedArtworkColors(artwork.value, baseArtworkColors())
|
||||
SideEffect { seen += colors.scheme.background }
|
||||
}
|
||||
}
|
||||
composeRule.waitForIdle()
|
||||
val baseBackground = seen.first()
|
||||
|
||||
composeRule.runOnIdle { artwork.value = target }
|
||||
composeRule.waitForIdle()
|
||||
|
||||
val firstPainting = seen.first { it != baseArtworkColors.scheme.background }
|
||||
val firstPainting = seen.first { it != baseBackground }
|
||||
assertEquals(target.scheme.background, firstPainting)
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.subtracks.ui.theme
|
||||
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.compose.material3.ColorScheme
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.test.junit4.v2.createAndroidComposeRule
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import org.junit.Assert.assertNotEquals
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class ThemeTest {
|
||||
@get:Rule
|
||||
val composeRule = createAndroidComposeRule<ComponentActivity>()
|
||||
|
||||
@Test
|
||||
fun defaultSchemeIsNotMonochrome() {
|
||||
var scheme: ColorScheme? = null
|
||||
composeRule.setContent {
|
||||
SubtracksTheme {
|
||||
scheme = MaterialTheme.colorScheme
|
||||
}
|
||||
}
|
||||
val resolved = requireNotNull(scheme)
|
||||
assertNotEquals(Color.White, resolved.primary)
|
||||
assertNotEquals(Color.Black, resolved.background)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user