[PATCH] test: Fix HTML rendering test

Subject: [PATCH] test: Fix HTML rendering test

Date: Wed, 24 Oct 2012 16:06:00 -0400

To: notmuch@notmuchmail.org

Cc:

From: Austin Clements


The test designed to exercise Emacs' rendering of HTML emails
containing images inadvertently assumed w3m was available under Emacs
23.  The real point of this test was to exercise Emacs 24's shr
renderer, so if shr isn't available, we now fall back to html2text,
which comes with Emacs.
---
 test/emacs |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/test/emacs b/test/emacs
index 1f84b91..2ef78bf 100755
--- a/test/emacs
+++ b/test/emacs
@@ -756,7 +756,7 @@ add_message '[subject]="HTML mail with images"' \
     '[body]="--abcd
 Content-Type: text/html
 
-<img src="cid:330@goomoji.gmail">
+<img src="cid:330@goomoji.gmail"> smiley
 
 --abcd
 Content-Type: image/gif
@@ -766,10 +766,13 @@ Content-ID: <330@goomoji.gmail>
 R0lGODlhDAAMAKIFAF5LAP/zxAAAANyuAP/gaP///wAAAAAAACH5BAEAAAUALAAAAAAMAAwAAAMl
 WLPcGjDKFYi9lxKBOaGcF35DhWHamZUW0K4mAbiwWtuf0uxFAgA7
 --abcd--"'
-test_emacs "(notmuch-show \"id:${gen_msg_id}\")
+test_emacs "(let ((mm-text-html-renderer
+		   (if (assq 'shr mm-text-html-renderer-alist)
+		       'shr 'html2text)))
+	      (notmuch-show \"id:${gen_msg_id}\"))
 	    (test-output)"
 # Normalize output for Emacs 23 and Emacs 24
-sed -i 's/\[cid\]/*/' OUTPUT
+sed -i 's/^ smiley/* smiley/' OUTPUT
 cat <<EOF >EXPECTED
 Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-05) (inbox)
 Subject: HTML mail with images
@@ -778,7 +781,7 @@ Date: Fri, 05 Jan 2001 15:43:57 +0000
 
 [ multipart/related ]
 [ text/html ]
-*
+* smiley
 EOF
 test_expect_equal_file OUTPUT EXPECTED
 
-- 
1.7.10


Thread: