aboutsummaryrefslogtreecommitdiff
path: root/internal/game/look_alignment_test.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-09-29 14:15:06 -0400
committerhistoria <[not public]>2026-09-29 14:15:06 -0400
commit3db3071c444abb2133e1fcaf7e685095415c1adf (patch)
treea1d3c276aa7db2e89ea92a5751a81c197a1e1103 /internal/game/look_alignment_test.go
parent9803facd4368420a5dce3af59c835e13cb015cf5 (diff)
downloadthehouseoficarus-3db3071c444abb2133e1fcaf7e685095415c1adf.tar.gz
feat: better roulette wheel design
Diffstat (limited to 'internal/game/look_alignment_test.go')
-rw-r--r--internal/game/look_alignment_test.go34
1 files changed, 34 insertions, 0 deletions
diff --git a/internal/game/look_alignment_test.go b/internal/game/look_alignment_test.go
index 42af09a..3b45da1 100644
--- a/internal/game/look_alignment_test.go
+++ b/internal/game/look_alignment_test.go
@@ -9,6 +9,40 @@ import (
"thehouseoficarus/internal/player"
)
+func TestLookMiniMapLongContentWrapsWithoutCollision(t *testing.T) {
+ // A long status line (for example a room fixture's live table overview)
+ // must wrap before the map column instead of writing through it.
+ for _, side := range []string{"right", "left"} {
+ t.Run(side, func(t *testing.T) {
+ p := player.New("alice")
+ p.Options = map[string]any{"tiny_map": side, "wrap_width": 80}
+ conn := &casinoTestConn{}
+ sess := &net.Session{Player: p, Conn: conn}
+ long := "Roulette / Single zero | Limits 1-10000 | 1/8 seated | Betting open and the wheel is spinning right now"
+ content := []string{long}
+ mapLines := []string{"╔═════╗", "║□-□-□║", "║ ↑ ║", "║ @ ║", "║ │ ║", "║ ■ ║", "╚═════╝"}
+ (&Game{}).writeLookSideBySide(sess, p, content, mapLines, 71)
+ lines := strings.Split(strings.TrimSuffix(string(conn.data), "\r\n"), "\r\n")
+ if len(lines) < len(mapLines) {
+ t.Fatalf("got %d lines, want at least %d", len(lines), len(mapLines))
+ }
+ for i, line := range lines[:len(mapLines)] {
+ index := strings.Index(line, mapLines[i])
+ if index < 0 {
+ t.Fatalf("line %d missing map row: %q", i, line)
+ }
+ want := 73
+ if side == "left" {
+ want = 0
+ }
+ if got := visibleLen(line[:index]); got != want {
+ t.Errorf("line %d: map column = %d, want %d (content collided)", i, got, want)
+ }
+ }
+ })
+ }
+}
+
func TestLookMiniMapAlignment(t *testing.T) {
for _, side := range []string{"right", "left"} {
for _, colored := range []bool{false, true} {