feat: Add client gametest for tank rendering verification#21
Conversation
…cation - clientGametest ソースセットを手動作成し、サーバー側 gametest と分離 - FabricClientGameTest を実装し、5 つのスクリーンショットテストを追加 - 空タンク、水満タン、水半分、水平連結、縦積み連結 - CI に client-game-test ジョブを追加(スクリーンショットをアーティファクトとして保存) - CTBlocks.syncGroupBlockEntities の可視性を internal → public に変更 (テストモジュールからのアクセスに必要) - .gitignore に /net/ を追加(Loom デコンパイルソース除外)
…test productionRuntimeMods configuration が空だったため、 ClientProductionRunTask 実行時に fabric-api と fabric-language-kotlin が ロードされず起動に失敗していた。
…ctory clientGametest ソースセットの jar を remap して getMods() に追加し、 runDir と testModResourcesPath を設定。これにより CI 上で テスト mod が正しくロードされ、スクリーンショットも期待するパスに出力される。
… jar RemapJarTask は Jar を継承しているため、同じ archiveClassifier だと 入力 jar と出力先が同じパスになり remap 時にファイルが破壊されていた。 classpath も clientGametest ソースセットのものを設定。
デフォルト容量は 32 バケツだが、テストでは 10 バケツしか入れていなかった。 CTServerConfig.DEFAULT_BUCKET_CAPACITY を参照して正しい量を注入するよう修正。
There was a problem hiding this comment.
Pull request overview
Adds Fabric client-side GameTest coverage to verify ConnectedTank rendering via screenshot capture, separating client tests into a dedicated clientGametest source set and wiring CI to run the client test task and upload screenshots as artifacts.
Changes:
- Introduces a new
clientGametestsource set + Loom run configurations for client GameTests. - Adds a client GameTest mod (
connectedtank-client-test) with screenshot-based rendering scenarios. - Updates CI to run the production client GameTest task and upload generated screenshots.
Reviewed changes
Copilot reviewed 4 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/main/kotlin/net/turtton/connectedtank/block/CTBlocks.kt |
Makes syncGroupBlockEntities callable from the client test module. |
src/clientGametest/resources/fabric.mod.json |
Declares a separate client-only test mod and entrypoint for Fabric client GameTests. |
src/clientGametest/kotlin/net/turtton/connectedtank/test/ConnectedTankClientGameTest.kt |
Implements screenshot capture scenarios for tank rendering verification. |
build.gradle.kts |
Adds clientGametest source set, Loom run(s), and production client test task. |
.gitignore |
Ignores Loom decompiled sources directory at repo root. |
.github/workflows/build.yml |
Adds client-game-test CI job to run client GameTests and upload screenshots. |
Comments suppressed due to low confidence (1)
src/main/kotlin/net/turtton/connectedtank/block/CTBlocks.kt:46
syncGroupBlockEntitieswas changed frominternalto public. Since this is effectively an internal sync helper (it mutates client-render-facing block entities from server state), consider marking it explicitly as non-API (e.g., with an internal-use annotation / visibility wrapper) to avoid accidentally committing to it as part of the mod’s public API surface while still allowing test access.
fun syncGroupBlockEntities(
world: ServerWorld,
pos: BlockPos,
state: FluidStoragePersistentState = world.persistentStateManager.getOrCreate(FluidStoragePersistentState.TYPE),
) {
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| import org.lwjgl.glfw.GLFW | ||
|
|
||
| object ConnectedTankClientGameTest : FabricClientGameTest { | ||
| private val TANK_CAPACITY = CTServerConfig.DEFAULT_BUCKET_CAPACITY.toLong() |
There was a problem hiding this comment.
TANK_CAPACITY is a regular val but is named like a compile-time constant (all-caps with underscores). To match Kotlin naming conventions and avoid implying const val semantics, rename this to lowerCamelCase (or make it a const val if you can express it as a compile-time constant).
| private val TANK_CAPACITY = CTServerConfig.DEFAULT_BUCKET_CAPACITY.toLong() | |
| private val tankCapacity = CTServerConfig.DEFAULT_BUCKET_CAPACITY.toLong() |
| - name: Run client game tests | ||
| run: ./gradlew runProductionClientGameTest |
There was a problem hiding this comment.
This workflow runs a Minecraft client task on ubuntu-24.04 without setting up an X/GL context (e.g., via xvfb-run). On GitHub-hosted Linux runners, GUI/OpenGL apps typically fail with missing DISPLAY/GL errors unless wrapped in Xvfb (and sometimes mesa libs). Consider running the Gradle command under xvfb-run -a (and installing any required packages) to make the CI job reliable.
| - name: Run client game tests | |
| run: ./gradlew runProductionClientGameTest | |
| - name: Install Xvfb and Mesa | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y xvfb mesa-utils | |
| - name: Run client game tests | |
| run: xvfb-run -a ./gradlew runProductionClientGameTest |
Summary
clientGametestソースセットを手動作成し、サーバー側gametestと分離client-game-testジョブを追加(スクリーンショットをアーティファクトとして保存)テストケース
その他の変更
CTBlocks.syncGroupBlockEntitiesの可視性をinternal→publicに変更(テストモジュールからのアクセスに必要).gitignoreに/net/を追加(Loom デコンパイルソース除外)Test plan
./gradlew build通過./gradlew spotlessCheck通過./gradlew runClientGameTestでスクリーンショットがbuild/run/clientGameTest/screenshots/に生成されることを確認client-game-testジョブが成功し、スクリーンショットがアーティファクトにアップロードされることを確認