default to the Material You dark scheme instead of black and white

This commit is contained in:
austinried
2026-10-04 00:30:05 +00:00
parent 9adb81aae7
commit dff2fe58e0
9 changed files with 81 additions and 61 deletions
@@ -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)
}
}