[PATCH 2/3] test: Add a test for HTML email with inline images

2012-10-03 Thread Dmitry Kurochkin
Austin Clements  writes:

> Quoth Dmitry Kurochkin on Oct 03 at  1:35 pm:
>> Hi Austin.
>> 
>> Austin Clements  writes:
>> 
>> > Currently this test passes in Emacs 23 but fails in Emacs 24 (at least
>> > on some Linux distributions).
>> 
>> The test fails for me on Emacs 23.4.1 (Debian unstable):
>> 
>>  FAIL   Rendering HTML mail with images
>>  --- emacs.51.OUTPUT 2012-10-03 09:31:33.383529764 +
>>  +++ emacs.51.EXPECTED   2012-10-03 09:31:33.383529764 +
>>  @@ -6,4 +6,3 @@
>>   [ multipart/related ]
>>   [ text/html ]
>>   *
>>  -
>> 
>> Did not look into details.
>
> Yes.  This test is (in hindsight, unsurprisingly) sensitive to
> whatever HTML renderer Emacs chooses.  It looks like you're probably
> using html2text, which outputs nothing for an image.  Unfortunately,
> none of the built-in renderers in Emacs 23 are aware of content
> references, which makes this test rather pointless on Emacs 23 unless
> we depend on an external renderer.
>
> The best solution I can think of dynamically chooses shr on Emacs 24
> (since that's really what we're trying to test) and gives up on Emacs
> 23 and forcibly selects html2text (test patch below).  Alternatively,
> we could cycle through all of the available renderers, test everything
> that we can, and just ignore everything that we can't run, though that
> would make the test environment-sensitive.
>

Perhaps the test should be skipped if shr is not available, like we do
for missing binaries?

Regards,
  Dmitry

> 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
>  
> -
> + smiley
>  
>  --abcd
>  Content-Type: image/gif
> @@ -766,10 +766,13 @@ Content-ID: <330 at goomoji.gmail>
>  R0lGODlhDAAMAKIFAF5LAP/zxNyuAP/gaP///wAAACH5BAEAAAUALAAMAAwAAAMl
>  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   Notmuch Test Suite  (2001-01-05) (inbox)
>  Subject: HTML mail with images
> @@ -778,7 +781,7 @@ Date: Fri, 05 Jan 2001 15:43:57 +
>  
>  [ multipart/related ]
>  [ text/html ]
> -*
> +* smiley
>  EOF
>  test_expect_equal_file OUTPUT EXPECTED
>  


[PATCH 2/3] test: Add a test for HTML email with inline images

2012-10-03 Thread Dmitry Kurochkin
Hi Austin.

Austin Clements  writes:

> Currently this test passes in Emacs 23 but fails in Emacs 24 (at least
> on some Linux distributions).

The test fails for me on Emacs 23.4.1 (Debian unstable):

 FAIL   Rendering HTML mail with images
--- emacs.51.OUTPUT 2012-10-03 09:31:33.383529764 +
+++ emacs.51.EXPECTED   2012-10-03 09:31:33.383529764 +
@@ -6,4 +6,3 @@
 [ multipart/related ]
 [ text/html ]
 *
-

Did not look into details.

Regards,
  Dmitry


[PATCH 2/3] test: Add a test for HTML email with inline images

2012-10-03 Thread Austin Clements
Quoth Dmitry Kurochkin on Oct 03 at  1:35 pm:
> Hi Austin.
> 
> Austin Clements  writes:
> 
> > Currently this test passes in Emacs 23 but fails in Emacs 24 (at least
> > on some Linux distributions).
> 
> The test fails for me on Emacs 23.4.1 (Debian unstable):
> 
>  FAIL   Rendering HTML mail with images
>   --- emacs.51.OUTPUT 2012-10-03 09:31:33.383529764 +
>   +++ emacs.51.EXPECTED   2012-10-03 09:31:33.383529764 +
>   @@ -6,4 +6,3 @@
>[ multipart/related ]
>[ text/html ]
>*
>   -
> 
> Did not look into details.

Yes.  This test is (in hindsight, unsurprisingly) sensitive to
whatever HTML renderer Emacs chooses.  It looks like you're probably
using html2text, which outputs nothing for an image.  Unfortunately,
none of the built-in renderers in Emacs 23 are aware of content
references, which makes this test rather pointless on Emacs 23 unless
we depend on an external renderer.

The best solution I can think of dynamically chooses shr on Emacs 24
(since that's really what we're trying to test) and gives up on Emacs
23 and forcibly selects html2text (test patch below).  Alternatively,
we could cycle through all of the available renderers, test everything
that we can, and just ignore everything that we can't run, though that
would make the test environment-sensitive.

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

-
+ smiley

 --abcd
 Content-Type: image/gif
@@ -766,10 +766,13 @@ Content-ID: <330 at goomoji.gmail>
 R0lGODlhDAAMAKIFAF5LAP/zxNyuAP/gaP///wAAACH5BAEAAAUALAAMAAwAAAMl
 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 

Re: [PATCH 2/3] test: Add a test for HTML email with inline images

2012-10-03 Thread Dmitry Kurochkin
Hi Austin.

Austin Clements amdra...@mit.edu writes:

 Currently this test passes in Emacs 23 but fails in Emacs 24 (at least
 on some Linux distributions).

The test fails for me on Emacs 23.4.1 (Debian unstable):

 FAIL   Rendering HTML mail with images
--- emacs.51.OUTPUT 2012-10-03 09:31:33.383529764 +
+++ emacs.51.EXPECTED   2012-10-03 09:31:33.383529764 +
@@ -6,4 +6,3 @@
 [ multipart/related ]
 [ text/html ]
 *
-

Did not look into details.

Regards,
  Dmitry
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 2/3] test: Add a test for HTML email with inline images

2012-10-03 Thread Austin Clements
Quoth Dmitry Kurochkin on Oct 03 at  1:35 pm:
 Hi Austin.
 
 Austin Clements amdra...@mit.edu writes:
 
  Currently this test passes in Emacs 23 but fails in Emacs 24 (at least
  on some Linux distributions).
 
 The test fails for me on Emacs 23.4.1 (Debian unstable):
 
  FAIL   Rendering HTML mail with images
   --- emacs.51.OUTPUT 2012-10-03 09:31:33.383529764 +
   +++ emacs.51.EXPECTED   2012-10-03 09:31:33.383529764 +
   @@ -6,4 +6,3 @@
[ multipart/related ]
[ text/html ]
*
   -
 
 Did not look into details.

Yes.  This test is (in hindsight, unsurprisingly) sensitive to
whatever HTML renderer Emacs chooses.  It looks like you're probably
using html2text, which outputs nothing for an image.  Unfortunately,
none of the built-in renderers in Emacs 23 are aware of content
references, which makes this test rather pointless on Emacs 23 unless
we depend on an external renderer.

The best solution I can think of dynamically chooses shr on Emacs 24
(since that's really what we're trying to test) and gives up on Emacs
23 and forcibly selects html2text (test patch below).  Alternatively,
we could cycle through all of the available renderers, test everything
that we can, and just ignore everything that we can't run, though that
would make the test environment-sensitive.

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/zxNyuAP/gaP///wAAACH5BAEAAAUALAAMAAwAAAMl
 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_su...@notmuchmail.org (2001-01-05) (inbox)
 Subject: HTML mail with images
@@ -778,7 +781,7 @@ Date: Fri, 05 Jan 2001 15:43:57 +
 
 [ multipart/related ]
 [ text/html ]
-*
+* smiley
 EOF
 test_expect_equal_file OUTPUT EXPECTED
 

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 2/3] test: Add a test for HTML email with inline images

2012-10-03 Thread Dmitry Kurochkin
Austin Clements amdra...@mit.edu writes:

 Quoth Dmitry Kurochkin on Oct 03 at  1:35 pm:
 Hi Austin.
 
 Austin Clements amdra...@mit.edu writes:
 
  Currently this test passes in Emacs 23 but fails in Emacs 24 (at least
  on some Linux distributions).
 
 The test fails for me on Emacs 23.4.1 (Debian unstable):
 
  FAIL   Rendering HTML mail with images
  --- emacs.51.OUTPUT 2012-10-03 09:31:33.383529764 +
  +++ emacs.51.EXPECTED   2012-10-03 09:31:33.383529764 +
  @@ -6,4 +6,3 @@
   [ multipart/related ]
   [ text/html ]
   *
  -
 
 Did not look into details.

 Yes.  This test is (in hindsight, unsurprisingly) sensitive to
 whatever HTML renderer Emacs chooses.  It looks like you're probably
 using html2text, which outputs nothing for an image.  Unfortunately,
 none of the built-in renderers in Emacs 23 are aware of content
 references, which makes this test rather pointless on Emacs 23 unless
 we depend on an external renderer.

 The best solution I can think of dynamically chooses shr on Emacs 24
 (since that's really what we're trying to test) and gives up on Emacs
 23 and forcibly selects html2text (test patch below).  Alternatively,
 we could cycle through all of the available renderers, test everything
 that we can, and just ignore everything that we can't run, though that
 would make the test environment-sensitive.


Perhaps the test should be skipped if shr is not available, like we do
for missing binaries?

Regards,
  Dmitry

 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/zxNyuAP/gaP///wAAACH5BAEAAAUALAAMAAwAAAMl
  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_su...@notmuchmail.org (2001-01-05) (inbox)
  Subject: HTML mail with images
 @@ -778,7 +781,7 @@ Date: Fri, 05 Jan 2001 15:43:57 +
  
  [ multipart/related ]
  [ text/html ]
 -*
 +* smiley
  EOF
  test_expect_equal_file OUTPUT EXPECTED
  
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 2/3] test: Add a test for HTML email with inline images

2012-09-29 Thread Austin Clements
Currently this test passes in Emacs 23 but fails in Emacs 24 (at least
on some Linux distributions).
---
 test/emacs |   34 ++
 1 file changed, 34 insertions(+)

diff --git a/test/emacs b/test/emacs
index 174a9ac..1f84b91 100755
--- a/test/emacs
+++ b/test/emacs
@@ -749,4 +749,38 @@ counter=$(test_emacs \
 )
 test_expect_equal "$counter" 2

+
+test_begin_subtest "Rendering HTML mail with images"
+add_message '[subject]="HTML mail with images"' \
+'[content-type]="multipart/related; boundary=abcd"' \
+'[body]="--abcd
+Content-Type: text/html
+
+
+
+--abcd
+Content-Type: image/gif
+Content-Transfer-Encoding: base64
+Content-ID: <330 at goomoji.gmail>
+
+R0lGODlhDAAMAKIFAF5LAP/zxNyuAP/gaP///wAAACH5BAEAAAUALAAMAAwAAAMl
+WLPcGjDKFYi9lxKBOaGcF35DhWHamZUW0K4mAbiwWtuf0uxFAgA7
+--abcd--"'
+test_emacs "(notmuch-show \"id:${gen_msg_id}\")
+   (test-output)"
+# Normalize output for Emacs 23 and Emacs 24
+sed -i 's/\[cid\]/*/' OUTPUT
+cat 

[PATCH 2/3] test: Add a test for HTML email with inline images

2012-09-29 Thread Austin Clements
Currently this test passes in Emacs 23 but fails in Emacs 24 (at least
on some Linux distributions).
---
 test/emacs |   34 ++
 1 file changed, 34 insertions(+)

diff --git a/test/emacs b/test/emacs
index 174a9ac..1f84b91 100755
--- a/test/emacs
+++ b/test/emacs
@@ -749,4 +749,38 @@ counter=$(test_emacs \
 )
 test_expect_equal $counter 2
 
+
+test_begin_subtest Rendering HTML mail with images
+add_message '[subject]=HTML mail with images' \
+'[content-type]=multipart/related; boundary=abcd' \
+'[body]=--abcd
+Content-Type: text/html
+
+img src=cid:330@goomoji.gmail
+
+--abcd
+Content-Type: image/gif
+Content-Transfer-Encoding: base64
+Content-ID: 330@goomoji.gmail
+
+R0lGODlhDAAMAKIFAF5LAP/zxNyuAP/gaP///wAAACH5BAEAAAUALAAMAAwAAAMl
+WLPcGjDKFYi9lxKBOaGcF35DhWHamZUW0K4mAbiwWtuf0uxFAgA7
+--abcd--'
+test_emacs (notmuch-show \id:${gen_msg_id}\)
+   (test-output)
+# Normalize output for Emacs 23 and Emacs 24
+sed -i 's/\[cid\]/*/' OUTPUT
+cat EOF EXPECTED
+Notmuch Test Suite test_su...@notmuchmail.org (2001-01-05) (inbox)
+Subject: HTML mail with images
+To: Notmuch Test Suite test_su...@notmuchmail.org
+Date: Fri, 05 Jan 2001 15:43:57 +
+
+[ multipart/related ]
+[ text/html ]
+*
+EOF
+test_expect_equal_file OUTPUT EXPECTED
+
+
 test_done
-- 
1.7.10

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch