Rummy games: full SVG board (stock, discard, melds, fanned hand)

* cg-rummy.el (cg-rummy--board-svg): shared board helper -- stock/discard,
a melds table, and the hand with cursor/marks/lay-off hints and
(hand . INDEX) click regions.  (cg-gin--svg, cg-gin--render-text): Gin
dispatch.  * cg-rum500.el (cg-tm--svg, cg-tm--render-text): table-meld
dispatch (Rummy and Rummy 500).  (cg-render): SVG if graphical, else text.
* test/card-games-tests.el: add cgt-gin-svg-smoke, cgt-tm-svg-smoke.
* NEWS: note the rummy SVG board.
This commit is contained in:
Corwin Brust 2026-07-01 04:31:02 -05:00
parent 98b297d149
commit 585c4449a0
4 changed files with 177 additions and 2 deletions

View file

@ -855,6 +855,27 @@
(cg-put g :bids (vector 3 nil 4 nil)) (cg-put g :scores (vector 100 50 100 50))
(should (stringp (cg-trick--svg g)))))
(ert-deftest cgt-gin-svg-smoke ()
(let ((g (cg-gin-game)))
(cg-gin--deal g)
(cg-put g :cursor 0) (cg-put g :message "x") (cg-put g :scores (vector 0 0))
(should (stringp (cg-gin--render-text g)))
(let ((sres (cg-gin--svg g)))
(should (get-text-property 0 'display sres))
(should (rassoc '(hand . 0) (get-text-property 0 'cg-regions sres))))))
(ert-deftest cgt-tm-svg-smoke ()
(let ((g (cg-rum500-game)))
(cg-tm--deal g)
(cg-put g :cursor 1) (cg-put g :message "x")
(cg-put g :table (list (cons 0 (list '(0 . 0) '(0 . 1) '(0 . 2)))
(cons 2 (list '(1 . 5) '(2 . 5) '(3 . 5)))))
(cg-put g :marks (list 0 2))
(should (stringp (cg-tm--render-text g)))
(let ((regs (get-text-property 0 'cg-regions (cg-tm--svg g))))
(should (rassoc '(hand . 0) regs))
(should (cl-every (lambda (r) (= 4 (length (car r)))) regs)))))
(ert-deftest cgt-pat-golf-deal ()
(let ((g (cg-pat--deal (cg-golf-game))))
(should (= 35 (length (cg-get g :cards))))