Delete test that hangs

* test/lisp/tab-bar-tests.el
(tab-bar-tests-quit-restore-window): Delete test that hangs, for
the Emacs 31.1 release.  Do not merge to master.
This commit is contained in:
Sean Whitton 2026-08-24 10:05:22 +01:00
parent 249e293f7a
commit 76846eede3

View file

@ -51,147 +51,5 @@
;; Clean up tabs afterwards
(tab-bar-tabs-set nil))
(ert-deftest tab-bar-tests-quit-restore-window ()
(skip-when (pcase system-type
;; Skip test on MS-Windows in batch mode, since terminal
;; frames cannot be created in that case.
('windows-nt noninteractive)
;; This test is unreliable on macOS when run in batch mode
;; from Emacs (M-x compile).
('darwin (equal (getenv "TERM") "dumb"))
;; Emba runs the container without "--tty"
;; (the environment variable "TERM" is nil), and this
;; test fails with '(error "Could not open file: /dev/tty")'.
;; Therefore skip it unless it can use '(tty-type . "linux")'.
('gnu/linux (null (getenv "TERM")))))
(let* ((frame-params (when noninteractive
'((window-system . nil)
(tty-type . "linux"))))
(pop-up-frame-alist frame-params)
(frame-auto-hide-function 'delete-frame))
;; After commit 293eaf323a0 (bug#81575) 'frame-deletable-p'
;; checks if frames are on the same terminal. But in this test
;; the first frame F1 is on initial_terminal, but other created
;; frames are on #<terminal 1 on /dev/tty>. So create a new frame
;; on the same terminal as other created frames, and delete
;; the initial frame that is on another terminal.
(make-frame pop-up-frame-alist)
(delete-frame (car (last (frame-list))) nil)
;; 1.1. 'quit-restore-window' should delete the frame
;; from initial window (bug#59862)
(progn
(should (eq (length (frame-list)) 1))
(other-frame-prefix)
(info)
(should (eq (length (frame-list)) 2))
(should (equal (buffer-name) "*info*"))
(view-echo-area-messages)
(other-window 1)
(should (eq (length (window-list)) 2))
(should (equal (buffer-name) "*Messages*"))
(quit-window)
(should (eq (length (window-list)) 1))
(should (equal (buffer-name) "*info*"))
(quit-window)
(should (eq (length (frame-list)) 1)))
;; 1.2. 'quit-restore-window' should not delete the frame
;; from non-initial window (bug#59862)
(progn
(should (eq (length (frame-list)) 1))
(other-frame-prefix)
(info)
(should (eq (length (frame-list)) 2))
(should (equal (buffer-name) "*info*"))
(view-echo-area-messages)
(should (eq (length (window-list)) 2))
(should (equal (buffer-name) "*info*"))
(quit-window)
(should (eq (length (window-list)) 1))
(should (eq (length (frame-list)) 2))
(should (equal (buffer-name) "*Messages*"))
(quit-window)
(should (eq (length (frame-list)) 2))
;; Delete the created frame afterwards because with tty frames
;; the output of 'message' is bound to the original frame
(delete-frame (car (frame-list))))
;; 2.1. 'quit-restore-window' should close the tab
;; from initial window (bug#59862)
(progn
(should (eq (length (tab-bar-tabs)) 1))
(other-tab-prefix)
(info)
(should (eq (length (tab-bar-tabs)) 2))
(should (equal (buffer-name) "*info*"))
(view-echo-area-messages)
(other-window 1)
(should (eq (length (window-list)) 2))
(should (equal (buffer-name) "*Messages*"))
(quit-window)
(should (eq (length (window-list)) 1))
(should (equal (buffer-name) "*info*"))
(quit-window)
(should (eq (length (tab-bar-tabs)) 1)))
;; 2.2. 'quit-restore-window' should not close the tab
;; from non-initial window (bug#59862)
(progn
(should (eq (length (tab-bar-tabs)) 1))
(other-tab-prefix)
(info)
(should (eq (length (tab-bar-tabs)) 2))
(should (equal (buffer-name) "*info*"))
(view-echo-area-messages)
(should (eq (length (window-list)) 2))
(should (equal (buffer-name) "*info*"))
(quit-window)
(should (eq (length (window-list)) 1))
(should (eq (length (tab-bar-tabs)) 2))
(should (equal (buffer-name) "*Messages*"))
(quit-window)
(should (eq (length (tab-bar-tabs)) 2))
;; Clean up the tab afterwards
(tab-close))
;; 3.1. Don't delete the frame with dedicated window
;; from the second tab (bug#71386)
(with-selected-frame (make-frame frame-params)
(switch-to-buffer (generate-new-buffer "test1"))
(tab-new)
(switch-to-buffer (generate-new-buffer "test2"))
(set-window-dedicated-p (selected-window) t)
(kill-buffer)
(should (eq (length (frame-list)) 2))
(should (eq (length (tab-bar-tabs)) 1))
;; But now should delete the frame with dedicated window
;; from the last tab
(set-window-dedicated-p (selected-window) t)
(kill-buffer)
(should (eq (length (frame-list)) 1)))
;; 3.2. Don't delete the frame with an effectively-dedicated window
;; from the second tab (bug#71386)
(with-selected-frame (make-frame frame-params)
(let ((switch-to-prev-buffer-skip #'always)
(kill-buffer-quit-windows nil))
(switch-to-buffer (generate-new-buffer "test1"))
(tab-bar-new-tab)
(switch-to-buffer (generate-new-buffer "test2"))
;; This makes the window effectively dedicated.
(set-window-prev-buffers nil nil)
;; Killing the buffer should close the tab, leave one open tab,
;; and not delete the frame.
(kill-buffer)
(should (eq (length (tab-bar-tabs)) 1))
(should (eq (length (frame-list)) 2))
(delete-frame))))
;; Clean up tabs afterwards
(tab-bar-tabs-set nil))
(provide 'tab-bar-tests)
;;; tab-bar-tests.el ends here