From: Austin Clements Date: Wed, 3 Oct 2012 14:28:34 +0000 (+2000) Subject: Re: [PATCH 2/3] test: Add a test for HTML email with inline images X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=7fecbc10319089cbdd5818ed4e41f52e991afd40;p=notmuch-archives.git Re: [PATCH 2/3] test: Add a test for HTML email with inline images --- diff --git a/bc/06d94b4824911b9bbc0681a6b49d445e171a2e b/bc/06d94b4824911b9bbc0681a6b49d445e171a2e new file mode 100644 index 000000000..707ff402f --- /dev/null +++ b/bc/06d94b4824911b9bbc0681a6b49d445e171a2e @@ -0,0 +1,152 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 78A98431FAF + for ; Wed, 3 Oct 2012 07:28:38 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id g7dKjNJusmxl for ; + Wed, 3 Oct 2012 07:28:38 -0700 (PDT) +Received: from dmz-mailsec-scanner-4.mit.edu (DMZ-MAILSEC-SCANNER-4.MIT.EDU + [18.9.25.15]) + by olra.theworths.org (Postfix) with ESMTP id D231D431FAE + for ; Wed, 3 Oct 2012 07:28:37 -0700 (PDT) +X-AuditID: 1209190f-b7f636d00000095b-a1-506c4b95e4a1 +Received: from mailhub-auth-4.mit.edu ( [18.7.62.39]) + by dmz-mailsec-scanner-4.mit.edu (Symantec Messaging Gateway) with SMTP + id 90.BB.02395.59B4C605; Wed, 3 Oct 2012 10:28:37 -0400 (EDT) +Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) + by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id q93ESaqe026187; + Wed, 3 Oct 2012 10:28:37 -0400 +Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91]) + (authenticated bits=0) + (User authenticated as amdragon@ATHENA.MIT.EDU) + by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q93ESY1D027134 + (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); + Wed, 3 Oct 2012 10:28:35 -0400 (EDT) +Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77) + (envelope-from ) + id 1TJPwA-0008E8-Ai; Wed, 03 Oct 2012 10:28:34 -0400 +Date: Wed, 3 Oct 2012 10:28:34 -0400 +From: Austin Clements +To: Dmitry Kurochkin +Subject: Re: [PATCH 2/3] test: Add a test for HTML email with inline images +Message-ID: <20121003142834.GC14861@mit.edu> +References: <1348941314-8377-1-git-send-email-amdragon@mit.edu> + <1348941314-8377-3-git-send-email-amdragon@mit.edu> + <87a9w3vqye.fsf@gmail.com> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <87a9w3vqye.fsf@gmail.com> +User-Agent: Mutt/1.5.21 (2010-09-15) +X-Brightmail-Tracker: + H4sIAAAAAAAAA+NgFprAKsWRmVeSWpSXmKPExsUixG6nrjvVOyfAYMl2cYurW/vZLa7fnMns + wOSxc9Zddo9nq24xBzBFcdmkpOZklqUW6dslcGUcWX+PqWCBSMWlWV9ZGxinCHQxcnJICJhI + /F7ZwwJhi0lcuLeeDcQWEtjHKLHsRUEXIxeQvZ5R4tva1YwQzgkmiYdzFkE5SxglZny+wwTS + wiKgIjF18ypmEJtNQENi2/7ljCC2iIChxK2Lr8DizALSEt9+N4PVCwt4S3S9bABbzSugI9Ex + oYkdYugkRolDs1azQSQEJU7OfMIC0awlcePfS6BmDrBBy/9xgIQ5BdQlHi9aBFYuCnTDlJPb + 2CYwCs1C0j0LSfcshO4FjMyrGGVTcqt0cxMzc4pTk3WLkxPz8lKLdE30cjNL9FJTSjcxggKb + U5J/B+O3g0qHGAU4GJV4eCX+ZwUIsSaWFVfmHmKU5GBSEuUVccsJEOJLyk+pzEgszogvKs1J + LT7EKMHBrCTC62oDlONNSaysSi3Kh0lJc7AoifNeTbnpLySQnliSmp2aWpBaBJOV4eBQkuCN + 8wJqFCxKTU+tSMvMKUFIM3FwggznARq+1hNkeHFBYm5xZjpE/hSjLsfOEwseMAqx5OXnpUqJ + 8x4DGSQAUpRRmgc3B5aQXjGKA70lzJsNUsUDTGZwk14BLWECWrJCNwtkSUkiQkqqgTGLz16a + 02A/a/z/Z4XRt08cuTZT3vbwg1/PC/LlHJ5Pvy/+2641KfxkYEcf76dJVw/eErS22qs1y3zv + JAeHDevcjvvsVZY6u2LWS55My0vPXmnck3tfu+rbTtu+0qtXZIRWV+TZmM2rZsxdpPOR9X9u + wO+v2qJfrwVv/ln8ec6eo2GPn/341vNJiaU4I9FQi7moOBEAn+sdESMDAAA= +Cc: notmuch@notmuchmail.org +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Wed, 03 Oct 2012 14:28:38 -0000 + +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 +0000 +> +++ emacs.51.EXPECTED 2012-10-03 09:31:33.383529764 +0000 +> @@ -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@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 <EXPECTED + Notmuch Test Suite (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 + +