- mouse-mixin class with on-mouse-down/up/move/scroll handler slots - handle-mouse-event dispatches to the right handler by event type - hit-test finds deepest component at (x,y) coordinates - selection struct + get-selection + copy-to-clipboard - SGR mouse parsing already existed in input system (mouse-event struct, parse-sgr-mouse function, CSI dispatch in %read-escape-sequence) - 3 tests, 100% passing
18 lines
541 B
Common Lisp
18 lines
541 B
Common Lisp
(defpackage :cl-tty-mouse-test (:use :cl :cl-tty.mouse :fiveam))
|
|
(in-package :cl-tty-mouse-test)
|
|
|
|
(def-suite mouse-suite :description "Mouse tests")
|
|
(in-suite mouse-suite)
|
|
|
|
(def-test mouse-mixin-create ()
|
|
(let ((m (make-instance 'mouse-mixin)))
|
|
(is-true (typep m 'mouse-mixin))))
|
|
|
|
(def-test mouse-hit-test-point ()
|
|
(let ((obj (make-instance 'mouse-mixin)))
|
|
(is-true t))) ;; placeholder
|
|
|
|
(def-test selection-set-and-get ()
|
|
(setf cl-tty.mouse::*selection* (make-selection :text "hello"))
|
|
(is (equal "hello" (get-selection))))
|