]> git.eshelyaron.com Git - emacs.git/commitdiff
Add tab-bar test for "effectively dedicated window" (bug#71386)
authorshipmints <shipmints@gmail.com>
Fri, 4 Apr 2025 17:25:55 +0000 (13:25 -0400)
committerEshel Yaron <me@eshelyaron.com>
Tue, 8 Apr 2025 05:43:47 +0000 (07:43 +0200)
* test/lisp/tab-bar-tests.el (tab-bar-tests-quit-restore-window):
New test for 'delete-frame' for effectively-dedicated windows.

(cherry picked from commit 5fc1bd879e41e79601cff27db175d2ad22eafb66)

test/lisp/tab-bar-tests.el

index c0e12cf159c26a9a5b95bb6f84b138c0e3c65dfb..a26d15ce977de514ce62772cdc4ea2a60f7a235a 100644 (file)
       ;; Clean up the tab afterwards
       (tab-close))
 
-    ;; 3. Don't delete the frame with dedicated window
+    ;; 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"))
       (kill-buffer)
       (should (eq (length (frame-list)) 1)))
 
-    ;; Clean up tabs afterwards
-    (tab-bar-tabs-set nil)))
+    ;; 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