From d4af37937a068a52fa91d732ca96cf0ef4d6268e Mon Sep 17 00:00:00 2001 From: Kurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com> Date: Thu, 19 Nov 2026 19:12:10 -0500 Subject: [PATCH] feat(ui): Steam Deck menu icons, and Compose previews rendered to PNGs (#2900) * Rail and second-screen icons in the Steam Deck menu's style Solid icons throughout the rail, and Steam's glyphs where Steam has the same place: Library is the four-square grid, Stores the price tag, Downloads the download arrow, Settings the gear. On the second screen, Screenshots uses Steam's Media picture and Chat its Friends people. * Compose previews of the launcher and the in-game menu, rendered to PNGs Debug-only previews of the launcher on each tab and the in-game menu's pages, built from the production composables with sample state and no-op actions, at the Duo's handheld size and in portrait. PreviewRenderTest draws each with Robolectric's native graphics into app/build/preview-renders/, so a UI change can be looked at without a device, and fails on a preview that throws or draws nothing. docs/compose-previews.md says how to run and extend them. * Preview renders wait for store accounts before drawing A preview case can name what the render test waits for. The Library and Stores cases wait for store accounts, which load on a background thread, so their PNGs never catch the loading state. * Preview renders step the paused clock while waiting for a case to be ready --- app/build.gradle | 2 + .../droiddeck/launcher/ui/LauncherPreviews.kt | 47 +++++++++++ .../droiddeck/launcher/ui/PreviewSupport.kt | 83 +++++++++++++++++++ .../com/droiddeck/launcher/ui/BottomPages.kt | 16 ++-- .../com/droiddeck/launcher/ui/FrontEndRail.kt | 53 ++++++------ .../droiddeck/launcher/ui/GameShelfIcon.kt | 17 ---- .../launcher/ui/PreviewRenderTest.kt | 63 ++++++++++++++ docs/compose-previews.md | 36 ++++++++ 8 files changed, 266 insertions(+), 51 deletions(-) create mode 100644 app/src/debug/java/com/droiddeck/launcher/ui/LauncherPreviews.kt create mode 100644 app/src/debug/java/com/droiddeck/launcher/ui/PreviewSupport.kt delete mode 100644 app/src/main/java/com/droiddeck/launcher/ui/GameShelfIcon.kt create mode 100644 app/src/testDebug/java/com/droiddeck/launcher/ui/PreviewRenderTest.kt create mode 100644 docs/compose-previews.md diff --git a/app/build.gradle b/app/build.gradle index cb5b882ec..c271f963b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -388,6 +388,8 @@ dependencies { implementation 'androidx.compose.material3:material3' implementation 'androidx.compose.ui:ui-tooling-preview' debugImplementation 'androidx.compose.ui:ui-tooling' + // Declares the ComponentActivity that createComposeRule launches, for PreviewRenderTest. + debugImplementation 'androidx.compose.ui:ui-test-manifest' implementation 'androidx.activity:activity-compose:1.8.2' implementation 'androidx.compose.material:material-icons-extended' implementation 'io.coil-kt:coil-compose:2.6.0' diff --git a/app/src/debug/java/com/droiddeck/launcher/ui/LauncherPreviews.kt b/app/src/debug/java/com/droiddeck/launcher/ui/LauncherPreviews.kt new file mode 100644 index 000000000..12c245122 --- /dev/null +++ b/app/src/debug/java/com/droiddeck/launcher/ui/LauncherPreviews.kt @@ -0,0 +1,47 @@ +package com.droiddeck.launcher.ui + +import androidx.compose.runtime.Composable + +/** The launcher as a whole: rail and page, opened on each tab through FrontEndState.navigate. */ +@Composable +private fun Launcher(tab: String, games: List = sampleGames, ready: Boolean = true) = + PreviewHost { FrontEndScreen(sampleState(games = games, navigate = tab, ready = ready), sampleActions) } + +@DroidDeckPreviews @Composable private fun SteamTabPreview() = Launcher("steam") +@DroidDeckPreviews @Composable private fun LibraryPreview() = Launcher("games") +@DroidDeckPreviews @Composable private fun LibraryEmptyPreview() = Launcher("games", games = emptyList()) +@DroidDeckPreviews @Composable private fun StoresPreview() = Launcher("stores") +@DroidDeckPreviews @Composable private fun DownloadsPreview() = Launcher("downloads") +@DroidDeckPreviews @Composable private fun SettingsPreview() = Launcher("setup") +@DroidDeckPreviews @Composable private fun RuntimeMissingPreview() = Launcher("setup", ready = false) + +/** The in-game menu on one page, as a session shows it. */ +@Composable +private fun SessionMenu(page: SessionDrawerPage, steam: Boolean = true, desktop: Boolean = false) = PreviewHost { + SessionDrawer(true, page, controllerActive = true, onPageChange = {}, a = sampleDrawerActions(steam, desktop)) +} + +@DroidDeckPreviews @Composable private fun SessionMenuControllerPreview() = SessionMenu(SessionDrawerPage.CONTROLLER) +@DroidDeckPreviews @Composable private fun SessionMenuDisplayPreview() = SessionMenu(SessionDrawerPage.DISPLAY) +@DroidDeckPreviews @Composable private fun SessionMenuHudPreview() = SessionMenu(SessionDrawerPage.HUD) +@DroidDeckPreviews @Composable private fun SessionMenuSessionPreview() = SessionMenu(SessionDrawerPage.SESSION) +@DroidDeckPreviews @Composable private fun SessionMenuDesktopPreview() = SessionMenu(SessionDrawerPage.CONTROLLER, steam = false, desktop = true) + +/** The Library and Stores tabs read store accounts, which load on a background thread. */ +private val storesLoaded = { com.droiddeck.launcher.stores.StoresState.accountsLoaded } + +/** Every preview above, for the render test. Add a case when adding a preview. */ +internal val previewCases: List = listOf( + PreviewCase("steam-tab") { Launcher("steam") }, + PreviewCase("library", storesLoaded) { Launcher("games") }, + PreviewCase("library-empty", storesLoaded) { Launcher("games", games = emptyList()) }, + PreviewCase("stores", storesLoaded) { Launcher("stores") }, + PreviewCase("downloads") { Launcher("downloads") }, + PreviewCase("settings") { Launcher("setup") }, + PreviewCase("runtime-missing") { Launcher("setup", ready = false) }, + PreviewCase("session-menu-controller") { SessionMenu(SessionDrawerPage.CONTROLLER) }, + PreviewCase("session-menu-display") { SessionMenu(SessionDrawerPage.DISPLAY) }, + PreviewCase("session-menu-hud") { SessionMenu(SessionDrawerPage.HUD) }, + PreviewCase("session-menu-session") { SessionMenu(SessionDrawerPage.SESSION) }, + PreviewCase("session-menu-desktop") { SessionMenu(SessionDrawerPage.CONTROLLER, steam = false, desktop = true) }, +) diff --git a/app/src/debug/java/com/droiddeck/launcher/ui/PreviewSupport.kt b/app/src/debug/java/com/droiddeck/launcher/ui/PreviewSupport.kt new file mode 100644 index 000000000..4e8ae8094 --- /dev/null +++ b/app/src/debug/java/com/droiddeck/launcher/ui/PreviewSupport.kt @@ -0,0 +1,83 @@ +package com.droiddeck.launcher.ui + +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.material3.MaterialTheme +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.tooling.preview.Preview +import com.droiddeck.launcher.frontend.Library +import com.droiddeck.launcher.gpu.FrameGen +import com.droiddeck.launcher.gpu.Lossless +import com.droiddeck.launcher.input.SecondScreenMode +import com.droiddeck.launcher.session.SessionPrefs + +/** + * Debug-only support for Compose previews: the production theme around a screen, and sample state and no-op actions so + * production composables render without a device, a runtime or a network. See docs/compose-previews.md. + */ + +/** The sizes the previews come in. The Duo's top screen is 1920x1080 at xhdpi, i.e. 960x540 dp. */ +@Preview(name = "Handheld", widthDp = 960, heightDp = 540, device = "spec:width=960dp,height=540dp,dpi=320,orientation=landscape") +@Preview(name = "Portrait", widthDp = 540, heightDp = 960, device = "spec:width=540dp,height=960dp,dpi=320") +internal annotation class DroidDeckPreviews + +@Composable +internal fun PreviewHost(content: @Composable () -> Unit) { + DroidDeckTheme { + Box(Modifier.fillMaxSize().background(MaterialTheme.colorScheme.background)) { content() } + } +} + +/** + * A case the render test draws: a name for its PNG and the preview's content. [ready] is what the test waits for before + * drawing, for a screen that loads something off the main thread first. + */ +internal class PreviewCase(val name: String, val ready: () -> Boolean = { true }, val content: @Composable () -> Unit) { + override fun toString() = name +} + +internal val sampleGames: List = listOf( + "Portal 2" to 620, "Hades" to 1145360, "Celeste" to 504230, "Stardew Valley" to 413150, "Hollow Knight" to 367520, + "Balatro" to 2379780, "Dead Cells" to 588650, "Terraria" to 105600, "Vampire Survivors" to 1794680, "Slay the Spire" to 646570, +).mapIndexed { i, (name, appId) -> + Library.SteamGame(appId, name, art = null, library = "steam", lastPlayed = 1_700_000_000_000L - i * 86_400_000L) +} + +internal fun sampleState( + games: List = sampleGames, + navigate: String? = null, + ready: Boolean = true, +): FrontEndState = FrontEndState( + installed = "ubuntu-r1", ready = ready, available = "ubuntu-r1", busy = false, stage = "", percent = 0, + desktopInstalled = true, offlineAccount = null, offline = false, frameGenLabel = "Off", romsDir = null, logsEnabled = true, + steamGames = games, emulators = emptyList(), running = null, navigate = navigate, +) + +internal val sampleActions: FrontEndActions = FrontEndActions( + onPlay = {}, onPlayDesktopUi = {}, onSteamGame = {}, onDesktop = {}, onEmulator = {}, onRom = {}, onResume = {}, + onSteamSettings = {}, onDesktopSettings = {}, onInstallPackage = {}, onRemovePackage = {}, onRuntime = {}, + onFrameGenPick = {}, onImportLossless = {}, onProtons = {}, onComponents = {}, onPerformance = {}, onRoms = {}, + onFiles = {}, onLogs = {}, onOffline = {}, + onWirelessAdbPair = { _, _, _, _ -> }, onWirelessAdbApply = { _, _, _, _ -> }, onSetPhantomProcessLimit = { _, _ -> }, +) + +/** The in-game menu's actions with settled sample values; its switches do nothing. */ +internal fun sampleDrawerActions(steam: Boolean = true, desktop: Boolean = false): DrawerActions = DrawerActions( + steam = steam, desktop = desktop, title = if (!steam && !desktop) "Hades" else null, + isHomeApp = false, androidApps = emptyList(), + hudOn = true, onHud = {}, + frameGen = FrameGen.Mode.OFF, onFrameGenPick = {}, + lossless = Lossless.State.NONE, + oscMode = SessionPrefs.OSC_AUTO, onOsc = {}, + suspendPolicy = SessionPrefs.SUSPEND_MANUAL, onSuspendPolicy = {}, + backActionsInverted = false, onBackActionsInverted = {}, + touchMode = SessionPrefs.TOUCH_AUTO, onTouch = {}, touchAuto = "Auto (direct)", + fexPreset = "", onFexPreset = {}, + secondScreenMode = SecondScreenMode.NONE, onSecondScreenMode = {}, + secondScreenDisplays = emptyList(), selectedSecondScreenDisplay = -1, onSecondScreenDisplay = {}, + onImportLossless = {}, onKeyboard = {}, onHardwareKeyboard = {}, + onSteamMenu = if (steam) ({}) else null, onQam = if (steam) ({}) else null, + onLaunchAndroidApp = { _, _ -> }, onBackground = {}, onShareLogs = {}, onStop = {}, onClose = {}, +) diff --git a/app/src/main/java/com/droiddeck/launcher/ui/BottomPages.kt b/app/src/main/java/com/droiddeck/launcher/ui/BottomPages.kt index 2d2e401fa..b51aec8bf 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/BottomPages.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/BottomPages.kt @@ -7,10 +7,10 @@ import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.outlined.Download -import androidx.compose.material.icons.outlined.Forum -import androidx.compose.material.icons.outlined.Speed -import androidx.compose.material.icons.outlined.PhotoLibrary +import androidx.compose.material.icons.filled.Speed +import androidx.compose.material.icons.filled.Download +import androidx.compose.material.icons.filled.Image +import androidx.compose.material.icons.filled.People import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment @@ -32,10 +32,10 @@ class BottomPageActions( internal const val BOTTOM_PAGE_TELEMETRY = "telemetry" fun sessionBottomPages(actions: BottomPageActions): List = listOf( - BottomPage(BOTTOM_PAGE_TELEMETRY, R.string.bottom_page_telemetry, Icons.Outlined.Speed) { BottomTelemetryPage(actions.fps, actions.runningGame) }, - BottomPage("downloads", R.string.bottom_page_downloads, Icons.Outlined.Download) { BottomDownloadsPage() }, - BottomPage("screenshots", R.string.bottom_page_screenshots, Icons.Outlined.PhotoLibrary) { BottomScreenshotsPage(actions.takeScreenshot) }, - BottomPage("chat", R.string.bottom_page_chat, Icons.Outlined.Forum) { BottomChatPage() }, + BottomPage(BOTTOM_PAGE_TELEMETRY, R.string.bottom_page_telemetry, Icons.Filled.Speed) { BottomTelemetryPage(actions.fps, actions.runningGame) }, + BottomPage("downloads", R.string.bottom_page_downloads, Icons.Filled.Download) { BottomDownloadsPage() }, + BottomPage("screenshots", R.string.bottom_page_screenshots, Icons.Filled.Image) { BottomScreenshotsPage(actions.takeScreenshot) }, + BottomPage("chat", R.string.bottom_page_chat, Icons.Filled.People) { BottomChatPage() }, ) @Composable diff --git a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndRail.kt b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndRail.kt index a60c4ee5a..5503ef22a 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndRail.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndRail.kt @@ -46,20 +46,20 @@ import androidx.compose.foundation.relocation.BringIntoViewRequester import androidx.compose.foundation.relocation.bringIntoViewRequester import androidx.compose.foundation.verticalScroll import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.outlined.Apps -import androidx.compose.material.icons.outlined.Download -import androidx.compose.material.icons.outlined.SdStorage -import androidx.compose.material.icons.outlined.Sync -import androidx.compose.material.icons.outlined.Terminal -import androidx.compose.material.icons.outlined.DesktopWindows -import androidx.compose.material.icons.outlined.Layers -import androidx.compose.material.icons.outlined.LocalMall -import androidx.compose.material.icons.outlined.MoreHoriz +import androidx.compose.material.icons.filled.SportsEsports +import androidx.compose.material.icons.filled.GridView +import androidx.compose.material.icons.filled.LocalOffer +import androidx.compose.material.icons.filled.Download +import androidx.compose.material.icons.filled.DesktopWindows +import androidx.compose.material.icons.filled.Layers +import androidx.compose.material.icons.filled.Terminal +import androidx.compose.material.icons.filled.Apps +import androidx.compose.material.icons.filled.Settings +import androidx.compose.material.icons.filled.SdStorage +import androidx.compose.material.icons.filled.Sync +import androidx.compose.material.icons.filled.MoreHoriz +import androidx.compose.material.icons.filled.SystemUpdate import androidx.compose.material.icons.automirrored.outlined.ArrowBack -import androidx.compose.material.icons.outlined.SportsEsports -import androidx.compose.material.icons.outlined.Storefront -import androidx.compose.material.icons.outlined.SystemUpdate -import androidx.compose.material.icons.outlined.Tune import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme @@ -193,21 +193,22 @@ internal fun SideRail( } } +// Solid icons in the Steam Deck menu's style; where Steam has the same place (Library, Store, Downloads, Settings) its glyph is used. internal fun railLabelIcon(key: String): Pair = when (key) { - "steam" -> R.string.rail_steam to Icons.Outlined.SportsEsports - "games" -> R.string.rail_games to GameShelfIcon + "steam" -> R.string.rail_steam to Icons.Filled.SportsEsports + "games" -> R.string.rail_games to Icons.Filled.GridView "soundtracks" -> R.string.rail_music to SoundtrackIcon - "stores" -> R.string.rail_stores to Icons.Outlined.LocalMall - "downloads" -> R.string.stores_tab_downloads to Icons.Outlined.Download - "desktop" -> R.string.rail_desktop to Icons.Outlined.DesktopWindows - "components" -> R.string.rail_components to Icons.Outlined.Layers - "agent" -> R.string.rail_agent to Icons.Outlined.Terminal - "android-apps" -> R.string.rail_apps to Icons.Outlined.Apps - "setup" -> R.string.rail_setup to Icons.Outlined.Tune - "storage" -> R.string.rail_storage to Icons.Outlined.SdStorage - "sync" -> R.string.rail_sync to Icons.Outlined.Sync - NavTabs.MORE -> R.string.rail_more to Icons.Outlined.MoreHoriz - else -> R.string.rail_updates to Icons.Outlined.SystemUpdate + "stores" -> R.string.rail_stores to Icons.Filled.LocalOffer + "downloads" -> R.string.stores_tab_downloads to Icons.Filled.Download + "desktop" -> R.string.rail_desktop to Icons.Filled.DesktopWindows + "components" -> R.string.rail_components to Icons.Filled.Layers + "agent" -> R.string.rail_agent to Icons.Filled.Terminal + "android-apps" -> R.string.rail_apps to Icons.Filled.Apps + "setup" -> R.string.rail_setup to Icons.Filled.Settings + "storage" -> R.string.rail_storage to Icons.Filled.SdStorage + "sync" -> R.string.rail_sync to Icons.Filled.Sync + NavTabs.MORE -> R.string.rail_more to Icons.Filled.MoreHoriz + else -> R.string.rail_updates to Icons.Filled.SystemUpdate } internal fun setupNeedsAttention(s: FrontEndState): Boolean = !s.ready || (s.available != null && s.available != s.installed) || diff --git a/app/src/main/java/com/droiddeck/launcher/ui/GameShelfIcon.kt b/app/src/main/java/com/droiddeck/launcher/ui/GameShelfIcon.kt deleted file mode 100644 index 74b92c9be..000000000 --- a/app/src/main/java/com/droiddeck/launcher/ui/GameShelfIcon.kt +++ /dev/null @@ -1,17 +0,0 @@ -package com.droiddeck.launcher.ui - -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.graphics.PathFillType -import androidx.compose.ui.graphics.SolidColor -import androidx.compose.ui.graphics.vector.ImageVector -import androidx.compose.ui.graphics.vector.addPathNodes -import androidx.compose.ui.unit.dp - -internal val GameShelfIcon: ImageVector = ImageVector.Builder("GameShelf", 24.dp, 24.dp, 24f, 24f).apply { - for (d in listOf( - "M3,4H7V20H3ZM4.4,5.4V18.6H5.6V5.4Z", - "M8.5,4H12.5V20H8.5ZM9.9,5.4V18.6H11.1V5.4Z", - "M14.2,5.1L18.1,4.2L21.4,19.8L17.5,20.7ZM15.9,6.2L18.6,18.9L19.8,18.6L17.1,5.9Z", - "M2,21H22V22.5H2Z", - )) addPath(addPathNodes(d), fill = SolidColor(Color.Black), pathFillType = PathFillType.EvenOdd) -}.build() diff --git a/app/src/testDebug/java/com/droiddeck/launcher/ui/PreviewRenderTest.kt b/app/src/testDebug/java/com/droiddeck/launcher/ui/PreviewRenderTest.kt new file mode 100644 index 000000000..f84e55526 --- /dev/null +++ b/app/src/testDebug/java/com/droiddeck/launcher/ui/PreviewRenderTest.kt @@ -0,0 +1,63 @@ +package com.droiddeck.launcher.ui + +import android.app.Application +import android.graphics.Bitmap +import android.graphics.Canvas +import android.view.inspector.WindowInspector +import androidx.compose.ui.test.junit4.createComposeRule +import org.junit.Assert.assertTrue +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.robolectric.ParameterizedRobolectricTestRunner +import org.robolectric.ParameterizedRobolectricTestRunner.Parameters +import org.robolectric.annotation.Config +import org.robolectric.annotation.GraphicsMode +import java.io.File + +/** + * Draws every preview case with Robolectric's native graphics and saves it as a PNG under app/build/preview-renders/, + * so UI changes can be looked at without a device. Fails on a preview that throws or draws a single flat colour. + */ +@RunWith(ParameterizedRobolectricTestRunner::class) +@Config(sdk = [34], application = Application::class, qualifiers = "w960dp-h540dp-land-xhdpi") +@GraphicsMode(GraphicsMode.Mode.NATIVE) +internal class PreviewRenderTest(private val case: PreviewCase) { + @get:Rule val compose = createComposeRule() + + @Test fun handheld() = render("handheld") + + @Test @Config(qualifiers = "w540dp-h960dp-port-xhdpi") + fun portrait() = render("portrait") + + private fun render(size: String) { + compose.mainClock.autoAdvance = false + compose.setContent { case.content() } + // The clock is paused, so step it while waiting: navigation and the loads that make a case ready run in frames. + compose.waitUntil(timeoutMillis = 15_000) { compose.mainClock.advanceTimeByFrame(); case.ready() } + // Entrance animations settle well within this. + compose.mainClock.advanceTimeBy(2_000) + compose.waitForIdle() + compose.runOnIdle { save(size) } + } + + private fun save(size: String) { + // A dialog has its own window; the last one is on top. + val view = WindowInspector.getGlobalWindowViews().last() + assertTrue("${case.name}: empty bounds", view.width > 0 && view.height > 0) + val image = Bitmap.createBitmap(view.width, view.height, Bitmap.Config.ARGB_8888) + view.draw(Canvas(image)) + val pixels = IntArray(image.width * image.height) + image.getPixels(pixels, 0, image.width, 0, 0, image.width, image.height) + assertTrue("${case.name}: drew one flat colour", pixels.any { it != pixels.first() }) + val out = File("build/preview-renders/$size/${case.name}.png") + out.parentFile?.mkdirs() + out.outputStream().use { image.compress(Bitmap.CompressFormat.PNG, 100, it) } + image.recycle() + } + + companion object { + @JvmStatic @Parameters(name = "{0}") + fun cases(): List> = previewCases.map { arrayOf(it) } + } +} diff --git a/docs/compose-previews.md b/docs/compose-previews.md new file mode 100644 index 000000000..1aa505956 --- /dev/null +++ b/docs/compose-previews.md @@ -0,0 +1,36 @@ +# Compose previews + +Previews show production composables with sample data, without a device, the Linux runtime or a network. Use them in two +ways: + +- **Android Studio:** select the `debug` build variant and open `app/src/debug/java/com/droiddeck/launcher/ui/LauncherPreviews.kt` + in Split or Design view. +- **Rendered to PNG files**, with no Studio or device needed (also how an agent can look at a UI change): + + ```sh + ./gradlew -PskipRust=true :app:testDebugUnitTest --tests '*PreviewRenderTest' + ``` + + Each preview is drawn with Robolectric's native graphics at handheld (960x540 dp at xhdpi, the Duo's top screen, + 1920x1080 px) and portrait (540x960 dp) sizes, into `app/build/preview-renders/{handheld,portrait}/.png`. The test + fails if a preview throws, or draws a single flat colour. + +## Files + +| File | What | +| --- | --- | +| `app/src/debug/.../ui/PreviewSupport.kt` | `PreviewHost` (the production theme), `@DroidDeckPreviews` (the two sizes), sample `FrontEndState`, no-op `FrontEndActions` and `DrawerActions`, sample games | +| `app/src/debug/.../ui/LauncherPreviews.kt` | The previews, and `previewCases`, the list the render test draws | +| `app/src/testDebug/.../ui/PreviewRenderTest.kt` | The render test | + +Previews cover the launcher on each tab (Steam, Library, Library with no games, Stores, Downloads, Settings, Settings with +no runtime) and the in-game menu's pages (Controller, Display, HUD, Session, and the Desktop menu). + +## Adding one + +Write the preview in `LauncherPreviews.kt` (or a new file beside it) with `@DroidDeckPreviews`, wrapping the content in +`PreviewHost`. Add a `PreviewCase` to `previewCases` so it is rendered and checked too. The launcher opens on a tab via +`sampleState(navigate = "")`. + +Everything here is in the debug source sets, so none of it ships in release builds. Sample art is left out, so cards use +their fallback gradients. Previews check layout and look; they do not exercise launching, input or the runtime.