aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/test-api.el19
-rw-r--r--test/test-printing.el5
2 files changed, 15 insertions, 9 deletions
diff --git a/test/test-api.el b/test/test-api.el
index 0715a2e..faf2e0a 100644
--- a/test/test-api.el
+++ b/test/test-api.el
@@ -18,12 +18,19 @@
(ert-deftest request-get-url ()
(should (sx-request-get-url "http://google.com"))
(should-error (sx-request-get-url "http://github.com/Bruce-Connor/does-not-exist"))
- (should
- ;; If image is not recognized, this returns nil.
- (create-image (sx-request-get-url "https://raw.githubusercontent.com/vermiculus/sx.el/master/list-and-question.png")
- 'imagemagick t
- :width (min sx-question-mode-image-max-width
- (window-body-width nil 'pixel)))))
+ (when sx-question-mode-use-images
+ (should
+ ;; If image is not recognized, this returns nil.
+ (create-image (sx-request-get-url "https://raw.githubusercontent.com/vermiculus/sx.el/master/list-and-question.png")
+ 'imagemagick t
+ :width sx-question-mode-image-max-width)))
+ ;; In case imagemacgick is not available, let's try png so we at
+ ;; least test the function.
+ (when (image-type-available-p 'png)
+ (should
+ (create-image (sx-request-get-url "https://raw.githubusercontent.com/vermiculus/sx.el/master/list-and-question.png")
+ 'png t
+ :width sx-question-mode-image-max-width))))
(ert-deftest request-get-data ()
(should-error (sx-request-get-data "tags/emacs-does-not-exist"))
diff --git a/test/test-printing.el b/test/test-printing.el
index 3125314..a6815e2 100644
--- a/test/test-printing.el
+++ b/test/test-printing.el
@@ -13,7 +13,7 @@
(defmacro question-list-regex (title votes answers &rest tags)
"Construct a matching regexp for TITLE, VOTES, and ANSWERS.
Each element of TAGS is appended at the end of the expression
-after being run through `sx-question--tag-format'."
+after being run through `sx-tag--format'."
`(rx line-start
(+ whitespace) ,(number-to-string votes)
(+ whitespace) ,(number-to-string answers)
@@ -22,8 +22,7 @@ after being run through `sx-question--tag-format'."
(+ (any whitespace digit))
(or "y" "d" "h" "m" "mo" "s") " ago"
(+ whitespace)
- (eval (mapconcat #'sx-tag--format
- (list ,@tags) " "))))
+ (eval (mapconcat #'sx-tag--format (list ,@tags) " "))))
;;; Tests