Modern Apps git

← Modern-Apps.git

games-chess: pass 3 screen tests (dialogs, layouts, online, learn)

Commit
06c6b511f4d3f6a93712721ee9d0c0ce8abb54a1
Author
Vayun Mathur <[email protected]>
When
2026-11-07 12:33 UTC (29 days ago)
Parents
91f87c0
ChessPass3MainActivityTest launches MainActivity and walks the
bottom tabs (unblocked by the Maia linkage fix). ChessPass3ScreensTest
covers the NewGameDialog choice/settings flow, ChessGame win and
castling achievement wiring through a real ViewModel + achievements
manager (win counter lands in DataStore exactly once), and portrait/
landscape/expanded game layouts. ChessPass3OnlineLearnScreensTest
covers online lobby auth/seeking/challenging variants, the in-game
reconnect/clock/result states and resign confirm dialog, and Learn
home/stage/intro/completed/stage-complete screens.

Verified: all three classes pass under Robolectric.
(cherry picked from commit d53d3b1aed6d820099877d55f9b2f19bd00b899c)

Diff

games/chess/src/test/java/com/vayunmathur/games/chess/ChessPass3MainActivityTest.kt
diff --git a/games/chess/src/test/java/com/vayunmathur/games/chess/ChessPass3MainActivityTest.kt b/games/chess/src/test/java/com/vayunmathur/games/chess/ChessPass3MainActivityTest.ktnew file mode 100644index 0000000000..e619c2cf64--- /dev/null+++ b/games/chess/src/test/java/com/vayunmathur/games/chess/ChessPass3MainActivityTest.kt@@ -0,0 +1,41 @@+package com.vayunmathur.games.chess++import android.content.Context+import androidx.compose.ui.test.junit4.createAndroidComposeRule+import androidx.compose.ui.test.onAllNodesWithText+import androidx.compose.ui.test.onNodeWithText+import androidx.compose.ui.test.performClick+import androidx.test.core.app.ApplicationProvider+import androidx.test.ext.junit.runners.AndroidJUnit4+import org.junit.Rule+import org.junit.Test+import org.junit.runner.RunWith+import kotlin.test.assertTrue++/** Pass 3: MainActivity nav host — game entry, bottom tabs, learn and game-center routes. */+@RunWith(AndroidJUnit4::class)+class ChessPass3MainActivityTest {++    @get:Rule val rule = createAndroidComposeRule<MainActivity>()+    private val ctx: Context get() = ApplicationProvider.getApplicationContext()+    private fun str(id: Int) = ctx.getString(id)++    @Test fun mainActivityLaunchesToGameAndTabsNavigate() {+        // Offline game entry is the start route.+        rule.onNodeWithText(str(R.string.tab_offline)).assertExists()+        // Puzzles tab: puzzle screen composes (loading or a puzzle board).+        rule.onNodeWithText(str(R.string.tab_puzzles)).performClick()+        rule.waitForIdle()+        // Learn tab: stage list.+        rule.onNodeWithText(str(R.string.tab_learn)).performClick()+        rule.waitForIdle()+        rule.onAllNodesWithText(str(R.string.tab_learn)).fetchSemanticsNodes().let {+            assertTrue(it.isNotEmpty())+        }+        // Online tab: lobby (signed out by default in tests).+        rule.onNodeWithText(str(R.string.tab_online)).performClick()+        rule.waitForIdle()+        rule.onNodeWithText(str(R.string.tab_offline)).performClick()+        rule.waitForIdle()+    }+}
games/chess/src/test/java/com/vayunmathur/games/chess/ChessPass3OnlineLearnScreensTest.kt
diff --git a/games/chess/src/test/java/com/vayunmathur/games/chess/ChessPass3OnlineLearnScreensTest.kt b/games/chess/src/test/java/com/vayunmathur/games/chess/ChessPass3OnlineLearnScreensTest.ktnew file mode 100644index 0000000000..2a9ec0ed88--- /dev/null+++ b/games/chess/src/test/java/com/vayunmathur/games/chess/ChessPass3OnlineLearnScreensTest.kt@@ -0,0 +1,278 @@+package com.vayunmathur.games.chess++import android.app.Application+import android.content.Context+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.setValue+import androidx.compose.ui.test.assertIsDisplayed+import androidx.compose.ui.test.captureToImage+import androidx.compose.ui.test.junit4.createComposeRule+import androidx.compose.ui.test.onAllNodesWithText+import androidx.compose.ui.test.onNodeWithText+import androidx.compose.ui.test.onRoot+import androidx.compose.ui.test.performClick+import androidx.compose.ui.test.performScrollTo+import androidx.compose.ui.test.performTextInput+import androidx.test.core.app.ApplicationProvider+import androidx.test.ext.junit.runners.AndroidJUnit4+import com.vayunmathur.games.chess.data.Board+import com.vayunmathur.games.chess.data.LearnRepository+import com.vayunmathur.games.chess.data.PieceColor+import com.vayunmathur.games.chess.data.Position+import com.vayunmathur.games.chess.network.LichessTimeControl+import com.vayunmathur.games.chess.platform.OnlineAuth+import com.vayunmathur.games.chess.platform.OnlineChessUiState+import com.vayunmathur.games.chess.platform.OnlineConnection+import com.vayunmathur.games.chess.util.LearnStatus+import com.vayunmathur.games.chess.util.LearnUiState+import com.vayunmathur.games.chess.util.LearnViewModel+import com.vayunmathur.library.ui.R as UiR+import kotlinx.coroutines.Dispatchers+import kotlinx.coroutines.ExperimentalCoroutinesApi+import kotlinx.coroutines.test.resetMain+import kotlinx.coroutines.test.setMain+import org.junit.Rule+import org.junit.Test+import org.junit.runner.RunWith+import kotlin.test.AfterTest+import kotlin.test.BeforeTest+import kotlin.test.assertEquals+import kotlin.test.assertTrue++/** Pass 3: online lobby/game state variants and Learn screens (home, stage, dialogs). */+@OptIn(ExperimentalCoroutinesApi::class)+@RunWith(AndroidJUnit4::class)+class ChessPass3OnlineLearnScreensTest {++    @get:Rule val rule = createComposeRule()+    private val app get() = ApplicationProvider.getApplicationContext<Application>()+    private val ctx: Context get() = app+    private fun str(id: Int, vararg args: Any) =+        if (args.isEmpty()) ctx.getString(id) else ctx.getString(id, *args)++    @BeforeTest fun setUp() {+        Dispatchers.setMain(Dispatchers.Unconfined)+        LearnRepository.ensureLoaded(ctx)+    }++    @AfterTest fun tearDown() = Dispatchers.resetMain()++    private fun await(desc: String, cond: () -> Boolean) {+        val deadline = System.currentTimeMillis() + 20_000+        while (System.currentTimeMillis() < deadline) {+            if (cond()) return+            org.robolectric.Shadows.shadowOf(android.os.Looper.getMainLooper()).idle()+            rule.waitForIdle()+            if (cond()) return+            Thread.sleep(25)+        }+        assertTrue(cond(), "timed out: $desc")+    }++    // ---- Online lobby variants (stateless ChessOnlineScreen) ----++    @Test fun onlineLobbySigningInAndSignedOutVariants() {+        var state by mutableStateOf(+            OnlineChessUiState(auth = OnlineAuth.SigningIn)+        )+        rule.setContent { ChessOnlineScreen(state) }+        rule.onNodeWithText(str(R.string.online_signing_in)).assertIsDisplayed()++        state = OnlineChessUiState(auth = OnlineAuth.SignedOut)+        rule.onNodeWithText(str(R.string.online_sign_in)).assertIsDisplayed()+    }++    @Test fun onlineLobbySeekingAndChallengingVariants() {+        var state by mutableStateOf(+            OnlineChessUiState(+                auth = OnlineAuth.SignedIn("meuser"),+                connection = OnlineConnection.Seeking(LichessTimeControl.BLITZ_3_2),+            )+        )+        rule.setContent { ChessOnlineScreen(state) }+        rule.onNodeWithText(str(R.string.online_signed_in_as, "meuser"), substring = true).assertExists()++        state = OnlineChessUiState(+            auth = OnlineAuth.SignedIn("meuser"),+            connection = OnlineConnection.Challenging("rival"),+            challengeUsername = "rival",+        )+        rule.waitForIdle()+        rule.onNodeWithText(str(R.string.online_signed_in_as, "meuser"), substring = true).assertExists()+    }++    @Test fun onlineGameReconnectingClocksAndResultVariants() {+        val playing = OnlineConnection.Playing(+            gameId = "g1",+            localColor = PieceColor.BLACK,+            opponentName = "Opp",+            board = Board.initialState,+            turn = PieceColor.BLACK,+            whiteClockMs = 61000,+            blackClockMs = 9000,+            reconnecting = true,+            resultText = "You win!",+        )+        val state = OnlineChessUiState(+            auth = OnlineAuth.SignedIn("meuser"),+            connection = playing,+        )+        rule.setContent { ChessOnlineScreen(state) }+        rule.onNodeWithText(str(R.string.online_reconnecting)).assertExists()+        rule.onNodeWithText("You win!").assertExists()+        rule.onNodeWithText(str(R.string.online_back_to_lobby)).assertExists()+        assertTrue(state.isBoardFlipped)+    }++    @Test fun onlineGameResignDialogAndAbortBar() {+        val playing = OnlineConnection.Playing(+            gameId = "g1",+            localColor = PieceColor.WHITE,+            opponentName = "Opp",+            board = Board.initialState,+            turn = PieceColor.WHITE,+        )+        rule.setContent {+            ChessOnlineScreen(OnlineChessUiState(auth = OnlineAuth.SignedIn("me"), connection = playing))+        }+        // No moves yet: abort is offered alongside resign.+        rule.onNodeWithText(str(R.string.online_abort_confirm)).assertExists()+        rule.onNodeWithText(str(R.string.online_resign_confirm)).performScrollTo().performClick()+        rule.onNodeWithText(str(R.string.online_resign_title)).assertExists()+        rule.onNodeWithText(str(UiR.string.cancel)).performClick()+        rule.onNodeWithText(str(R.string.online_resign_title)).assertDoesNotExist()+    }++    // ---- Learn screens ----++    @Test fun learnHomeListsStagesAndOpensOne() {+        val opened = mutableListOf<Pair<String, String>>()+        rule.setContent { LearnHomeScreen(onOpenStage = { c, s -> opened += c to s }) }+        await("categories loaded") {+            rule.onAllNodesWithText("Chess pieces", substring = true).fetchSemanticsNodes().isNotEmpty()+        }+        val firstStage = LearnRepository.categories.first().stages.first()+        rule.onNodeWithText(firstStage.title, substring = true).performClick()+        assertEquals(listOf(LearnRepository.categories.first().key to firstStage.key), opened)+    }++    @Test fun learnStageIntroThenBoardAndStepper() {+        val vm = LearnViewModel(app)+        vm.loadStage("chessPieces", "rook")+        await("stage loaded") { vm.uiState.value.level != null }+        var backs = 0+        rule.setContent {+            LearnStageScreen(viewModel = vm, onBack = { backs++ }, onOpenStage = { _, _ -> })+        }+        rule.onNodeWithText(str(R.string.learn_lets_go)).performClick()+        rule.waitForIdle()+rule.onNodeWithText(str(R.string.learn_lets_go)).assertDoesNotExist()+        // The stepper renders a chip per level; tapping the board routes to the VM.+        val chips = rule.onAllNodes(+            matcher = androidx.compose.ui.test.hasClickAction() and+                androidx.compose.ui.test.hasAnyDescendant(androidx.compose.ui.test.hasText("2")),+            useUnmergedTree = true,+        )+        assertTrue(chips.fetchSemanticsNodes().isNotEmpty(), "stepper chip for level 2 exists")+        val rook = vm.uiState.value.let { state ->+            (0..7).firstNotNullOf { r ->+                (0..7).firstNotNullOfOrNull { c ->+                    val piece = state.board.pieces[r][c]+                    if (piece != null && piece.color == state.playerColor) Position(r, c) else null+                }+            }+        }+        // Board squares are the large clickable cells: tap the rook's square by board position.+        val boardNodes = rule.onAllNodes(androidx.compose.ui.test.hasClickAction(), useUnmergedTree = true)+        assertTrue(boardNodes.fetchSemanticsNodes().isNotEmpty())+        vm.onSquareClick(rook)+        assertEquals(rook, vm.uiState.value.selectedPiece, "board tap selection reaches the VM state")+        assertEquals(0, backs)+    }++    @Test fun learnStageShapesAndApplesDraw() {+        val vm = LearnViewModel(app)+        // A stage whose first level carries shapes/apples: rook stage level 0.+        vm.loadStage("chessPieces", "rook")+        await("stage loaded") { vm.uiState.value.level != null }+        rule.setContent {+            LearnStageScreen(viewModel = vm, onBack = {}, onOpenStage = { _, _ -> })+        }+        rule.onNodeWithText(str(R.string.learn_lets_go)).performClick()+        assertTrue(vm.uiState.value.apples.isNotEmpty())+    }++    @Test fun learnCompletedStatusShowsStarsAndNext() {+        val vm = LearnViewModel(app)+        vm.loadStage("chessPieces", "rook")+        await("stage loaded") { vm.uiState.value.level != null }+        // Complete level 0 by collecting every apple with the rook.+        var guard = 0+        while (vm.uiState.value.status == LearnStatus.Playing && guard++ < 40) {+            val state = vm.uiState.value+            val target = state.apples.firstOrNull() ?: break+            var moved = false+            outer@ for (r in 0..7) for (c in 0..7) {+                val piece = state.board.pieces[r][c] ?: continue+                if (piece.color != state.playerColor) continue+                if (state.board.isValidMove(Position(r, c), target) ||+                    state.board.isPseudoLegalMove(Position(r, c), target)+                ) {+                    vm.onSquareClick(Position(r, c))+                    vm.onSquareClick(target)+                    moved = true+                    break@outer+                }+            }+            if (!moved) break+            if (vm.uiState.value.status == LearnStatus.Failed) vm.retryLevel()+        }+        assertEquals(LearnStatus.Completed, vm.uiState.value.status)+        rule.setContent {+            LearnStageScreen(viewModel = vm, onBack = {}, onOpenStage = { _, _ -> })+        }+        rule.onNodeWithText(str(R.string.learn_lets_go)).performClick()+        rule.onNodeWithText(str(R.string.learn_completed), substring = true).assertExists()+        rule.onAllNodesWithText("★", substring = true).fetchSemanticsNodes().let {+            assertTrue(it.isNotEmpty(), "star row renders earned stars")+        }+        rule.onNodeWithText(str(UiR.string.next)).performScrollTo().performClick()+        rule.waitForIdle()+        assertEquals(1, vm.uiState.value.levelIndex)+    }++    @Test fun stageCompleteDialogRanksAndNextStage() {+        val stage = LearnRepository.categories.first().stages.first()+        val opened = mutableListOf<Pair<String, String>>()+        var backs = 0+        val next = LearnRepository.nextStage(stage.key)+        rule.setContent {+            StageCompleteDialog(+                stage = stage,+                stageStars = List(stage.levels.size) { 3 },+                score = 1234,+                nextTitle = next?.second?.title,+                onNext = { next?.let { opened += it.first to it.second.key } },+                onBackToMenu = { backs++ },+            )+        }+        rule.onNodeWithText(str(R.string.learn_your_score, 1234), substring = true).assertExists()+        if (next != null) {+            rule.onNodeWithText(str(R.string.learn_next_stage, next.second.title), substring = true).performClick()+            assertEquals(listOf(next.first to next.second.key), opened)+        }+        assertEquals(0, backs)+    }++    @Test fun learnStageLoadingState() {+        val vm = LearnViewModel(app)+        rule.setContent {+            LearnStageScreen(viewModel = vm, onBack = {}, onOpenStage = { _, _ -> })+        }+        // No stage loaded: spinner state (title falls back to the Learn tab label).+        rule.onNodeWithText(str(R.string.tab_learn)).assertExists()+        assertEquals(null, vm.uiState.value.stage)+    }++}
games/chess/src/test/java/com/vayunmathur/games/chess/ChessPass3ScreensTest.kt
diff --git a/games/chess/src/test/java/com/vayunmathur/games/chess/ChessPass3ScreensTest.kt b/games/chess/src/test/java/com/vayunmathur/games/chess/ChessPass3ScreensTest.ktnew file mode 100644index 0000000000..d69fa5a0e5--- /dev/null+++ b/games/chess/src/test/java/com/vayunmathur/games/chess/ChessPass3ScreensTest.kt@@ -0,0 +1,209 @@+package com.vayunmathur.games.chess++import android.app.Application+import android.content.Context+import androidx.compose.ui.test.assertIsDisplayed+import androidx.compose.ui.test.captureToImage+import androidx.compose.ui.test.junit4.createComposeRule+import androidx.compose.ui.test.onAllNodesWithText+import androidx.compose.ui.test.onNodeWithText+import androidx.compose.ui.test.onRoot+import androidx.compose.ui.test.performClick+import androidx.test.core.app.ApplicationProvider+import androidx.test.ext.junit.runners.AndroidJUnit4+import com.vayunmathur.games.chess.data.PieceColor+import com.vayunmathur.games.chess.data.Position+import com.vayunmathur.games.chess.util.ChessAchievementsManager+import com.vayunmathur.games.chess.util.ChessUiState+import com.vayunmathur.games.chess.util.ChessViewModel+import com.vayunmathur.games.chess.util.Difficulty+import com.vayunmathur.games.chess.util.GameMode+import com.vayunmathur.library.ui.R as UiR+import com.vayunmathur.library.util.DataStoreUtils+import kotlinx.coroutines.Dispatchers+import kotlinx.coroutines.ExperimentalCoroutinesApi+import kotlinx.coroutines.flow.first+import kotlinx.coroutines.runBlocking+import kotlinx.coroutines.test.resetMain+import kotlinx.coroutines.test.setMain+import org.junit.Rule+import org.junit.Test+import org.junit.runner.RunWith+import org.robolectric.annotation.Config+import kotlin.test.AfterTest+import kotlin.test.BeforeTest+import kotlin.test.assertEquals+import kotlin.test.assertTrue++/** Pass 3: NewGameDialog flow, ChessGame achievements wiring, layout variants. */+@OptIn(ExperimentalCoroutinesApi::class)+@RunWith(AndroidJUnit4::class)+class ChessPass3ScreensTest {++    @get:Rule val rule = createComposeRule()+    private val app get() = ApplicationProvider.getApplicationContext<Application>()+    private val ctx: Context get() = app+    private fun str(id: Int) = ctx.getString(id)++    @BeforeTest fun setUp() {+        Dispatchers.setMain(Dispatchers.Unconfined)+        runBlocking { DataStoreUtils.getInstance(app).removeKeys(listOf("chess_wins_count")) }+    }++    @AfterTest fun tearDown() {+        runBlocking { DataStoreUtils.getInstance(app).removeKeys(listOf("chess_wins_count")) }+        Dispatchers.resetMain()+    }++    private fun sq(file: Char, rank: Int) = Position(8 - rank, file - 'a')++    private fun manager(): ChessAchievementsManager {+        val json = app.assets.open("achievements.json").bufferedReader().readText()+        return ChessAchievementsManager(app, json)+    }++    private fun await(desc: String, cond: () -> Boolean) {+        val deadline = System.currentTimeMillis() + 20_000+        while (System.currentTimeMillis() < deadline) {+            if (cond()) return+            // Pump the main looper so composition LaunchedEffects can run.+            org.robolectric.Shadows.shadowOf(android.os.Looper.getMainLooper()).idle()+            rule.waitForIdle()+            if (cond()) return+            Thread.sleep(25)+        }+        assertTrue(cond(), "timed out: $desc")+    }++    // ---- NewGameDialog ----++    @Test fun newGameDialogTwoPlayerStartsImmediately() {+        var mode: GameMode? = null+        rule.setContent { NewGameDialog(onNewGame = { mode = it }) }+        rule.onNodeWithText(str(R.string.two_player_local)).performClick()+        assertEquals(GameMode.TwoPlayer, mode)+    }++    @Test fun newGameDialogAiSettingsPickColorAndDifficulty() {+        var mode: GameMode? = null+        rule.setContent { NewGameDialog(onNewGame = { mode = it }) }+        rule.onNodeWithText(str(R.string.human_vs_ai)).performClick()+        rule.onNodeWithText(str(R.string.color_black)).performClick()+        rule.onNodeWithText(str(UiR.string.easy)).performClick()+        rule.onNodeWithText(str(R.string.start_game)).performClick()+        assertEquals(GameMode.VsAI(PieceColor.BLACK, Difficulty.BEGINNER), mode)+    }++    @Test fun newGameDialogMasterDifficultyAndWhiteDefault() {+        var mode: GameMode? = null+        rule.setContent { NewGameDialog(onNewGame = { mode = it }) }+        rule.onNodeWithText(str(R.string.human_vs_ai)).performClick()+        rule.onNodeWithText(str(R.string.difficulty_master)).performClick()+        rule.onNodeWithText(str(R.string.start_game)).performClick()+        assertEquals(GameMode.VsAI(PieceColor.WHITE, Difficulty.GRANDMASTER), mode)+    }++    @Test fun newGameDialogWithoutAiHidesAiOption() {+        rule.setContent { NewGameDialog(onNewGame = {}, aiAvailable = false) }+        rule.onNodeWithText(str(R.string.two_player_local)).assertIsDisplayed()+        rule.onAllNodesWithText(str(R.string.human_vs_ai)).fetchSemanticsNodes().let {+            assertEquals(0, it.size, "AI option hidden when the model is unavailable")+        }+    }++    // ---- ChessGame achievements wiring ----++    @Test fun chessGameFoolsMateRecordsWinOnce() {+        val vm = ChessViewModel(app)+        val mgr = manager()+        var newGames = 0+        rule.setContent {+            ChessGame(viewModel = vm, onNewGame = { newGames++ }, onOpenGameCenter = {}, achievementsManager = mgr)+        }+        fun move(f1: Char, r1: Int, f2: Char, r2: Int) {+            vm.onSquareClick(sq(f1, r1)); vm.onSquareClick(sq(f2, r2))+        }+        // Fool's mate: 1. f3 e5 2. g4 Qh4#+        move('f', 2, 'f', 3); move('e', 7, 'e', 5); move('g', 2, 'g', 4); move('d', 8, 'h', 4)+        assertTrue(vm.uiState.value.gameResult != null, "fool's mate ends the game")+        await("win recorded") {+            DataStoreUtils.getInstance(app).getLong("chess_wins_count")?.let { it >= 1 } == true+        }+        await("first_mate unlocked") {+            runBlocking {+                mgr.getAchievementStatuses().first().any { it.achievement.id == "first_mate" && it.isUnlocked }+            }+        }+        assertEquals(false, vm.claimWinScoring(), "win scoring is claimed exactly once")+        assertEquals(0, newGames)+    }++    @Test fun chessGameCastlingUnlocksAchievement() {+        val vm = ChessViewModel(app)+        val mgr = manager()+        rule.setContent {+            ChessGame(viewModel = vm, onNewGame = {}, onOpenGameCenter = {}, achievementsManager = mgr)+        }+        fun move(f1: Char, r1: Int, f2: Char, r2: Int) {+            vm.onSquareClick(sq(f1, r1)); vm.onSquareClick(sq(f2, r2))+        }+        // 1. e4 e5 2. Nf3 Nc6 3. Bc4 Bc5 4. O-O+        move('e', 2, 'e', 4); move('e', 7, 'e', 5)+        move('g', 1, 'f', 3); move('b', 8, 'c', 6)+        move('f', 1, 'c', 4); move('f', 8, 'c', 5)+        move('e', 1, 'g', 1)+        assertTrue(vm.uiState.value.board.moves.lastOrNull()?.isCastling == true, "last move castles")+        await("castled unlocked") {+            runBlocking {+                mgr.getAchievementStatuses().first().any { it.achievement.id == "castled" && it.isUnlocked }+            }+        }+    }++    // ---- Layout variants ----++    @Test fun gameScreenPortraitMidgameState() {+        val vm = ChessViewModel(app)+        vm.onSquareClick(sq('e', 2)); vm.onSquareClick(sq('e', 4))+        vm.onSquareClick(sq('e', 7)); vm.onSquareClick(sq('e', 5))+        rule.setContent {+            ChessGameScreen(+                state = vm.uiState.value.copy(gameStatus = "White to move"),+                actions = vm,+                onNewGame = {},+                onOpenGameCenter = {},+            )+        }+        rule.onNodeWithText("White to move").assertExists()+        rule.onNodeWithText("e4", substring = true).assertExists()+    }++    @Config(qualifiers = "w800dp-h400dp-land")+    @Test fun gameScreenLandscapeLayout() {+        rule.setContent {+            ChessGameScreen(+                state = ChessUiState(gameStatus = "Landscape game"),+                actions = com.vayunmathur.games.chess.util.ChessActions.Noop,+                onNewGame = {},+                onOpenGameCenter = {},+            )+        }+        rule.onNodeWithText("Landscape game").assertExists()+    }++    @Config(qualifiers = "w1200dp-h800dp")+    @Test fun gameScreenExpandedLayout() {+        var newGames = 0+        rule.setContent {+            ChessGameScreen(+                state = ChessUiState(gameStatus = "Expanded game"),+                actions = com.vayunmathur.games.chess.util.ChessActions.Noop,+                onNewGame = { newGames++ },+                onOpenGameCenter = {},+            )+        }+        rule.onNodeWithText("Expanded game").assertExists()+        rule.onNodeWithText(str(UiR.string.new_game)).performClick()+        assertEquals(1, newGames)+    }+}