all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jim Porter <jporterbugs@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: jm@pub.pink, emacs-devel@gnu.org
Subject: Re: master 5f9b5803bea: Fix zooming images in SHR
Date: Fri, 28 Jun 2024 10:46:14 -0700	[thread overview]
Message-ID: <f499debd-772d-5c52-dc7b-5ce06519f4dd@gmail.com> (raw)
In-Reply-To: <867ce946kc.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 1157 bytes --]

On 6/28/2024 5:04 AM, Eli Zaretskii wrote:
> I'd prefer to defer the decision about skipping until we fully
> understand what happens here.  If the output below doesn't give a
> clue, could you perhaps explain to me the idea of this test in more
> detail, so I could perhaps also think about the reasons?

I had a sudden realization about what the problem might be. I *think* 
this patch should resolve the issue. Could you try it?

The issue (I believe) is that on MS-Windows, the "file:" URL to the 
image we're trying to load wasn't formatted correctly. That meant that 
'url-retrieve' never successfully loaded the image, so the test stalled.

If that *doesn't* fix the issue, here's a quick summary of what the test 
is doing:

1. Load a simple HTML page with an image (using one from the test directory)
2. Wait for SHR to insert the real image, which happens asynchronously.
3. Put point on the image and call 'shr-zoom-image'.
4. Wait for SHR to insert the updated image.
5. Check that we have a new (sliced) image in the buffer.

(The test repeats the above steps for a few different cases, each with 
different values of the HTML "alt" attribute.)

[-- Attachment #2: 0001-Fix-SHR-test-on-MS-Windows.patch --]
[-- Type: text/plain, Size: 1747 bytes --]

From 50301f502c7e32efe34ca3db3bf0c1c64ccd5df8 Mon Sep 17 00:00:00 2001
From: Jim Porter <jporterbugs@gmail.com>
Date: Fri, 28 Jun 2024 10:40:05 -0700
Subject: [PATCH] ; 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:".
---
 test/lisp/net/shr-tests.el | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/test/lisp/net/shr-tests.el b/test/lisp/net/shr-tests.el
index 4864fc488e2..1f8dcd57cbe 100644
--- a/test/lisp/net/shr-tests.el
+++ b/test/lisp/net/shr-tests.el
@@ -136,13 +136,15 @@ shr-srcset
 (ert-deftest shr-test/zoom-image ()
   "Test that `shr-zoom-image' properly replaces the original image."
   (skip-unless (bound-and-true-p image-types))
-  (let ((image (expand-file-name "data/image/blank-100x200.png"
-                                 (getenv "EMACS_TEST_DIRECTORY"))))
+  (let* ((image (expand-file-name "data/image/blank-100x200.png"
+                                  (getenv "EMACS_TEST_DIRECTORY")))
+         (image-url (concat "file://" (if (string-prefix-p "/" image)
+                                          image (concat "/" image)))))
     (dolist (alt '(nil "" "nothing to see here"))
       (with-temp-buffer
         (ert-info ((format "image with alt=%S" alt))
           (let ((attrs (if alt (format " alt=\"%s\"" alt) "")))
-            (insert (format "<img src=\"file://%s\" %s" image attrs)))
+            (insert (format "<img src=\"%s\" %s" image-url attrs)))
           (cl-letf* (;; Pretend we're a graphical display.
                      ((symbol-function 'display-graphic-p) #'always)
                      ((symbol-function 'url-queue-retrieve)
-- 
2.25.1


  reply	other threads:[~2024-06-28 17:46 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <171912324641.7384.11296304660836747605@vcs2.savannah.gnu.org>
     [not found] ` <20240623061407.0C6DDC1FB5C@vcs2.savannah.gnu.org>
2024-06-23 14:36   ` master 5f9b5803bea: Fix zooming images in SHR john muhl
2024-06-23 18:42     ` Jim Porter
2024-06-23 19:23       ` Eli Zaretskii
2024-06-23 22:13         ` Jim Porter
2024-06-24 11:51           ` Eli Zaretskii
2024-06-26  5:09             ` Jim Porter
2024-06-26 13:49               ` Eli Zaretskii
2024-06-26 15:58                 ` Jim Porter
2024-06-26 16:04                   ` Eli Zaretskii
2024-06-28  3:51                     ` Jim Porter
2024-06-28 12:04                       ` Eli Zaretskii
2024-06-28 17:46                         ` Jim Porter [this message]
2024-06-29 11:09                           ` Eli Zaretskii
2024-06-29 22:00                             ` Jim Porter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f499debd-772d-5c52-dc7b-5ce06519f4dd@gmail.com \
    --to=jporterbugs@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=jm@pub.pink \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.