unofficial mirror of emacs-devel@gnu.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: Thu, 27 Jun 2024 20:51:58 -0700	[thread overview]
Message-ID: <f42b2479-185f-6e34-b938-62ba3615bde9@gmail.com> (raw)
In-Reply-To: <86y16r7krn.fsf@gnu.org>

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

On 6/26/2024 9:04 AM, Eli Zaretskii wrote:
>> Date: Wed, 26 Jun 2024 08:58:29 -0700
>> Cc: jm@pub.pink, emacs-devel@gnu.org
>> From: Jim Porter <jporterbugs@gmail.com>
>>
>> Here you go.
> 
> Thanks.  The result:
[snip]
>      (error "Timed out waiting for initial load")

Odd. It never loaded the first image (we just got the placeholder). 
Here's a patch with some additional trace statements. (I'd also be ok 
with just disabling these tests on MS-Windows if we can't figure out 
what's happening, though I'm not aware of any reason it should fail.)

[-- Attachment #2: shr-test.diff --]
[-- Type: text/plain, Size: 3220 bytes --]

diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index 3dadcb9a09b..4959001d656 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -1057,6 +1057,7 @@ shr-store-contents
 				      directory)))))
 
 (defun shr-image-fetched (status buffer start end &optional flags)
+  (message "shr-image-fetched: status = %S" status)
   (let ((image-buffer (current-buffer)))
     (when (and (buffer-name buffer)
 	       (not (plist-get status :error)))
@@ -1875,6 +1876,7 @@ shr-tag-img
                (or (string-trim alt) ""))
             ;; No SVG support.  Just use a space as our placeholder.
             (insert " "))
+          (message "shr-img-tag: calling `url-queue-retrieve'")
 	  (url-queue-retrieve
            url #'shr-image-fetched
 	   (list (current-buffer) start (set-marker (make-marker) (point))
diff --git a/test/lisp/net/shr-tests.el b/test/lisp/net/shr-tests.el
index 4864fc488e2..f4fbe8de68b 100644
--- a/test/lisp/net/shr-tests.el
+++ b/test/lisp/net/shr-tests.el
@@ -138,7 +138,8 @@ shr-test/zoom-image
   (skip-unless (bound-and-true-p image-types))
   (let ((image (expand-file-name "data/image/blank-100x200.png"
                                  (getenv "EMACS_TEST_DIRECTORY"))))
-    (dolist (alt '(nil "" "nothing to see here"))
+    (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) "")))
@@ -147,6 +148,7 @@ shr-test/zoom-image
                      ((symbol-function 'display-graphic-p) #'always)
                      ((symbol-function 'url-queue-retrieve)
                       (lambda (&rest args)
+                        (message "calling fake `url-queue-retrieve'")
                         (apply #'run-at-time 0 nil #'url-retrieve args)))
                      (put-image-calls 0)
                      (shr-put-image-function
@@ -156,16 +158,21 @@ shr-test/zoom-image
                      (shr-width 80)
                      (shr-use-fonts nil)
                      (shr-image-animate nil)
-                     (inhibit-message t)
+                     ;; (inhibit-message t)
                      (dom (libxml-parse-html-region (point-min) (point-max))))
             ;; Render the document.
             (erase-buffer)
             (shr-insert-document dom)
-            (shr-test-wait-for (lambda () (= put-image-calls 1)))
+            (message "Initial buffer contents:\n%S\n\n" (buffer-string))
+            (shr-test-wait-for (lambda () (= put-image-calls 1))
+                               "Timed out waiting for initial load")
+            (message "Fully-loaded buffer contents:\n%S\n\n" (buffer-string))
             ;; Now zoom the image.
             (goto-char (point-min))
             (shr-zoom-image)
-            (shr-test-wait-for (lambda () (= put-image-calls 2)))
+            (shr-test-wait-for (lambda () (= put-image-calls 2))
+                               "Timed out waiting to zoom image")
+            (message "Final buffer contents:\n%S\n\n" (buffer-string))
             ;; Check that we got a sliced image.
             (let ((slice-count 0))
               (goto-char (point-min))

  reply	other threads:[~2024-06-28  3:51 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 [this message]
2024-06-28 12:04                       ` Eli Zaretskii
2024-06-28 17:46                         ` Jim Porter
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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=f42b2479-185f-6e34-b938-62ba3615bde9@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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).