mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
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.
This commit is contained in:
parent
89c5d59280
commit
ae56c9674b
4 changed files with 73 additions and 55 deletions
|
|
@ -25,8 +25,8 @@
|
|||
(defmacro im-should (image width height &rest props)
|
||||
`(let ((im (im-image ,image ,@props)))
|
||||
(unless (im-compare im ,width ,height)
|
||||
(error "%s didn't succeed; size is %s"
|
||||
',props (image-size im t)))))
|
||||
(error "%s %s didn't succeed; size is %s"
|
||||
',image ',props (image-size im t)))))
|
||||
|
||||
(defun im-image (type &rest props)
|
||||
(let ((image-scaling-factor 1))
|
||||
|
|
@ -67,6 +67,9 @@
|
|||
;; Both max-width/height.
|
||||
(im-should :w 100 50 :max-width 100 :max-height 75)
|
||||
(im-should :w 50 25 :max-width 100 :max-height 25)
|
||||
;; :width and :max-height (max-height wins).
|
||||
(im-should :w 400 200 :width 400 :max-height 200)
|
||||
(im-should :w 400 200 :width 500 :max-height 200)
|
||||
|
||||
;; Test the image that's taller than it is wide.
|
||||
(im-should :h 100 200)
|
||||
|
|
@ -87,6 +90,9 @@
|
|||
;; Both max-width/height.
|
||||
(im-should :h 50 100 :max-width 75 :max-height 100)
|
||||
(im-should :h 25 50 :max-width 25 :max-height 100)
|
||||
;; :hieght and :max-width (max-width wins).
|
||||
(im-should :h 200 400 :height 400 :max-width 200)
|
||||
(im-should :h 200 400 :height 500 :max-width 200)
|
||||
)
|
||||
|
||||
;;; image-size-tests.el ends here
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue