diff options
| author | Stefan Kangas | 2022-04-28 17:01:20 +0200 |
|---|---|---|
| committer | Stefan Kangas | 2022-04-28 17:01:20 +0200 |
| commit | 99559be8ca809dcc3ba85a4a25ff1b9734c885c6 (patch) | |
| tree | 6fc1cc303520beb866d3ae420ca8608643060412 /test | |
| parent | 8898e4d4dd055d344b2728fe56cf601ba033cfb7 (diff) | |
| download | emacs-99559be8ca809dcc3ba85a4a25ff1b9734c885c6.tar.gz emacs-99559be8ca809dcc3ba85a4a25ff1b9734c885c6.zip | |
Add tests for image-supported-file-p
* test/lisp/image-tests.el (image-type-from-file-name): Suppress
obsoletion warnings for test.
(image-supported-file-p/built-in)
(image-supported-file-p/optional)
(image-supported-file-p/unsupported-returns-nil): New tests.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/image-tests.el | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/lisp/image-tests.el b/test/lisp/image-tests.el index 2b3e818d720..908df09f15f 100644 --- a/test/lisp/image-tests.el +++ b/test/lisp/image-tests.el | |||
| @@ -74,6 +74,18 @@ | |||
| 74 | (should (listp (find-image '((:type png :file "newsticker/rss-feed.png" :ascent center))))) | 74 | (should (listp (find-image '((:type png :file "newsticker/rss-feed.png" :ascent center))))) |
| 75 | (should-not (find-image '((:type png :file "does-not-exist-foo-bar.png"))))) | 75 | (should-not (find-image '((:type png :file "does-not-exist-foo-bar.png"))))) |
| 76 | 76 | ||
| 77 | (ert-deftest image-supported-file-p/built-in () | ||
| 78 | ;; (skip-unless (image-type-available-p 'pbm)) ; always built-in | ||
| 79 | (should (eq (image-supported-file-p "foo.pbm") 'pbm))) | ||
| 80 | |||
| 81 | (ert-deftest image-supported-file-p/optional () | ||
| 82 | (if (image-type-available-p 'jpeg) | ||
| 83 | (should (eq (image-supported-file-p "foo.jpg") 'jpeg)) | ||
| 84 | (should-not (image-supported-file-p "foo.jpg")))) | ||
| 85 | |||
| 86 | (ert-deftest image-supported-file-p/unsupported-returns-nil () | ||
| 87 | (should-not (image-supported-file-p "foo.some-unsupported-format"))) | ||
| 88 | |||
| 77 | (ert-deftest image-type-from-file-name () | 89 | (ert-deftest image-type-from-file-name () |
| 78 | (with-suppressed-warnings ((obsolete image-type-from-file-name)) | 90 | (with-suppressed-warnings ((obsolete image-type-from-file-name)) |
| 79 | (should (eq (image-type-from-file-name "foo.jpg") 'jpeg)) | 91 | (should (eq (image-type-from-file-name "foo.jpg") 'jpeg)) |