diff options
| author | Stefan Kangas | 2021-10-22 10:59:01 +0200 |
|---|---|---|
| committer | Stefan Kangas | 2021-10-22 10:59:01 +0200 |
| commit | bc2a5c112796ea9f072984b471f980e4321263b3 (patch) | |
| tree | 04c5f5effd7f1a75be9e457deed9352da43be1ef /test/src | |
| parent | 938f10c601e87154b697cdb73b44e0d44851303b (diff) | |
| download | emacs-bc2a5c112796ea9f072984b471f980e4321263b3.tar.gz emacs-bc2a5c112796ea9f072984b471f980e4321263b3.zip | |
Add WebP image format support (Bug#51296)
* configure.ac (--with-webp): New option.
(HAVE_WEBP): New variable.
(emacs_config_features): Add webp.
* src/image.c (enum webp_keyword_index) [HAVE_WEBP]: New enum.
(webp_format) [HAVE_WEBP]: New variable.
(webp_image_p, init_webp_functions, webp_load) [HAVE_WEBP]: New
functions for WebP support.
(image_types) [HAVE_WEBP]: Define WebP format.
(syms_of_image) <Qwebp> [HAVE_WEBP]: New DEFSYM. Add image type Qwebp.
* src/Makefile.in (LIBIMAGE): Add WEBP_LIBS.
* lisp/files.el (auto-mode-alist):
* lisp/image-file.el (image-file-name-extensions):
* lisp/image.el (image-type-header-regexps)
(image-type-file-name-regexps, image-type-auto-detectable): Add WebP
support.
* lisp/term/w32-win.el (dynamic-library-alist): Add the libwebp DLL.
* INSTALL:
* admin/CPP-DEFINES:
* doc/lispref/display.texi (Image Formats, Other Image Types):
* nt/INSTALL: Document WebP support.
* test/lisp/image-tests.el (image-find-image)
(image-type-from-file-name): Expand tests.
* test/src/image-tests.el (image-tests--files): Add WebP.
(image-tests-image-size/webp, image-tests-image-mask-p/webp)
(image-tests-image-metadata/webp): New tests.
* test/data/image/black.webp: New file.
Diffstat (limited to 'test/src')
| -rw-r--r-- | test/src/image-tests.el | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/test/src/image-tests.el b/test/src/image-tests.el index d5e3a7cc5ca..b921739a056 100644 --- a/test/src/image-tests.el +++ b/test/src/image-tests.el | |||
| @@ -44,6 +44,8 @@ | |||
| 44 | (tiff . ,(expand-file-name | 44 | (tiff . ,(expand-file-name |
| 45 | "nextstep/GNUstep/Emacs.base/Resources/emacs.tiff" | 45 | "nextstep/GNUstep/Emacs.base/Resources/emacs.tiff" |
| 46 | source-directory)) | 46 | source-directory)) |
| 47 | (webp . ,(expand-file-name "test/data/image/black.webp" | ||
| 48 | source-directory)) | ||
| 47 | (xbm . ,(find-image '((:file "gnus/gnus.xbm" :type xbm)))) | 49 | (xbm . ,(find-image '((:file "gnus/gnus.xbm" :type xbm)))) |
| 48 | (xpm . ,(find-image '((:file "splash.xpm" :type xpm)))) | 50 | (xpm . ,(find-image '((:file "splash.xpm" :type xpm)))) |
| 49 | ;; TODO: gif | 51 | ;; TODO: gif |
| @@ -86,6 +88,13 @@ | |||
| 86 | (should (floatp a)) | 88 | (should (floatp a)) |
| 87 | (should (floatp b))))) | 89 | (should (floatp b))))) |
| 88 | 90 | ||
| 91 | (ert-deftest image-tests-image-size/webp () | ||
| 92 | (image-skip-unless 'webp) | ||
| 93 | (pcase (image-size (create-image (cdr (assq 'webp image-tests--files)))) | ||
| 94 | (`(,a . ,b) | ||
| 95 | (should (floatp a)) | ||
| 96 | (should (floatp b))))) | ||
| 97 | |||
| 89 | (ert-deftest image-tests-image-size/xbm () | 98 | (ert-deftest image-tests-image-size/xbm () |
| 90 | (image-skip-unless 'xbm) | 99 | (image-skip-unless 'xbm) |
| 91 | (pcase (image-size (cdr (assq 'xbm image-tests--files))) | 100 | (pcase (image-size (cdr (assq 'xbm image-tests--files))) |
| @@ -130,7 +139,12 @@ | |||
| 130 | (ert-deftest image-tests-image-mask-p/tiff () | 139 | (ert-deftest image-tests-image-mask-p/tiff () |
| 131 | (image-skip-unless 'tiff) | 140 | (image-skip-unless 'tiff) |
| 132 | (should-not (image-mask-p (create-image | 141 | (should-not (image-mask-p (create-image |
| 133 | (cdr (assq 'tiff image-tests--files)))))) | 142 | (cdr (assq 'tiff image-tests--files)))))) |
| 143 | |||
| 144 | (ert-deftest image-tests-image-mask-p/webp () | ||
| 145 | (image-skip-unless 'webp) | ||
| 146 | (should-not (image-mask-p (create-image | ||
| 147 | (cdr (assq 'webp image-tests--files)))))) | ||
| 134 | 148 | ||
| 135 | (ert-deftest image-tests-image-mask-p/xbm () | 149 | (ert-deftest image-tests-image-mask-p/xbm () |
| 136 | (image-skip-unless 'xbm) | 150 | (image-skip-unless 'xbm) |
| @@ -173,7 +187,12 @@ | |||
| 173 | (ert-deftest image-tests-image-metadata/tiff () | 187 | (ert-deftest image-tests-image-metadata/tiff () |
| 174 | (image-skip-unless 'tiff) | 188 | (image-skip-unless 'tiff) |
| 175 | (should-not (image-metadata | 189 | (should-not (image-metadata |
| 176 | (create-image (cdr (assq 'tiff image-tests--files)))))) | 190 | (create-image (cdr (assq 'tiff image-tests--files)))))) |
| 191 | |||
| 192 | (ert-deftest image-tests-image-metadata/webp () | ||
| 193 | (image-skip-unless 'webp) | ||
| 194 | (should-not (image-metadata | ||
| 195 | (create-image (cdr (assq 'webp image-tests--files)))))) | ||
| 177 | 196 | ||
| 178 | (ert-deftest image-tests-image-metadata/xbm () | 197 | (ert-deftest image-tests-image-metadata/xbm () |
| 179 | (image-skip-unless 'xbm) | 198 | (image-skip-unless 'xbm) |