aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLars Ingebrigtsen2017-07-15 02:45:19 +0200
committerLars Ingebrigtsen2017-07-15 02:48:17 +0200
commitae56c9674b4668ded392c66d46aa22db902ddd71 (patch)
tree3472b1e2c5877ee37a0b4813f60bc2b2b5515d47 /test
parent89c5d59280edaf89b959597a39d848b54c36975a (diff)
downloademacs-ae56c9674b4668ded392c66d46aa22db902ddd71.tar.gz
emacs-ae56c9674b4668ded392c66d46aa22db902ddd71.zip
Make combinations of :width/:max-height image specs work reliably
* doc/lispref/display.texi (ImageMagick Images): Document :width/:max-height combinations (etc) (bug #25583). * src/image.c (compute_image_size): Handle :width/:max-height (etc) combinations consistently (by letting "max" win and preserve ratio). * test/manual/image-size-tests.el (image-size-tests): Add tests for :width/:max-height (etc) combinations.
Diffstat (limited to 'test')
-rw-r--r--test/manual/image-size-tests.el10
1 files changed, 8 insertions, 2 deletions
diff --git a/test/manual/image-size-tests.el b/test/manual/image-size-tests.el
index 577c7658791..6721e348e12 100644
--- a/test/manual/image-size-tests.el
+++ b/test/manual/image-size-tests.el
@@ -25,8 +25,8 @@
25(defmacro im-should (image width height &rest props) 25(defmacro im-should (image width height &rest props)
26 `(let ((im (im-image ,image ,@props))) 26 `(let ((im (im-image ,image ,@props)))
27 (unless (im-compare im ,width ,height) 27 (unless (im-compare im ,width ,height)
28 (error "%s didn't succeed; size is %s" 28 (error "%s %s didn't succeed; size is %s"
29 ',props (image-size im t))))) 29 ',image ',props (image-size im t)))))
30 30
31(defun im-image (type &rest props) 31(defun im-image (type &rest props)
32 (let ((image-scaling-factor 1)) 32 (let ((image-scaling-factor 1))
@@ -67,6 +67,9 @@
67 ;; Both max-width/height. 67 ;; Both max-width/height.
68 (im-should :w 100 50 :max-width 100 :max-height 75) 68 (im-should :w 100 50 :max-width 100 :max-height 75)
69 (im-should :w 50 25 :max-width 100 :max-height 25) 69 (im-should :w 50 25 :max-width 100 :max-height 25)
70 ;; :width and :max-height (max-height wins).
71 (im-should :w 400 200 :width 400 :max-height 200)
72 (im-should :w 400 200 :width 500 :max-height 200)
70 73
71 ;; Test the image that's taller than it is wide. 74 ;; Test the image that's taller than it is wide.
72 (im-should :h 100 200) 75 (im-should :h 100 200)
@@ -87,6 +90,9 @@
87 ;; Both max-width/height. 90 ;; Both max-width/height.
88 (im-should :h 50 100 :max-width 75 :max-height 100) 91 (im-should :h 50 100 :max-width 75 :max-height 100)
89 (im-should :h 25 50 :max-width 25 :max-height 100) 92 (im-should :h 25 50 :max-width 25 :max-height 100)
93 ;; :hieght and :max-width (max-width wins).
94 (im-should :h 200 400 :height 400 :max-width 200)
95 (im-should :h 200 400 :height 500 :max-width 200)
90 ) 96 )
91 97
92;;; image-size-tests.el ends here 98;;; image-size-tests.el ends here