package com.cottondb.story import androidx.activity.ComponentActivity import androidx.compose.ui.test.junit4.createAndroidComposeRule import androidx.core.view.WindowCompat import com.cottondb.shell.FaceBars import org.junit.Assert.assertFalse import org.junit.Assert.assertTrue import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner import org.robolectric.annotation.Config /** * Story's status bar (the old-look pass, 22 Nov 2026, emulator-5554, by day and at night): Story keeps its one light * Ink look, but the clock, signal and battery were drawn white on its pale sheet, hardly readable (the app stands on the * shell's blank ground, which set light icons). Story's surface now sets the bars by its own sheet: dark icons, day or * night, as Days' does (DaysBarsTest). */ @RunWith(RobolectricTestRunner::class) @Config(sdk = [35], application = android.app.Application::class, qualifiers = "night") class StoryBarsTest { @get:Rule val compose = createAndroidComposeRule() private fun bars() = compose.activity.window.let { WindowCompat.getInsetsController(it, it.decorView) } /** RULE: Story's pale sheet takes dark icons. */ @Test fun the_sheet_takes_dark_icons() = assertFalse(barsDark()) @Test fun at_night_the_bars_stay_dark_on_the_sheet() { compose.setContent { androidx.compose.runtime.CompositionLocalProvider(com.cottondb.shell.LocalGround provides com.cottondb.shell.Ground.terrazzo) { FaceBars(dark = barsDark()) } } compose.waitForIdle() assertTrue("the clock went white on Story's pale sheet at night", bars().isAppearanceLightStatusBars) } /** RULE: Story's surface sets the bars from its sheet. */ @Test fun the_surface_sets_the_bars() { val repo = generateSequence(java.io.File("").absoluteFile) { it.parentFile }.first { java.io.File(it, "apps/registry.json").isFile } val surface = java.io.File(repo, "apps/android/app/src/story/kotlin/com/cottondb/story/StorySurface.kt").readText() assertTrue(surface.contains("FaceBars(dark = barsDark())")) } }