aboutsummaryrefslogtreecommitdiffstats
path: root/test/lisp
diff options
context:
space:
mode:
authorBasil L. Contovounesios2019-07-16 22:51:27 +0100
committerBasil L. Contovounesios2019-07-20 16:00:31 +0100
commitb728620a756db78b8cb0a41afa72db6209102cdf (patch)
tree30b5a0597791fe9a47cae18dda203d737b453bfa /test/lisp
parent6b882ea3532fffe31e2f27bfec265129a5e80348 (diff)
downloademacs-b728620a756db78b8cb0a41afa72db6209102cdf.tar.gz
emacs-b728620a756db78b8cb0a41afa72db6209102cdf.zip
Allow counter-clockwise rotations in image-rotate
* lisp/image.el (image-rotate): Extend with an optional argument specifying the rotation in degrees (bug#35421). * doc/lispref/display.texi (Showing Images): * etc/NEWS: Document the change. * test/lisp/image-tests.el (image-rotate): New test.
Diffstat (limited to 'test/lisp')
-rw-r--r--test/lisp/image-tests.el23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/lisp/image-tests.el b/test/lisp/image-tests.el
index 5a5b8ea1f71..01c81e3022f 100644
--- a/test/lisp/image-tests.el
+++ b/test/lisp/image-tests.el
@@ -21,6 +21,8 @@
21 21
22(require 'ert) 22(require 'ert)
23(require 'image) 23(require 'image)
24(eval-when-compile
25 (require 'cl-lib))
24 26
25(defconst image-tests--emacs-images-directory 27(defconst image-tests--emacs-images-directory
26 (expand-file-name "../etc/images" (getenv "EMACS_TEST_DIRECTORY")) 28 (expand-file-name "../etc/images" (getenv "EMACS_TEST_DIRECTORY"))
@@ -53,4 +55,25 @@
53 (expand-file-name "splash.svg" 55 (expand-file-name "splash.svg"
54 image-tests--emacs-images-directory))))) 56 image-tests--emacs-images-directory)))))
55 57
58(ert-deftest image-rotate ()
59 "Test `image-rotate'."
60 (cl-letf* ((image (list 'image))
61 ((symbol-function 'image--get-imagemagick-and-warn)
62 (lambda () image)))
63 (let ((current-prefix-arg '(4)))
64 (call-interactively #'image-rotate))
65 (should (equal image '(image :rotation 270.0)))
66 (call-interactively #'image-rotate)
67 (should (equal image '(image :rotation 0.0)))
68 (image-rotate)
69 (should (equal image '(image :rotation 90.0)))
70 (image-rotate 0)
71 (should (equal image '(image :rotation 90.0)))
72 (image-rotate 1)
73 (should (equal image '(image :rotation 91.0)))
74 (image-rotate 1234.5)
75 (should (equal image '(image :rotation 245.5)))
76 (image-rotate -154.5)
77 (should (equal image '(image :rotation 91.0)))))
78
56;;; image-tests.el ends here 79;;; image-tests.el ends here