aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/lisp/xt-mouse-tests.el50
1 files changed, 28 insertions, 22 deletions
diff --git a/test/lisp/xt-mouse-tests.el b/test/lisp/xt-mouse-tests.el
index 9318e8ef590..379ad7bf039 100644
--- a/test/lisp/xt-mouse-tests.el
+++ b/test/lisp/xt-mouse-tests.el
@@ -28,28 +28,34 @@
28(defmacro with-xterm-mouse-mode (&rest body) 28(defmacro with-xterm-mouse-mode (&rest body)
29 "Run BODY with `xterm-mouse-mode' temporarily enabled." 29 "Run BODY with `xterm-mouse-mode' temporarily enabled."
30 (declare (indent 0)) 30 (declare (indent 0))
31 ;; Make the frame huge so that the test input events below don't hit 31 `(let ((width (frame-width))
32 ;; the menu bar. 32 (height (frame-height)))
33 `(cl-letf (((frame-width nil) 2000) 33 (unwind-protect
34 ((frame-height nil) 2000) 34 (progn
35 ;; Reset XTerm parameters so that the tests don't get 35 ;; Make the frame huge so that the test input events below
36 ;; confused. 36 ;; don't hit the menu bar.
37 ((terminal-parameter nil 'xterm-mouse-x) nil) 37 (set-frame-width nil (max width 2000))
38 ((terminal-parameter nil 'xterm-mouse-y) nil) 38 (set-frame-height nil (max height 2000))
39 ((terminal-parameter nil 'xterm-mouse-last-down) nil) 39 (cl-letf (;; Reset XTerm parameters so that the tests don't
40 ((terminal-parameter nil 'xterm-mouse-last-click) nil)) 40 ;; get confused.
41 (if xterm-mouse-mode 41 ((terminal-parameter nil 'xterm-mouse-x) nil)
42 (progn ,@body) 42 ((terminal-parameter nil 'xterm-mouse-y) nil)
43 (unwind-protect 43 ((terminal-parameter nil 'xterm-mouse-last-down) nil)
44 (progn 44 ((terminal-parameter nil 'xterm-mouse-last-click) nil))
45 ;; `xterm-mouse-mode' doesn't work in the initial 45 (if xterm-mouse-mode
46 ;; terminal. Since we can't create a second terminal in 46 ,(macroexp-progn body)
47 ;; batch mode, fake it temporarily. 47 (unwind-protect
48 (cl-letf (((symbol-function 'terminal-name) 48 (progn
49 (lambda (&optional _terminal) "fake-terminal"))) 49 ;; `xterm-mouse-mode' doesn't work in the initial
50 (xterm-mouse-mode)) 50 ;; terminal. Since we can't create a second
51 ,@body) 51 ;; terminal in batch mode, fake it temporarily.
52 (xterm-mouse-mode 0))))) 52 (cl-letf (((symbol-function 'terminal-name)
53 (lambda (&optional _terminal) "fake-terminal")))
54 (xterm-mouse-mode))
55 ,@body)
56 (xterm-mouse-mode 0)))))
57 (set-frame-width nil width)
58 (set-frame-height nil height))))
53 59
54(ert-deftest xt-mouse-tracking-basic () 60(ert-deftest xt-mouse-tracking-basic ()
55 (should (equal (xterm-mouse-tracking-enable-sequence) 61 (should (equal (xterm-mouse-tracking-enable-sequence)