aboutsummaryrefslogtreecommitdiff
path: root/internal/game/video_poker_alignment_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/game/video_poker_alignment_test.go')
-rw-r--r--internal/game/video_poker_alignment_test.go35
1 files changed, 35 insertions, 0 deletions
diff --git a/internal/game/video_poker_alignment_test.go b/internal/game/video_poker_alignment_test.go
new file mode 100644
index 0000000..0163fac
--- /dev/null
+++ b/internal/game/video_poker_alignment_test.go
@@ -0,0 +1,35 @@
+package game
+
+import (
+ "fmt"
+ "strings"
+ "testing"
+
+ "thehouseoficarus/internal/casino"
+)
+
+func TestPokerMultiHandCardRowsAlignWithLabels(t *testing.T) {
+ cards := []casino.CardView{{Rank: "A", Suit: "hearts"}, {Rank: "K", Suit: "spades"}, {Rank: "Q", Suit: "diamonds"}, {Rank: "J", Suit: "clubs"}, {Rank: "10", Suit: "hearts"}}
+ for _, size := range []int{1, 3, 5} {
+ t.Run(fmt.Sprint(size), func(t *testing.T) {
+ hand := casino.PokerLine{Cards: cards, Category: "Straight", Coins: 20, Multiplier: 1}
+ snap := &casino.VideoPokerSnapshot{Config: (casino.VideoPokerConfig{Cabinet: casino.CabinetClassic}).Normalize(), Hands: 3, Lines: []casino.PokerLine{hand, hand, hand}}
+ out := renderVideoPoker(snap, "none", true, size, "", nil)
+ art := renderPokerCards(cards, nil, "none", true, min(5, cardRenderSize(true, size)), "", nil)
+ for n := 1; n <= 3; n++ {
+ rows := append([]string(nil), art...)
+ for i := range rows {
+ prefix := " "
+ if i == 0 {
+ prefix = fmt.Sprintf("%3d: ", n)
+ }
+ rows[i] = prefix + rows[i]
+ }
+ want := strings.Join(rows, "\n") + "\n Straight"
+ if !strings.Contains(out, want) {
+ t.Fatalf("hand %d is misaligned:\n%s", n, out)
+ }
+ }
+ })
+ }
+}