diff options
Diffstat (limited to 'test/src')
| -rw-r--r-- | test/src/image-tests.el | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/test/src/image-tests.el b/test/src/image-tests.el index 4437d7941e9..d5e3a7cc5ca 100644 --- a/test/src/image-tests.el +++ b/test/src/image-tests.el | |||
| @@ -36,15 +36,14 @@ | |||
| 36 | ;;;; Images | 36 | ;;;; Images |
| 37 | 37 | ||
| 38 | (defconst image-tests--files | 38 | (defconst image-tests--files |
| 39 | `((jpeg . ,(create-image (expand-file-name | 39 | `((jpeg . ,(expand-file-name "test/data/image/black.jpg" |
| 40 | "test/data/image/black.jpg" | 40 | source-directory)) |
| 41 | source-directory))) | ||
| 42 | (pbm . ,(find-image '((:file "splash.svg" :type svg)))) | 41 | (pbm . ,(find-image '((:file "splash.svg" :type svg)))) |
| 43 | (png . ,(find-image '((:file "splash.png" :type png)))) | 42 | (png . ,(find-image '((:file "splash.png" :type png)))) |
| 44 | (svg . ,(find-image '((:file "splash.pbm" :type pbm)))) | 43 | (svg . ,(find-image '((:file "splash.pbm" :type pbm)))) |
| 45 | (tiff . ,(create-image (expand-file-name | 44 | (tiff . ,(expand-file-name |
| 46 | "nextstep/GNUstep/Emacs.base/Resources/emacs.tiff" | 45 | "nextstep/GNUstep/Emacs.base/Resources/emacs.tiff" |
| 47 | source-directory))) | 46 | source-directory)) |
| 48 | (xbm . ,(find-image '((:file "gnus/gnus.xbm" :type xbm)))) | 47 | (xbm . ,(find-image '((:file "gnus/gnus.xbm" :type xbm)))) |
| 49 | (xpm . ,(find-image '((:file "splash.xpm" :type xpm)))) | 48 | (xpm . ,(find-image '((:file "splash.xpm" :type xpm)))) |
| 50 | ;; TODO: gif | 49 | ;; TODO: gif |
| @@ -54,7 +53,7 @@ | |||
| 54 | 53 | ||
| 55 | (ert-deftest image-tests-image-size/jpeg () | 54 | (ert-deftest image-tests-image-size/jpeg () |
| 56 | (image-skip-unless 'jpeg) | 55 | (image-skip-unless 'jpeg) |
| 57 | (pcase (image-size (cdr (assq 'jpeg image-tests--files))) | 56 | (pcase (image-size (create-image (cdr (assq 'jpeg image-tests--files)))) |
| 58 | (`(,a . ,b) | 57 | (`(,a . ,b) |
| 59 | (should (floatp a)) | 58 | (should (floatp a)) |
| 60 | (should (floatp b))))) | 59 | (should (floatp b))))) |
| @@ -82,7 +81,7 @@ | |||
| 82 | 81 | ||
| 83 | (ert-deftest image-tests-image-size/tiff () | 82 | (ert-deftest image-tests-image-size/tiff () |
| 84 | (image-skip-unless 'tiff) | 83 | (image-skip-unless 'tiff) |
| 85 | (pcase (image-size (cdr (assq 'tiff image-tests--files))) | 84 | (pcase (image-size (create-image (cdr (assq 'tiff image-tests--files)))) |
| 86 | (`(,a . ,b) | 85 | (`(,a . ,b) |
| 87 | (should (floatp a)) | 86 | (should (floatp a)) |
| 88 | (should (floatp b))))) | 87 | (should (floatp b))))) |
| @@ -113,7 +112,8 @@ | |||
| 113 | 112 | ||
| 114 | (ert-deftest image-tests-image-mask-p/jpeg () | 113 | (ert-deftest image-tests-image-mask-p/jpeg () |
| 115 | (image-skip-unless 'jpeg) | 114 | (image-skip-unless 'jpeg) |
| 116 | (should-not (image-mask-p (cdr (assq 'jpeg image-tests--files))))) | 115 | (should-not (image-mask-p (create-image |
| 116 | (cdr (assq 'jpeg image-tests--files)))))) | ||
| 117 | 117 | ||
| 118 | (ert-deftest image-tests-image-mask-p/pbm () | 118 | (ert-deftest image-tests-image-mask-p/pbm () |
| 119 | (image-skip-unless 'pbm) | 119 | (image-skip-unless 'pbm) |
| @@ -129,7 +129,8 @@ | |||
| 129 | 129 | ||
| 130 | (ert-deftest image-tests-image-mask-p/tiff () | 130 | (ert-deftest image-tests-image-mask-p/tiff () |
| 131 | (image-skip-unless 'tiff) | 131 | (image-skip-unless 'tiff) |
| 132 | (should-not (image-mask-p (cdr (assq 'tiff image-tests--files))))) | 132 | (should-not (image-mask-p (create-image |
| 133 | (cdr (assq 'tiff image-tests--files)))))) | ||
| 133 | 134 | ||
| 134 | (ert-deftest image-tests-image-mask-p/xbm () | 135 | (ert-deftest image-tests-image-mask-p/xbm () |
| 135 | (image-skip-unless 'xbm) | 136 | (image-skip-unless 'xbm) |
| @@ -154,7 +155,8 @@ | |||
| 154 | 155 | ||
| 155 | (ert-deftest image-tests-image-metadata/jpeg () | 156 | (ert-deftest image-tests-image-metadata/jpeg () |
| 156 | (image-skip-unless 'jpeg) | 157 | (image-skip-unless 'jpeg) |
| 157 | (should-not (image-metadata (cdr (assq 'jpeg image-tests--files))))) | 158 | (should-not (image-metadata |
| 159 | (create-image (cdr (assq 'jpeg image-tests--files)))))) | ||
| 158 | 160 | ||
| 159 | (ert-deftest image-tests-image-metadata/pbm () | 161 | (ert-deftest image-tests-image-metadata/pbm () |
| 160 | (image-skip-unless 'pbm) | 162 | (image-skip-unless 'pbm) |
| @@ -170,7 +172,8 @@ | |||
| 170 | 172 | ||
| 171 | (ert-deftest image-tests-image-metadata/tiff () | 173 | (ert-deftest image-tests-image-metadata/tiff () |
| 172 | (image-skip-unless 'tiff) | 174 | (image-skip-unless 'tiff) |
| 173 | (should-not (image-metadata (cdr (assq 'tiff image-tests--files))))) | 175 | (should-not (image-metadata |
| 176 | (create-image (cdr (assq 'tiff image-tests--files)))))) | ||
| 174 | 177 | ||
| 175 | (ert-deftest image-tests-image-metadata/xbm () | 178 | (ert-deftest image-tests-image-metadata/xbm () |
| 176 | (image-skip-unless 'xbm) | 179 | (image-skip-unless 'xbm) |
| @@ -198,6 +201,7 @@ | |||
| 198 | ;;;; Initialization | 201 | ;;;; Initialization |
| 199 | 202 | ||
| 200 | (ert-deftest image-tests-init-image-library () | 203 | (ert-deftest image-tests-init-image-library () |
| 204 | (skip-unless (fboundp 'init-image-library)) | ||
| 201 | (should (init-image-library 'pbm)) ; built-in | 205 | (should (init-image-library 'pbm)) ; built-in |
| 202 | (should (init-image-library 'xpm)) ; built-in | 206 | (should (init-image-library 'xpm)) ; built-in |
| 203 | (should-not (init-image-library 'invalid-image-type))) | 207 | (should-not (init-image-library 'invalid-image-type))) |