diff options
Diffstat (limited to 'test/src')
| -rw-r--r-- | test/src/terminal-tests.el | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/test/src/terminal-tests.el b/test/src/terminal-tests.el new file mode 100644 index 00000000000..85c4fa04efc --- /dev/null +++ b/test/src/terminal-tests.el | |||
| @@ -0,0 +1,55 @@ | |||
| 1 | ;;; terminal-tests.el --- tests for terminal.c -*- lexical-binding: t -*- | ||
| 2 | |||
| 3 | ;; Copyright (C) 2026 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | ;; This file is part of GNU Emacs. | ||
| 6 | |||
| 7 | ;; GNU Emacs is free software: you can redistribute it and/or modify | ||
| 8 | ;; it under the terms of the GNU General Public License as published by | ||
| 9 | ;; the Free Software Foundation, either version 3 of the License, or | ||
| 10 | ;; (at your option) any later version. | ||
| 11 | |||
| 12 | ;; GNU Emacs is distributed in the hope that it will be useful, | ||
| 13 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | ;; GNU General Public License for more details. | ||
| 16 | |||
| 17 | ;; You should have received a copy of the GNU General Public License | ||
| 18 | ;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. | ||
| 19 | |||
| 20 | ;;; Code: | ||
| 21 | |||
| 22 | (require 'ert) | ||
| 23 | |||
| 24 | (ert-deftest frame-initial-p () | ||
| 25 | "Test `frame-initial-p' behavior." | ||
| 26 | (should-not (frame-initial-p t)) | ||
| 27 | (should-not (frame-initial-p (current-buffer))) | ||
| 28 | (should-not (frame-initial-p (selected-window))) | ||
| 29 | ;; "Initial frame" implies "initial terminal", and | ||
| 30 | ;; no other terminal can have the initial frame. | ||
| 31 | (should-not (xor (equal (terminal-name) "initial_terminal") | ||
| 32 | (frame-initial-p))) | ||
| 33 | ;; Initial frame implies its terminal is a termcap-like | ||
| 34 | ;; text-mode terminal. | ||
| 35 | (should (or (not (frame-initial-p)) | ||
| 36 | (eq (terminal-live-p nil) t))) | ||
| 37 | ;; It similarly implies a termcap-like text-mode frame. | ||
| 38 | (should (or (not (frame-initial-p)) | ||
| 39 | (eq (frame-live-p (selected-frame)) t))) | ||
| 40 | (dolist (ft (append '(nil) (frame-list) (terminal-list))) | ||
| 41 | (ert-info ((prin1-to-string ft) :prefix "Argument: ") | ||
| 42 | (should-not (xor (equal (terminal-name ft) "initial_terminal") | ||
| 43 | (frame-initial-p ft))) | ||
| 44 | (should (or (not (frame-initial-p ft)) | ||
| 45 | (eq (terminal-live-p ft) t))))) | ||
| 46 | (cond (noninteractive | ||
| 47 | ;; Batch mode should have an initial frame. | ||
| 48 | (should (any #'frame-initial-p (frame-list))) | ||
| 49 | (should (any #'frame-initial-p (terminal-list)))) | ||
| 50 | ((not (daemonp)) | ||
| 51 | ;; Non-daemon interactive mode should have none. | ||
| 52 | (should-not (any #'frame-initial-p (frame-list))) | ||
| 53 | (should-not (any #'frame-initial-p (terminal-list)))))) | ||
| 54 | |||
| 55 | ;;; terminal-tests.el ends here | ||