diff options
-rw-r--r-- | lisp/image.el | 4 | ||||
-rw-r--r-- | test/lisp/image-tests.el | 11 |
2 files changed, 13 insertions, 2 deletions
diff --git a/lisp/image.el b/lisp/image.el index ba87d7f7859..db113020866 100644 --- a/lisp/image.el +++ b/lisp/image.el @@ -315,7 +315,7 @@ be determined." (buffer-substring (point-min) (min (point-max) - (+ (point-min) 256)))))) + (+ (point-min) 8192)))))) (setq image-type (cdr image-type)))) (setq type image-type types nil) @@ -339,7 +339,7 @@ be determined." (file-readable-p file) (with-temp-buffer (set-buffer-multibyte nil) - (insert-file-contents-literally file nil 0 256) + (insert-file-contents-literally file nil 0 8192) (image-type-from-buffer)))) diff --git a/test/lisp/image-tests.el b/test/lisp/image-tests.el index 89b926e629d..621646e5750 100644 --- a/test/lisp/image-tests.el +++ b/test/lisp/image-tests.el @@ -22,6 +22,10 @@ (require 'ert) (require 'image) +(defconst image-tests--emacs-images-directory + (expand-file-name "../etc/images" (getenv "EMACS_TEST_DIRECTORY")) + "Directory containing Emacs images.") + (ert-deftest image--set-property () "Test `image--set-property' behavior." (let ((image (list 'image))) @@ -42,4 +46,11 @@ (setf (image-property image :width) nil) (should (equal image '(image))))) +(ert-deftest image-type-from-file-header-test () + "Test image-type-from-file-header." + (should (eq 'svg + (image-type-from-file-header + (expand-file-name "splash.svg" + image-tests--emacs-images-directory))))) + ;;; image-tests.el ends here |