diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2022-09-25 16:15:16 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2022-09-25 16:15:16 -0400 |
commit | 650c20f1ca4e07591a727e1cfcc74b3363d15985 (patch) | |
tree | 85d11f6437cde22f410c25e0e5f71a3131ebd07d /test/lisp/xt-mouse-tests.el | |
parent | 8869332684c2302b5ba1ead4568bbc7ba1c0183e (diff) | |
parent | 4b85ae6a24380fb67a3315eaec9233f17a872473 (diff) | |
download | emacs-650c20f1ca4e07591a727e1cfcc74b3363d15985.tar.gz emacs-650c20f1ca4e07591a727e1cfcc74b3363d15985.tar.bz2 emacs-650c20f1ca4e07591a727e1cfcc74b3363d15985.zip |
Merge 'master' into noverlay
Diffstat (limited to 'test/lisp/xt-mouse-tests.el')
-rw-r--r-- | test/lisp/xt-mouse-tests.el | 60 |
1 files changed, 33 insertions, 27 deletions
diff --git a/test/lisp/xt-mouse-tests.el b/test/lisp/xt-mouse-tests.el index 53844a6e991..379ad7bf039 100644 --- a/test/lisp/xt-mouse-tests.el +++ b/test/lisp/xt-mouse-tests.el @@ -1,6 +1,6 @@ ;;; xt-mouse-tests.el --- Test suite for xt-mouse. -*- lexical-binding: t; -*- -;; Copyright (C) 2016-2017 Free Software Foundation, Inc. +;; Copyright (C) 2016-2022 Free Software Foundation, Inc. ;; Author: Philipp Stephani <phst@google.com> @@ -28,34 +28,40 @@ (defmacro with-xterm-mouse-mode (&rest body) "Run BODY with `xterm-mouse-mode' temporarily enabled." (declare (indent 0)) - ;; Make the frame huge so that the test input events below don't hit - ;; the menu bar. - `(cl-letf (((frame-width nil) 2000) - ((frame-height nil) 2000) - ;; Reset XTerm parameters so that the tests don't get - ;; confused. - ((terminal-parameter nil 'xterm-mouse-x) nil) - ((terminal-parameter nil 'xterm-mouse-y) nil) - ((terminal-parameter nil 'xterm-mouse-last-down) nil) - ((terminal-parameter nil 'xterm-mouse-last-click) nil)) - (if xterm-mouse-mode - (progn ,@body) - (unwind-protect - (progn - ;; `xterm-mouse-mode' doesn't work in the initial - ;; terminal. Since we can't create a second terminal in - ;; batch mode, fake it temporarily. - (cl-letf (((symbol-function 'terminal-name) - (lambda (&optional _terminal) "fake-terminal"))) - (xterm-mouse-mode)) - ,@body) - (xterm-mouse-mode 0))))) + `(let ((width (frame-width)) + (height (frame-height))) + (unwind-protect + (progn + ;; Make the frame huge so that the test input events below + ;; don't hit the menu bar. + (set-frame-width nil (max width 2000)) + (set-frame-height nil (max height 2000)) + (cl-letf (;; Reset XTerm parameters so that the tests don't + ;; get confused. + ((terminal-parameter nil 'xterm-mouse-x) nil) + ((terminal-parameter nil 'xterm-mouse-y) nil) + ((terminal-parameter nil 'xterm-mouse-last-down) nil) + ((terminal-parameter nil 'xterm-mouse-last-click) nil)) + (if xterm-mouse-mode + ,(macroexp-progn body) + (unwind-protect + (progn + ;; `xterm-mouse-mode' doesn't work in the initial + ;; terminal. Since we can't create a second + ;; terminal in batch mode, fake it temporarily. + (cl-letf (((symbol-function 'terminal-name) + (lambda (&optional _terminal) "fake-terminal"))) + (xterm-mouse-mode)) + ,@body) + (xterm-mouse-mode 0))))) + (set-frame-width nil width) + (set-frame-height nil height)))) (ert-deftest xt-mouse-tracking-basic () (should (equal (xterm-mouse-tracking-enable-sequence) - "\e[?1000h\e[?1002h\e[?1006h")) + "\e[?1000h\e[?1003h\e[?1006h")) (should (equal (xterm-mouse-tracking-disable-sequence) - "\e[?1006l\e[?1002l\e[?1000l")) + "\e[?1006l\e[?1003l\e[?1000l")) (with-xterm-mouse-mode (should xterm-mouse-mode) (should (terminal-parameter nil 'xterm-mouse-mode)) @@ -73,9 +79,9 @@ (ert-deftest xt-mouse-tracking-utf-8 () (let ((xterm-mouse-utf-8 t)) (should (equal (xterm-mouse-tracking-enable-sequence) - "\e[?1000h\e[?1002h\e[?1005h\e[?1006h")) + "\e[?1000h\e[?1003h\e[?1005h\e[?1006h")) (should (equal (xterm-mouse-tracking-disable-sequence) - "\e[?1006l\e[?1005l\e[?1002l\e[?1000l")) + "\e[?1006l\e[?1005l\e[?1003l\e[?1000l")) (with-xterm-mouse-mode (should xterm-mouse-mode) (should (terminal-parameter nil 'xterm-mouse-mode)) |