Modern Apps git

← Modern-Apps.git

chess: updated automated screenshot generation

Commit
621138a4914a3f407d38692d4c74b1d7aa40dbb2
Author
Vayun Mathur <[email protected]>
When
2026-07-07 05:32 UTC (5 months ago)
Parents
5dc3d87

Diff

games/chess/src/androidTest/java/com/vayunmathur/games/chess/MetadataScreenshots.kt
diff --git a/games/chess/src/androidTest/java/com/vayunmathur/games/chess/MetadataScreenshots.kt b/games/chess/src/androidTest/java/com/vayunmathur/games/chess/MetadataScreenshots.ktindex 0d60880896..c481ff3bcd 100644--- a/games/chess/src/androidTest/java/com/vayunmathur/games/chess/MetadataScreenshots.kt+++ b/games/chess/src/androidTest/java/com/vayunmathur/games/chess/MetadataScreenshots.kt@@ -7,8 +7,11 @@ import androidx.compose.ui.test.junit4.createAndroidComposeRule import androidx.compose.ui.test.onNodeWithText import androidx.compose.ui.test.onRoot import androidx.compose.ui.test.performClick+import androidx.lifecycle.ViewModelProvider import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.platform.app.InstrumentationRegistry+import com.vayunmathur.games.chess.data.Position+import com.vayunmathur.games.chess.util.ChessViewModel import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith@@ -16,7 +19,7 @@ import java.io.File  /**  * Screenshot generator driven by `:games:chess:metadata`. Store screenshots lead with- * gameplay (the board), followed by the mode-selection dialog.+ * gameplay (a mid-game board), followed by the mode-selection dialog.  */ @RunWith(AndroidJUnit4::class) class MetadataScreenshots {@@ -47,9 +50,28 @@ class MetadataScreenshots {         // as the second shot advertising the modes.         snap(2) -        // Start a local 2-player game to show the populated board first.+        // Start a local 2-player game, then play an Italian-game opening so the board+        // shows real gameplay rather than the plain starting position.         composeRule.onNodeWithText(ctx.getString(R.string.two_player_local)).performClick()         composeRule.waitForIdle()++        val viewModel = ViewModelProvider(composeRule.activity)[ChessViewModel::class.java]+        // Row 0 is Black's back rank, row 7 is White's; White moves first.+        val opening = listOf(+            Position(6, 4) to Position(4, 4), // e2-e4+            Position(1, 4) to Position(3, 4), // e7-e5+            Position(7, 6) to Position(5, 5), // Ng1-f3+            Position(0, 1) to Position(2, 2), // Nb8-c6+            Position(7, 5) to Position(4, 2), // Bf1-c4+            Position(0, 6) to Position(2, 5), // Ng8-f6+        )+        composeRule.runOnUiThread {+            for ((from, to) in opening) {+                viewModel.onSquareClick(from)+                viewModel.onSquareClick(to)+            }+        }+        composeRule.waitForIdle()         snap(1)     } }
games/chess/src/main/ic_launcher-playstore.png
diff --git a/games/chess/src/main/ic_launcher-playstore.png b/games/chess/src/main/ic_launcher-playstore.pngindex 31177942bf..4b6e6d7c05 100644Binary files a/games/chess/src/main/ic_launcher-playstore.png and b/games/chess/src/main/ic_launcher-playstore.png differ
metadata_data/photos/games-chess/1.png
diff --git a/metadata_data/photos/games-chess/1.png b/metadata_data/photos/games-chess/1.pngindex 074d4b3a96..0ef500e997 100644Binary files a/metadata_data/photos/games-chess/1.png and b/metadata_data/photos/games-chess/1.png differ
metadata_data/photos/games-chess/2.png
diff --git a/metadata_data/photos/games-chess/2.png b/metadata_data/photos/games-chess/2.pngindex a9b2c68b6f..db704872f9 100644Binary files a/metadata_data/photos/games-chess/2.png and b/metadata_data/photos/games-chess/2.png differ