Fix UI-boundary defects; run tests on the Android variant too
Two defects found reviewing the UI boundary before Compose work: 1. HumanAgent.awaiting was a plain mutable property written by the game coroutine and read by the UI — a data race, and invisible to Compose. It also exposed DecisionContext, which holds a live Seat whose fields mutate as the hand proceeds, so even a safe read could observe torn state. Replaced with an immutable DecisionOffer published through a StateFlow. A test mutates the live seat after publication and asserts the offer does not change. 2. STREET_COMPLETE was emitted after dealing the new street but before the round state was reset, so a flop snapshot carried pre-flop currentBet and committedThisRound — the UI would have painted last street's chips in front of every player alongside the new board. The reset is now prepareRound(), called before publishing. Verified: with the ordering reverted the new test fails with currentBet 10 on the flop. Also: - HumanAgent.cancel() is now covered directly; the previous test only cancelled the coroutine running act(). cancel() and submit() both report whether anything was actually pending. - Android host tests enabled via withHostTestBuilder, so the shared suite runs against the Android variant instead of the AAR merely compiling. No librsvg needed for card assets: sips rasterizes the SVGs directly at exact 2:3 dimensions, court cards and patterned backs included. Tests: 45 -> 48, now green on both jvmTest and testAndroidHostTest. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -4,7 +4,7 @@ plugins {
|
||||
}
|
||||
|
||||
kotlin {
|
||||
// JVM target drives tests and the headless tuning simulator.
|
||||
// JVM target drives the headless tuning simulator.
|
||||
jvm()
|
||||
|
||||
// The modern KMP Android integration. `androidTarget()` is the older path.
|
||||
@@ -12,6 +12,12 @@ kotlin {
|
||||
namespace = "com.jsjdesigns.poker.engine"
|
||||
compileSdk = 37
|
||||
minSdk = 26
|
||||
|
||||
// Run the shared tests against the Android variant too, not just compile
|
||||
// it — otherwise the AAR is only ever proven to build.
|
||||
withHostTestBuilder {}.configure {
|
||||
isIncludeAndroidResources = true
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
|
||||
Reference in New Issue
Block a user