aboutsummaryrefslogtreecommitdiff
path: root/internal/game/render_roulette_test.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-09-30 03:55:37 -0400
committerhistoria <[not public]>2026-09-30 03:55:37 -0400
commit735428f0667f67c12fdf3caca872d7dc65e2ce26 (patch)
tree92c9931f223bfd50ced4f1954130d879640a435b /internal/game/render_roulette_test.go
parentffc7b582e9c14fdc2e579b9239b5ff7ad9a0d90a (diff)
downloadthehouseoficarus-735428f0667f67c12fdf3caca872d7dc65e2ce26.tar.gz
feat: restyle roulette presentation
Diffstat (limited to 'internal/game/render_roulette_test.go')
-rw-r--r--internal/game/render_roulette_test.go49
1 files changed, 43 insertions, 6 deletions
diff --git a/internal/game/render_roulette_test.go b/internal/game/render_roulette_test.go
index 3577ec9..fcfd9c7 100644
--- a/internal/game/render_roulette_test.go
+++ b/internal/game/render_roulette_test.go
@@ -238,7 +238,7 @@ func TestRouletteRacetrackPanel(t *testing.T) {
for _, unicode := range []bool{false, true} {
art := renderRouletteLayout(false, true, mode, unicode)
plain := plainRoulette(art)
- for _, want := range []string{"Tiers du Cylindre", "Orphelins", "Voisins du Zero", "Zero"} {
+ for _, want := range []string{"Tiers du", "Cylindre", "Orphelins", "Voisins du Zero", "Jeu"} {
if !strings.Contains(plain, want) {
t.Fatalf("mode=%s unicode=%v: missing %q:\n%s", mode, unicode, want, plain)
}
@@ -494,14 +494,22 @@ func TestRouletteRacetrackSections(t *testing.T) {
}
}
}
+ // Labels wrap onto the rows around the middle so no glyph touches a
+ // divider; every field keeps a blank cell on both sides of its text.
for _, label := range []struct {
- left, right int
- text string
+ row, left, right int
+ text string
}{
- {4, 22, "Tiers du Cylindre"}, {22, 40, "Orphelins"}, {40, 58, "Voisins du Zero"}, {58, 68, "Jeu Zero"},
+ {4, 5, 20, "Tiers du"}, {6, 5, 22, "Cylindre"},
+ {5, 23, 40, "Orphelins"}, {5, 41, 58, "Voisins du Zero"},
+ {4, 60, 68, "Jeu"}, {6, 60, 68, "Zero"},
} {
- if strings.TrimSpace(segment(5, label.left+1, label.right)) != label.text {
- t.Errorf("misplaced %s label", label.text)
+ field := segment(label.row, label.left, label.right)
+ if strings.TrimSpace(field) != label.text {
+ t.Errorf("misplaced %q label on row %d: %q", label.text, label.row, field)
+ }
+ if !strings.HasPrefix(field, " ") || !strings.HasSuffix(field, " ") {
+ t.Errorf("%q label touches a divider on row %d: %q", label.text, label.row, field)
}
}
// Every step joins orthogonally; no font-dependent diagonal gaps.
@@ -580,3 +588,32 @@ func TestRouletteWheelBlackAndSpacing(t *testing.T) {
}
}
}
+
+// The roulette menu draws the board before the wager reminder so the
+// instructions follow the table they describe, and the tracker gets a blank
+// line above it instead of butting into the heading.
+func TestRouletteMenuPutsReminderAfterBoard(t *testing.T) {
+ g := &Game{Casino: casino.NewManager(1), Hub: net.NewHub(), Combat: combat.NewTracker(), Deps: Deps{World: world.New(t.TempDir())}}
+ p := player.New("alice")
+ p.RoomID, p.Credits = 1, 1000
+ p.Options = map[string]any{"color": "none", "unicode": true}
+ conn := &casinoTestConn{}
+ sess := &net.Session{Player: p, Conn: conn}
+ g.loggedInChars = map[string]*net.Session{"alice": sess}
+ g.Hub.EnterRoom(sess, 1)
+ cfg := casino.TableConfig{ID: "r", Game: casino.GameRoulette, Roulette: casino.RouletteConfig{Racetrack: true}}
+ g.emitCasinoEvents(g.Casino.Join(1, cfg, p.Name))
+ out := strings.ReplaceAll(string(conn.data), "\r\n", "\n")
+ tracker := strings.Index(out, "History: last 0 spins")
+ board := strings.Index(out, "R = red, B = black, G = green")
+ reminder := strings.Index(out, "bet <amount> on <target>")
+ if tracker < 0 || board < 0 || reminder < 0 {
+ t.Fatalf("missing tracker, board, or reminder:\n%s", out)
+ }
+ if !(tracker < board && board < reminder) {
+ t.Fatalf("expected tracker before board before reminder, got %d/%d/%d:\n%s", tracker, board, reminder, out)
+ }
+ if !strings.Contains(out, "\n\nā”Œā”€ History: last 0 spins") {
+ t.Fatalf("tracker is not preceded by a blank line:\n%s", out)
+ }
+}