aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJim Porter2024-06-28 10:40:05 -0700
committerJim Porter2024-06-29 14:59:20 -0700
commiteaf2dc96c1f44fe8e07cf19614d7b73df9397ea0 (patch)
tree76e5d3984d6bb2f4655c1d051aab0c95bcf56b9c /test
parent57880f597c56f4ba2521a731a7e87f920f0afbfd (diff)
downloademacs-eaf2dc96c1f44fe8e07cf19614d7b73df9397ea0.tar.gz
emacs-eaf2dc96c1f44fe8e07cf19614d7b73df9397ea0.zip
; Fix SHR test on MS-Windows
* test/lisp/net/shr-tests.el (shr-test/zoom-image): Ensure the image URL is properly formatted: it should always have 3 slashes after "file:".
Diffstat (limited to 'test')
-rw-r--r--test/lisp/net/shr-tests.el14
1 files changed, 9 insertions, 5 deletions
diff --git a/test/lisp/net/shr-tests.el b/test/lisp/net/shr-tests.el
index 4864fc488e2..54d85ee95f9 100644
--- a/test/lisp/net/shr-tests.el
+++ b/test/lisp/net/shr-tests.el
@@ -136,13 +136,15 @@ settings, then once more for each (OPTION . VALUE) pair.")
136(ert-deftest shr-test/zoom-image () 136(ert-deftest shr-test/zoom-image ()
137 "Test that `shr-zoom-image' properly replaces the original image." 137 "Test that `shr-zoom-image' properly replaces the original image."
138 (skip-unless (bound-and-true-p image-types)) 138 (skip-unless (bound-and-true-p image-types))
139 (let ((image (expand-file-name "data/image/blank-100x200.png" 139 (let* ((image (expand-file-name "data/image/blank-100x200.png"
140 (getenv "EMACS_TEST_DIRECTORY")))) 140 (getenv "EMACS_TEST_DIRECTORY")))
141 (image-url (concat "file://" (if (string-prefix-p "/" image)
142 image (concat "/" image)))))
141 (dolist (alt '(nil "" "nothing to see here")) 143 (dolist (alt '(nil "" "nothing to see here"))
142 (with-temp-buffer 144 (with-temp-buffer
143 (ert-info ((format "image with alt=%S" alt)) 145 (ert-info ((format "image with alt=%S" alt))
144 (let ((attrs (if alt (format " alt=\"%s\"" alt) ""))) 146 (let ((attrs (if alt (format " alt=\"%s\"" alt) "")))
145 (insert (format "<img src=\"file://%s\" %s" image attrs))) 147 (insert (format "<img src=\"%s\" %s" image-url attrs)))
146 (cl-letf* (;; Pretend we're a graphical display. 148 (cl-letf* (;; Pretend we're a graphical display.
147 ((symbol-function 'display-graphic-p) #'always) 149 ((symbol-function 'display-graphic-p) #'always)
148 ((symbol-function 'url-queue-retrieve) 150 ((symbol-function 'url-queue-retrieve)
@@ -161,11 +163,13 @@ settings, then once more for each (OPTION . VALUE) pair.")
161 ;; Render the document. 163 ;; Render the document.
162 (erase-buffer) 164 (erase-buffer)
163 (shr-insert-document dom) 165 (shr-insert-document dom)
164 (shr-test-wait-for (lambda () (= put-image-calls 1))) 166 (shr-test-wait-for (lambda () (= put-image-calls 1))
167 "Timed out waiting for initial load")
165 ;; Now zoom the image. 168 ;; Now zoom the image.
166 (goto-char (point-min)) 169 (goto-char (point-min))
167 (shr-zoom-image) 170 (shr-zoom-image)
168 (shr-test-wait-for (lambda () (= put-image-calls 2))) 171 (shr-test-wait-for (lambda () (= put-image-calls 2))
172 "Timed out waiting to zoom image")
169 ;; Check that we got a sliced image. 173 ;; Check that we got a sliced image.
170 (let ((slice-count 0)) 174 (let ((slice-count 0))
171 (goto-char (point-min)) 175 (goto-char (point-min))