aboutsummaryrefslogtreecommitdiffstats
path: root/test/manual
diff options
context:
space:
mode:
authorVibhav Pant2020-08-21 14:04:35 +0530
committerVibhav Pant2020-08-21 14:04:35 +0530
commitf0f8d7b82492e741950c363a03b886965c91b1b0 (patch)
tree19b716830b1ebabc0d7d75949c4e6800c0f104ad /test/manual
parent9e64a087c4d167e7ec1c4e22bea3e6af53b563de (diff)
parentc818c29771d3cb51875643b2f6c894073e429dd2 (diff)
downloademacs-feature/native-comp-macos-fixes.tar.gz
emacs-feature/native-comp-macos-fixes.zip
Merge branch 'feature/native-comp' into feature/native-comp-macos-fixesfeature/native-comp-macos-fixes
Diffstat (limited to 'test/manual')
-rw-r--r--test/manual/etags/c-src/abbrev.c14
-rw-r--r--test/manual/image-circular-tests.el144
2 files changed, 144 insertions, 14 deletions
diff --git a/test/manual/etags/c-src/abbrev.c b/test/manual/etags/c-src/abbrev.c
index 03b9f0e65b8..44563d6046a 100644
--- a/test/manual/etags/c-src/abbrev.c
+++ b/test/manual/etags/c-src/abbrev.c
@@ -78,9 +78,6 @@ Lisp_Object Vlast_abbrev_text;
78 78
79int last_abbrev_point; 79int last_abbrev_point;
80 80
81/* Hook to run before expanding any abbrev. */
82
83Lisp_Object Vpre_abbrev_expand_hook, Qpre_abbrev_expand_hook;
84 81
85DEFUN ("make-abbrev-table", Fmake_abbrev_table, Smake_abbrev_table, 0, 0, 0, 82DEFUN ("make-abbrev-table", Fmake_abbrev_table, Smake_abbrev_table, 0, 0, 0,
86 "Create a new, empty abbrev table object.") 83 "Create a new, empty abbrev table object.")
@@ -232,9 +229,6 @@ Returns the abbrev symbol, if expansion took place.")
232 229
233 value = Qnil; 230 value = Qnil;
234 231
235 if (!NILP (Vrun_hooks))
236 call1 (Vrun_hooks, Qpre_abbrev_expand_hook);
237
238 wordstart = 0; 232 wordstart = 0;
239 if (!(BUFFERP (Vabbrev_start_location_buffer) 233 if (!(BUFFERP (Vabbrev_start_location_buffer)
240 && XBUFFER (Vabbrev_start_location_buffer) == current_buffer)) 234 && XBUFFER (Vabbrev_start_location_buffer) == current_buffer))
@@ -595,14 +589,6 @@ This causes `save-some-buffers' to offer to save the abbrevs.");
595 "*Set non-nil means expand multi-word abbrevs all caps if abbrev was so."); 589 "*Set non-nil means expand multi-word abbrevs all caps if abbrev was so.");
596 abbrev_all_caps = 0; 590 abbrev_all_caps = 0;
597 591
598 DEFVAR_LISP ("pre-abbrev-expand-hook", &Vpre_abbrev_expand_hook,
599 "Function or functions to be called before abbrev expansion is done.\n\
600This is the first thing that `expand-abbrev' does, and so this may change\n\
601the current abbrev table before abbrev lookup happens.");
602 Vpre_abbrev_expand_hook = Qnil;
603 Qpre_abbrev_expand_hook = intern ("pre-abbrev-expand-hook");
604 staticpro (&Qpre_abbrev_expand_hook);
605
606 defsubr (&Smake_abbrev_table); 592 defsubr (&Smake_abbrev_table);
607 defsubr (&Sclear_abbrev_table); 593 defsubr (&Sclear_abbrev_table);
608 defsubr (&Sdefine_abbrev); 594 defsubr (&Sdefine_abbrev);
diff --git a/test/manual/image-circular-tests.el b/test/manual/image-circular-tests.el
new file mode 100644
index 00000000000..33ea3ea9547
--- /dev/null
+++ b/test/manual/image-circular-tests.el
@@ -0,0 +1,144 @@
1;;; image-tests.el --- Test suite for image-related functions.
2
3;; Copyright (C) 2019 Free Software Foundation, Inc.
4
5;; Author: Pip Cet <pipcet@gmail.com>
6;; Keywords: internal
7;; Human-Keywords: internal
8
9;; This file is part of GNU Emacs.
10
11;; GNU Emacs is free software: you can redistribute it and/or modify
12;; it under the terms of the GNU General Public License as published by
13;; the Free Software Foundation, either version 3 of the License, or
14;; (at your option) any later version.
15
16;; GNU Emacs is distributed in the hope that it will be useful,
17;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19;; GNU General Public License for more details.
20
21;; You should have received a copy of the GNU General Public License
22;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
23
24;;; Commentary:
25
26;;; Code:
27
28(require 'ert)
29
30(ert-deftest image-test-duplicate-keywords ()
31 "Test that duplicate keywords in an image spec lead to rejection."
32 (should-error (image-size `(image :type xbm :type xbm :width 1 :height 1
33 :data ,(bool-vector t))
34 t)))
35
36(ert-deftest image-test-circular-plist ()
37 "Test that a circular image spec is rejected."
38 (should-error
39 (let ((l `(image :type xbm :width 1 :height 1 :data ,(bool-vector t))))
40 (setcdr (last l) '#1=(:invalid . #1#))
41 (image-size l t))))
42
43(ert-deftest image-test-:type-property-value ()
44 "Test that :type is allowed as a property value in an image spec."
45 (should (equal (image-size `(image :dummy :type :type xbm :width 1 :height 1
46 :data ,(bool-vector t))
47 t)
48 (cons 1 1))))
49
50(ert-deftest image-test-circular-specs ()
51 "Test that circular image spec property values do not cause infinite recursion."
52 (should
53 (let* ((circ1 (cons :dummy nil))
54 (circ2 (cons :dummy nil))
55 (spec1 `(image :type xbm :width 1 :height 1
56 :data ,(bool-vector 1) :ignored ,circ1))
57 (spec2 `(image :type xbm :width 1 :height 1
58 :data ,(bool-vector 1) :ignored ,circ2)))
59 (setcdr circ1 circ1)
60 (setcdr circ2 circ2)
61 (and (equal (image-size spec1 t) (cons 1 1))
62 (equal (image-size spec2 t) (cons 1 1))))))
63
64(provide 'image-tests)
65;;; image-tests.el ends here.
66;;; image-tests.el --- tests for image.el -*- lexical-binding: t -*-
67
68;; Copyright (C) 2019-2020 Free Software Foundation, Inc.
69
70;; This file is part of GNU Emacs.
71
72;; GNU Emacs is free software: you can redistribute it and/or modify
73;; it under the terms of the GNU General Public License as published by
74;; the Free Software Foundation, either version 3 of the License, or
75;; (at your option) any later version.
76
77;; GNU Emacs is distributed in the hope that it will be useful,
78;; but WITHOUT ANY WARRANTY; without even the implied warranty of
79;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
80;; GNU General Public License for more details.
81
82;; You should have received a copy of the GNU General Public License
83;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
84
85;;; Code:
86
87(require 'ert)
88(require 'image)
89(eval-when-compile
90 (require 'cl-lib))
91
92(defconst image-tests--emacs-images-directory
93 (expand-file-name "../etc/images" (getenv "EMACS_TEST_DIRECTORY"))
94 "Directory containing Emacs images.")
95
96(ert-deftest image--set-property ()
97 "Test `image--set-property' behavior."
98 (let ((image (list 'image)))
99 ;; Add properties.
100 (setf (image-property image :scale) 1)
101 (should (equal image '(image :scale 1)))
102 (setf (image-property image :width) 8)
103 (should (equal image '(image :scale 1 :width 8)))
104 (setf (image-property image :height) 16)
105 (should (equal image '(image :scale 1 :width 8 :height 16)))
106 ;; Delete properties.
107 (setf (image-property image :type) nil)
108 (should (equal image '(image :scale 1 :width 8 :height 16)))
109 (setf (image-property image :scale) nil)
110 (should (equal image '(image :width 8 :height 16)))
111 (setf (image-property image :height) nil)
112 (should (equal image '(image :width 8)))
113 (setf (image-property image :width) nil)
114 (should (equal image '(image)))))
115
116(ert-deftest image-type-from-file-header-test ()
117 "Test image-type-from-file-header."
118 (should (eq (if (image-type-available-p 'svg) 'svg)
119 (image-type-from-file-header
120 (expand-file-name "splash.svg"
121 image-tests--emacs-images-directory)))))
122
123(ert-deftest image-rotate ()
124 "Test `image-rotate'."
125 (cl-letf* ((image (list 'image))
126 ((symbol-function 'image--get-imagemagick-and-warn)
127 (lambda () image)))
128 (let ((current-prefix-arg '(4)))
129 (call-interactively #'image-rotate))
130 (should (equal image '(image :rotation 270.0)))
131 (call-interactively #'image-rotate)
132 (should (equal image '(image :rotation 0.0)))
133 (image-rotate)
134 (should (equal image '(image :rotation 90.0)))
135 (image-rotate 0)
136 (should (equal image '(image :rotation 90.0)))
137 (image-rotate 1)
138 (should (equal image '(image :rotation 91.0)))
139 (image-rotate 1234.5)
140 (should (equal image '(image :rotation 245.5)))
141 (image-rotate -154.5)
142 (should (equal image '(image :rotation 91.0)))))
143
144;;; image-tests.el ends here