emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 99559be8ca 2/2: Add tests for image-supported-file-p


From: Stefan Kangas
Subject: master 99559be8ca 2/2: Add tests for image-supported-file-p
Date: Thu, 28 Apr 2022 11:20:58 -0400 (EDT)

branch: master
commit 99559be8ca809dcc3ba85a4a25ff1b9734c885c6
Author: Stefan Kangas <stefan@marxist.se>
Commit: Stefan Kangas <stefan@marxist.se>

    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.
---
 test/lisp/image-tests.el | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/test/lisp/image-tests.el b/test/lisp/image-tests.el
index 2b3e818d72..908df09f15 100644
--- a/test/lisp/image-tests.el
+++ b/test/lisp/image-tests.el
@@ -74,6 +74,18 @@
   (should (listp (find-image '((:type png :file "newsticker/rss-feed.png" 
:ascent center)))))
   (should-not (find-image '((:type png :file "does-not-exist-foo-bar.png")))))
 
+(ert-deftest image-supported-file-p/built-in ()
+  ;; (skip-unless (image-type-available-p 'pbm)) ; always built-in
+  (should (eq (image-supported-file-p "foo.pbm") 'pbm)))
+
+(ert-deftest image-supported-file-p/optional ()
+  (if (image-type-available-p 'jpeg)
+      (should (eq (image-supported-file-p "foo.jpg") 'jpeg))
+    (should-not (image-supported-file-p "foo.jpg"))))
+
+(ert-deftest image-supported-file-p/unsupported-returns-nil ()
+  (should-not (image-supported-file-p "foo.some-unsupported-format")))
+
 (ert-deftest image-type-from-file-name ()
   (with-suppressed-warnings ((obsolete image-type-from-file-name))
     (should (eq (image-type-from-file-name "foo.jpg") 'jpeg))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]