Finish mouse support: Crazy Eights, President, the patience boards
The last three keyboard-only games are now click-to-play, so every game in the package responds to the mouse. Crazy Eights and President route their hands through the shared cg-regions click map (President maps each rank group to a click); the patience boards (Golf, TriPeaks, Pyramid) follow the solitaire keystone, mapping exposed slots plus the waste and stock to their spots. Each adds a card-size slider, [mouse-1], and +/-/0 zoom. Add cgt-mouse-regions asserting the SVG click maps build (suite -> 116).
This commit is contained in:
parent
730b7e284b
commit
5ff6d8afed
4 changed files with 104 additions and 20 deletions
|
|
@ -1165,3 +1165,28 @@
|
|||
(should (cg-hf--book-valid-p (car (cg-hf--books g 0))))
|
||||
(should (= 4 (length (cg-rummy--hand g 0))))
|
||||
(should-not (cg-get g :discard)))))
|
||||
|
||||
;;;; Mouse click-region wiring for eights, president, and the patience boards
|
||||
|
||||
(ert-deftest cgt-mouse-regions ()
|
||||
"The newly clickable games attach a `cg-regions' map to their SVG."
|
||||
(let* ((g (cg-pat--deal (cg-golf-game)))
|
||||
(regs (get-text-property 0 'cg-regions (cg-pat--svg g))))
|
||||
(should regs)
|
||||
(should (cl-find '(waste . 0) (mapcar #'cdr regs) :test #'equal))
|
||||
(should (cl-find '(stock . 0) (mapcar #'cdr regs) :test #'equal))
|
||||
(should (cl-find-if (lambda (a) (eq (car a) 'slot)) (mapcar #'cdr regs))))
|
||||
(let ((g (cg-president-game)))
|
||||
(cg-put g :games 0) (cg-pres--deal g)
|
||||
(let ((regs (get-text-property 0 'cg-regions (cg-pres--svg g))))
|
||||
(should regs)
|
||||
(should (cl-find-if (lambda (a) (and (consp a) (eq (car a) 'hand)))
|
||||
(mapcar #'cdr regs)))))
|
||||
(let ((g (cg-eights-game)))
|
||||
(cg-put g :scores (make-vector 3 0)) (cg-eights--deal g)
|
||||
(let* ((img (cg-svg-hand-image (mapcar #'cg-eights--spec (cg-eights--hand g 0))
|
||||
:region-tag 'hand))
|
||||
(regs (get-text-property 0 'cg-regions img)))
|
||||
(should regs)
|
||||
(should (cl-find-if (lambda (a) (and (consp a) (eq (car a) 'hand)))
|
||||
(mapcar #'cdr regs))))))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue