Goldens: three variants at 1x density (sv_light, sv_dark, en_light; D-098)

Drop the en_dark variant from every screenshot helper and render every
golden at mdpi (Robolectric qualifier w411dp-h<height>dp-mdpi instead of
xhdpi/xxhdpi), so a 411 x 891 dp screen is 411 x 891 px. All goldens
deleted and re-recorded; 1143 -> 865 PNGs. README describes the layout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TQd3pEP9UeN2uifbHknQ7B
This commit is contained in:
2026-10-18 21:24:30 +02:00
parent bfde12cead
commit 75b549fb4f
21 changed files with 42 additions and 36 deletions
+7 -1
View File
@@ -15,7 +15,7 @@ compile, unit tests (including every vector of `contracts/test-vectors/`), lint
| `:core:fakes` | `kvitt.android.library` | `FakeRepositories(scenario)`, `FakeScenarios.empty`; scenarios of feature X go in `fakes/<x>/` (added by M7a to M7f) |
| `:data` | `kvitt.android.library` + KSP + Room 3 | Room entities and `KvittDatabase` v1, schema in `data/schemas/`; M5 owns the module |
| `:adapter:fcm` | `kvitt.android.library` | shell; M8 owns it |
| `:feature:*` | `kvitt.android.feature` | screens built by M7a to M7f (landed 2026-10-18), goldens in `feature/<x>/src/test/screenshots/` (full screen 411 × 891 dp, xhdpi); top-level screens draw their own `KvittNavigationBar` (SPEC §13.2, D-071); M7g does the cleanups after M6b |
| `:feature:*` | `kvitt.android.feature` | screens built by M7a to M7f (landed 2026-10-18), goldens in `feature/<x>/src/test/screenshots/` (full screen 411 × 891 dp at 1x, D-098); top-level screens draw their own `KvittNavigationBar` (SPEC §13.2, D-071); M7g does the cleanups after M6b |
| `:app` | `kvitt.android.application` + compose + hilt + Roborazzi | Application, MainActivity, goldens in `app/src/test/screenshots/`; release binds `:data` (`DataBindingsModule`, `e6ad858`), debug binds the fakes in `src/debug/.../DebugFakesModule.kt` (`72f21b2`) until M8 deletes it; M8 owns the module |
## Architecture check
@@ -58,3 +58,9 @@ debug configuration, and, in `:core:model` and `:domain`, on an Android plugin,
Roborazzi on Robolectric. `roborazzi.test.verify=true` in `gradle.properties` makes every unit-test run compare with the
committed goldens. Re-record an intended change with `tools/gradle-serial.sh recordRoborazziDebug` and open every
changed PNG before committing.
Golden layout (D-098, revising D-066): three variants per state, `<name>_sv_light.png`, `<name>_sv_dark.png` and
`<name>_en_light.png` (English covers string length, dark covers the theme; there is no `en_dark`), plus
`<name>_sv_light_200.png` at 200 % font scale for the long states. Every capture renders at 1x density: the
Robolectric qualifier is `w411dp-h<height>dp-mdpi`, so the Galaxy S26 viewport of 411 × 891 dp is 411 × 891 px and a
golden is a true 1x render, not a downscaled one. `:app`'s `empty_screen_<light|dark>.png` are the only other names.
@@ -19,7 +19,7 @@ import se.hagstedt.kvitt.design.KvittTheme
*/
@RunWith(RobolectricTestRunner::class)
@GraphicsMode(GraphicsMode.Mode.NATIVE)
@Config(sdk = [36], qualifiers = "w411dp-h891dp-xxhdpi", application = Application::class)
@Config(sdk = [36], qualifiers = "w411dp-h891dp-mdpi", application = Application::class)
class KvittEmptyScreenScreenshotTest {
@get:Rule
val compose = createComposeRule()
@@ -17,7 +17,7 @@ import se.hagstedt.kvitt.design.catalogue.LargeFontSheets
*/
@RunWith(ParameterizedRobolectricTestRunner::class)
@GraphicsMode(GraphicsMode.Mode.NATIVE)
@Config(sdk = [36], qualifiers = "w411dp-h2400dp-xxhdpi")
@Config(sdk = [36], qualifiers = "w411dp-h2400dp-mdpi")
class ComponentScreenshotTest(private val sheet: String) {
@get:Rule
val compose = createComposeRule()
@@ -36,7 +36,7 @@ import java.util.Locale
import kotlin.time.Instant
/**
* Captures one golden per theme and language: `src/test/screenshots/<name>_<sv|en>_<light|dark>.png`, plus
* Captures three goldens (Swedish light and dark, English light; D-098): `src/test/screenshots/<name>_<sv_light|sv_dark|en_light>.png`, plus
* `<name>_sv_light_200.png` when `largeFont` is set (200 % font scale, Swedish and light, like the spec's 200 % frames).
* The content is set once; language (configuration, resources), theme and font scale (the platform's non-linear
* scaling, from a configuration context) switch between captures. Width: the Galaxy S26, 411 dp (SPEC §13.1). The
@@ -50,7 +50,7 @@ object Snapshots {
}
fun snap(compose: ComposeContentTestRule, name: String, largeFont: Boolean, content: @Composable ColumnScope.() -> Unit) {
val variants = listOf("sv", "en").flatMap { l -> listOf(false, true).map { Variant(l, it, 1f) } } +
val variants = listOf(Variant("sv", dark = false, fontScale = 1f), Variant("sv", dark = true, fontScale = 1f), Variant("en", dark = false, fontScale = 1f)) +
if (largeFont) listOf(Variant("sv", dark = false, fontScale = 2f)) else emptyList()
var current by mutableStateOf(variants.first())
compose.setContent {
@@ -30,13 +30,13 @@ import kotlin.time.Instant
/**
* Full-screen goldens of this module's screens, as M6's component snapshots but for whole screens (dialogs and menus
* included): `src/test/screenshots/<state>_<sv|en>_<light|dark>.png`, plus `<state>_sv_light_200.png` at 200 % font
* scale for the long states. The screen is the Galaxy S26 (411 × 891 dp), at xhdpi to keep the goldens small. The
* included): `src/test/screenshots/<state>_<sv_light|sv_dark|en_light>.png`, plus `<state>_sv_light_200.png` at 200 % font
* scale for the long states. The screen is the Galaxy S26 (411 × 891 dp), at mdpi (1x) to keep the goldens small (D-098). The
* clock is fixed at 17 October 2026 14:02 in Stockholm; the frame clock is advanced by hand so animations and
* snackbars render the same every run.
*/
object ScreenSnapshots {
const val QUALIFIERS = "w411dp-h891dp-xhdpi"
const val QUALIFIERS = "w411dp-h891dp-mdpi"
val clock = KvittClock.fixed(Instant.parse("2026-10-17T12:02:00Z"), TimeZone.of("Europe/Stockholm"))
private const val SETTLE_MILLIS = 1_000L
@@ -46,7 +46,7 @@ object ScreenSnapshots {
@OptIn(ExperimentalRoborazziApi::class)
fun snap(compose: ComposeContentTestRule, name: String, largeFont: Boolean, content: @Composable () -> Unit) {
val variants = listOf("sv", "en").flatMap { l -> listOf(false, true).map { Variant(l, it, 1f) } } +
val variants = listOf(Variant("sv", dark = false, fontScale = 1f), Variant("sv", dark = true, fontScale = 1f), Variant("en", dark = false, fontScale = 1f)) +
if (largeFont) listOf(Variant("sv", dark = false, fontScale = 2f)) else emptyList()
var current by mutableStateOf(variants.first())
compose.mainClock.autoAdvance = false
@@ -39,7 +39,7 @@ import se.hagstedt.kvitt.model.RangePreset
*/
@RunWith(ParameterizedRobolectricTestRunner::class)
@GraphicsMode(GraphicsMode.Mode.NATIVE)
@Config(sdk = [36], qualifiers = "w411dp-h891dp-xhdpi")
@Config(sdk = [36], qualifiers = "w411dp-h891dp-mdpi")
class AnalyticsScreenshotTest(private val name: String) {
@get:Rule
val compose = createComposeRule()
@@ -22,7 +22,7 @@ import se.hagstedt.kvitt.model.RangePreset
/** S-12 in every state of PLAN-M7e §5, × light/dark × sv/en (plus 200 % for long content). */
@RunWith(ParameterizedRobolectricTestRunner::class)
@GraphicsMode(GraphicsMode.Mode.NATIVE)
@Config(sdk = [36], qualifiers = "w411dp-h891dp-xhdpi")
@Config(sdk = [36], qualifiers = "w411dp-h891dp-mdpi")
class DrillDownScreenshotTest(private val name: String) {
@get:Rule
val compose = createComposeRule()
@@ -32,8 +32,8 @@ import java.util.Locale
import kotlin.time.Instant
/**
* Captures a whole screen (411 × 891 dp, the Galaxy S26 of SPEC §13.1) once per language and theme:
* `src/test/screenshots/<name>_<sv|en>_<light|dark>.png`, plus `<name>_sv_light_200.png` with [largeFont] (200 %,
* Captures a whole screen (411 × 891 dp, the Galaxy S26 of SPEC §13.1) in three variants (Swedish light and dark, English light; D-098):
* `src/test/screenshots/<name>_<sv_light|sv_dark|en_light>.png`, plus `<name>_sv_light_200.png` with [largeFont] (200 %,
* like the design spec's 200 % frames). The clock is the fakes' today (17 October 2026, 14:02 in Stockholm) and the
* viewer is Jacob. Language, theme and font scale switch through a configuration context, as in :core:design's tests;
* the content is recreated per variant so remembered state (scroll, picker) starts fresh.
@@ -46,7 +46,7 @@ object ScreenSnapshots {
}
fun snap(compose: ComposeContentTestRule, name: String, largeFont: Boolean = false, content: @Composable () -> Unit) {
val variants = listOf("sv", "en").flatMap { l -> listOf(false, true).map { Variant(l, it, 1f) } } +
val variants = listOf(Variant("sv", dark = false, fontScale = 1f), Variant("sv", dark = true, fontScale = 1f), Variant("en", dark = false, fontScale = 1f)) +
if (largeFont) listOf(Variant("sv", dark = false, fontScale = 2f)) else emptyList()
var current by mutableStateOf(variants.first())
compose.setContent {
@@ -15,7 +15,7 @@ import org.robolectric.annotation.GraphicsMode
*/
@RunWith(ParameterizedRobolectricTestRunner::class)
@GraphicsMode(GraphicsMode.Mode.NATIVE)
@Config(sdk = [36], qualifiers = "w411dp-h891dp-xxhdpi")
@Config(sdk = [36], qualifiers = "w411dp-h891dp-mdpi")
class ExpenseScreenshotTest(private val name: String) {
@get:Rule
val compose = createComposeRule()
@@ -36,7 +36,7 @@ class ExpenseScreenshotTest(private val name: String) {
/** Long content on a tall frame (411 × 1600 dp) so the whole screen, including a long timeline, is in the golden. */
@RunWith(ParameterizedRobolectricTestRunner::class)
@GraphicsMode(GraphicsMode.Mode.NATIVE)
@Config(sdk = [36], qualifiers = "w411dp-h1600dp-xxhdpi")
@Config(sdk = [36], qualifiers = "w411dp-h1600dp-mdpi")
class ExpenseTallScreenshotTest(private val name: String) {
@get:Rule
val compose = createComposeRule()
@@ -31,7 +31,7 @@ import java.util.Locale
import kotlin.time.Instant
/**
* Captures one golden per language and theme of a whole screen: `src/test/screenshots/<name>_<sv|en>_<light|dark>.png`,
* Captures three goldens of a whole screen (Swedish light and dark, English light; D-098): `src/test/screenshots/<name>_<sv_light|sv_dark|en_light>.png`,
* plus `<name>_sv_light_200.png` when `largeFont` is set (200 % font scale, Swedish and light, as the spec's 200 %
* frames). The pattern of `:core:design` (M6): content set once, language, theme and font scale switched through a
* configuration context between captures.
@@ -45,7 +45,7 @@ object ScreenSnapshots {
}
fun snap(compose: ComposeContentTestRule, name: String, largeFont: Boolean = false, content: @Composable () -> Unit) {
val variants = listOf("sv", "en").flatMap { l -> listOf(false, true).map { Variant(l, it, 1f) } } +
val variants = listOf(Variant("sv", dark = false, fontScale = 1f), Variant("sv", dark = true, fontScale = 1f), Variant("en", dark = false, fontScale = 1f)) +
if (largeFont) listOf(Variant("sv", dark = false, fontScale = 2f)) else emptyList()
var current by mutableStateOf(variants.first())
compose.setContent {
@@ -30,13 +30,13 @@ import kotlin.time.Instant
/**
* Full-screen goldens of this module's screens, as M6's component snapshots but for whole screens (dialogs and menus
* included): `src/test/screenshots/<state>_<sv|en>_<light|dark>.png`, plus `<state>_sv_light_200.png` at 200 % font
* scale for the long states. The screen is the Galaxy S26 (411 × 891 dp), at xhdpi to keep the goldens small. The
* included): `src/test/screenshots/<state>_<sv_light|sv_dark|en_light>.png`, plus `<state>_sv_light_200.png` at 200 % font
* scale for the long states. The screen is the Galaxy S26 (411 × 891 dp), at mdpi (1x) to keep the goldens small (D-098). The
* clock is fixed at 17 October 2026 14:02 in Stockholm; the frame clock is advanced by hand so animations and
* snackbars render the same every run.
*/
object ScreenSnapshots {
const val QUALIFIERS = "w411dp-h891dp-xhdpi"
const val QUALIFIERS = "w411dp-h891dp-mdpi"
val clock = KvittClock.fixed(Instant.parse("2026-10-17T12:02:00Z"), TimeZone.of("Europe/Stockholm"))
private const val SETTLE_MILLIS = 1_000L
@@ -46,7 +46,7 @@ object ScreenSnapshots {
@OptIn(ExperimentalRoborazziApi::class)
fun snap(compose: ComposeContentTestRule, name: String, largeFont: Boolean, content: @Composable () -> Unit) {
val variants = listOf("sv", "en").flatMap { l -> listOf(false, true).map { Variant(l, it, 1f) } } +
val variants = listOf(Variant("sv", dark = false, fontScale = 1f), Variant("sv", dark = true, fontScale = 1f), Variant("en", dark = false, fontScale = 1f)) +
if (largeFont) listOf(Variant("sv", dark = false, fontScale = 2f)) else emptyList()
var current by mutableStateOf(variants.first())
compose.mainClock.autoAdvance = false
@@ -23,7 +23,7 @@ import org.robolectric.annotation.GraphicsMode
@OptIn(ExperimentalCoroutinesApi::class)
@RunWith(ParameterizedRobolectricTestRunner::class)
@GraphicsMode(GraphicsMode.Mode.NATIVE)
@Config(sdk = [36], qualifiers = "w411dp-h891dp-xxhdpi")
@Config(sdk = [36], qualifiers = "w411dp-h891dp-mdpi")
class OnboardingScreenshotTest(private val name: String) {
@get:Rule
val compose = createComposeRule()
@@ -27,7 +27,7 @@ import java.util.Locale
import kotlin.time.Instant
/**
* Captures a whole screen once per theme and language: `src/test/screenshots/<name>_<sv|en>_<light|dark>.png`, plus
* Captures a whole screen in three variants (Swedish light and dark, English light; D-098): `src/test/screenshots/<name>_<sv_light|sv_dark|en_light>.png`, plus
* `<name>_sv_light_200.png` when `largeFont` is set (200 % font scale, Swedish, light), as `:core:design`'s Snapshots
* do for components. The phone is the Galaxy S26 (411 dp wide, SPEC §13.1); the clock is fixed at 17 October 2026
* 14:02 in Stockholm so every render is reproducible.
@@ -40,7 +40,7 @@ object ScreenSnapshots {
}
fun snap(compose: ComposeContentTestRule, name: String, largeFont: Boolean, content: @Composable () -> Unit) {
val variants = listOf("sv", "en").flatMap { l -> listOf(false, true).map { Variant(l, it, 1f) } } +
val variants = listOf(Variant("sv", dark = false, fontScale = 1f), Variant("sv", dark = true, fontScale = 1f), Variant("en", dark = false, fontScale = 1f)) +
if (largeFont) listOf(Variant("sv", dark = false, fontScale = 2f)) else emptyList()
var current by mutableStateOf(variants.first())
compose.setContent {
@@ -27,7 +27,7 @@ import se.hagstedt.kvitt.model.OnlineResult
/** S-15 Categories, list and editor (design-spec S-15 and PLAN-M7f §5). */
@RunWith(ParameterizedRobolectricTestRunner::class)
@GraphicsMode(GraphicsMode.Mode.NATIVE)
@Config(sdk = [36], qualifiers = "w411dp-h914dp-xxhdpi")
@Config(sdk = [36], qualifiers = "w411dp-h914dp-mdpi")
class CategoriesScreenshotTest(private val state: String) {
@get:Rule
val compose = createComposeRule()
@@ -28,7 +28,7 @@ import se.hagstedt.kvitt.model.UpdateState
/** S-20 Devices, S-21 Invites and S-22 About (design-spec §4 and PLAN-M7f §5). */
@RunWith(ParameterizedRobolectricTestRunner::class)
@GraphicsMode(GraphicsMode.Mode.NATIVE)
@Config(sdk = [36], qualifiers = "w411dp-h914dp-xxhdpi")
@Config(sdk = [36], qualifiers = "w411dp-h914dp-mdpi")
class DevicesInvitesAboutScreenshotTest(private val state: String) {
@get:Rule
val compose = createComposeRule()
@@ -19,7 +19,7 @@ import se.hagstedt.kvitt.feature.settings.hub.SettingsHubViewModel
/** S-13 Settings hub: every state × sv/en × light/dark (design-spec S-13). */
@RunWith(ParameterizedRobolectricTestRunner::class)
@GraphicsMode(GraphicsMode.Mode.NATIVE)
@Config(sdk = [36], qualifiers = "w411dp-h914dp-xxhdpi")
@Config(sdk = [36], qualifiers = "w411dp-h914dp-mdpi")
class HubScreenshotTest(private val state: String) {
@get:Rule
val compose = createComposeRule()
@@ -20,7 +20,7 @@ import se.hagstedt.kvitt.model.OnlineResult
/** S-14 Profile (design-spec S-14 and PLAN-M7f §5). */
@RunWith(ParameterizedRobolectricTestRunner::class)
@GraphicsMode(GraphicsMode.Mode.NATIVE)
@Config(sdk = [36], qualifiers = "w411dp-h914dp-xxhdpi")
@Config(sdk = [36], qualifiers = "w411dp-h914dp-mdpi")
class ProfileScreenshotTest(private val state: String) {
@get:Rule
val compose = createComposeRule()
@@ -30,7 +30,7 @@ import se.hagstedt.kvitt.model.RecurringTemplate
/** S-19 Recurring expenses, list and editor (design-spec S-19 and PLAN-M7f §5). */
@RunWith(ParameterizedRobolectricTestRunner::class)
@GraphicsMode(GraphicsMode.Mode.NATIVE)
@Config(sdk = [36], qualifiers = "w411dp-h914dp-xxhdpi")
@Config(sdk = [36], qualifiers = "w411dp-h914dp-mdpi")
class RecurringScreenshotTest(private val state: String) {
@get:Rule
val compose = createComposeRule()
@@ -39,8 +39,8 @@ import java.util.Locale
import kotlin.time.Instant
/**
* Whole-screen goldens of `:feature:settings` (M7f), following `:core:design`'s pattern: one capture per language and
* theme, `src/test/screenshots/<name>_<sv|en>_<light|dark>.png`. The screen (Robolectric `w411dp-h914dp`, the Galaxy
* Whole-screen goldens of `:feature:settings` (M7f), following `:core:design`'s pattern: three captures (Swedish light and
* dark, English light; D-098), `src/test/screenshots/<name>_<sv_light|sv_dark|en_light>.png`. The screen (Robolectric `w411dp-h914dp`, the Galaxy
* S26) is captured with its dialogs. Content is set once; language and theme switch through a configuration context.
* The clock is 17 October 2026 14:02 Stockholm, as in the fakes' scenarios.
*/
@@ -56,7 +56,7 @@ object ScreenSnapshots {
@OptIn(ExperimentalRoborazziApi::class)
fun snap(compose: ComposeContentTestRule, name: String, picture: Boolean = false, prepare: (ComposeContentTestRule) -> Unit = {}, content: @Composable () -> Unit) {
val variants = listOf("sv", "en").flatMap { l -> listOf(false, true).map { Variant(l, it) } }
val variants = listOf(Variant("sv", dark = false), Variant("sv", dark = true), Variant("en", dark = false))
var current by mutableStateOf(variants.first())
compose.setContent {
val variant = current
@@ -39,7 +39,7 @@ import java.util.Locale
import kotlin.time.Instant
/**
* Captures a whole screen once per theme and language: `src/test/screenshots/<name>_<sv|en>_<light|dark>.png`, plus
* Captures a whole screen in three variants (Swedish light and dark, English light; D-098): `src/test/screenshots/<name>_<sv_light|sv_dark|en_light>.png`, plus
* `<name>_sv_light_200.png` with [largeFont] (200 % font scale, Swedish, light, like the spec's 200 % frames). Pattern
* of `:core:design`'s `Snapshots` (M6): content set once, configuration switched between captures. The screen is the
* Galaxy S26's 411 dp wide and [height] high; the clock is fixed at 17 October 2026 14:02 in Stockholm.
@@ -71,7 +71,7 @@ object ScreenSnapshots {
}
fun snap(compose: ComposeContentTestRule, name: String, height: Dp = PHONE_HEIGHT, largeFont: Boolean = false, content: @Composable BoxScope.() -> Unit) {
val variants = listOf("sv", "en").flatMap { l -> listOf(false, true).map { Variant(l, it, 1f) } } +
val variants = listOf(Variant("sv", dark = false, fontScale = 1f), Variant("sv", dark = true, fontScale = 1f), Variant("en", dark = false, fontScale = 1f)) +
if (largeFont) listOf(Variant("sv", dark = false, fontScale = 2f)) else emptyList()
var current by mutableStateOf(variants.first())
compose.setContent {
@@ -84,7 +84,7 @@ private val cases: Map<String, Case> = linkedMapOf(
@RunWith(ParameterizedRobolectricTestRunner::class)
@GraphicsMode(GraphicsMode.Mode.NATIVE)
@Config(sdk = [36], qualifiers = "w411dp-h2400dp-xxhdpi")
@Config(sdk = [36], qualifiers = "w411dp-h2400dp-mdpi")
class SettleScreenshotTest(private val name: String) {
@get:Rule
val compose = createComposeRule()