From b6afe4e2e9cd66c79c34ffd7cea79b07a90fd2a7 Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Mon, 12 Nov 2012 20:12:07 +1900 Subject: [PATCH] [PATCH v2] test: Fix HTML rendering test --- 6a/2dbd6e7963740f3590570724ce152cabb7c669 | 140 ++++++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100644 6a/2dbd6e7963740f3590570724ce152cabb7c669 diff --git a/6a/2dbd6e7963740f3590570724ce152cabb7c669 b/6a/2dbd6e7963740f3590570724ce152cabb7c669 new file mode 100644 index 000000000..234ec726c --- /dev/null +++ b/6a/2dbd6e7963740f3590570724ce152cabb7c669 @@ -0,0 +1,140 @@ +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 C02D1431FB6 + for ; Sun, 11 Nov 2012 17:12:23 -0800 (PST) +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 bB6lqtLv5Vt6 for ; + Sun, 11 Nov 2012 17:12:22 -0800 (PST) +Received: from dmz-mailsec-scanner-8.mit.edu (DMZ-MAILSEC-SCANNER-8.MIT.EDU + [18.7.68.37]) + by olra.theworths.org (Postfix) with ESMTP id 88E90431FAF + for ; Sun, 11 Nov 2012 17:12:22 -0800 (PST) +X-AuditID: 12074425-b7fcc6d00000091f-e6-50a04cf629ce +Received: from mailhub-auth-1.mit.edu ( [18.9.21.35]) + by dmz-mailsec-scanner-8.mit.edu (Symantec Messaging Gateway) with SMTP + id 55.61.02335.6FC40A05; Sun, 11 Nov 2012 20:12:22 -0500 (EST) +Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) + by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id qAC1CEh9020051; + Sun, 11 Nov 2012 20:12:14 -0500 +Received: from drake.dyndns.org + (209-6-116-242.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com + [209.6.116.242]) (authenticated bits=0) + (User authenticated as amdragon@ATHENA.MIT.EDU) + by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id qAC1C8CS025028 + (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); + Sun, 11 Nov 2012 20:12:10 -0500 (EST) +Received: from amthrax by drake.dyndns.org with local (Exim 4.77) + (envelope-from ) + id 1TXiZM-0003KB-LE; Sun, 11 Nov 2012 20:12:08 -0500 +From: Austin Clements +To: notmuch@notmuchmail.org +Subject: [PATCH v2] test: Fix HTML rendering test +Date: Sun, 11 Nov 2012 20:12:07 -0500 +Message-Id: <1352682727-12533-1-git-send-email-amdragon@mit.edu> +X-Mailer: git-send-email 1.7.10.4 +X-Brightmail-Tracker: + H4sIAAAAAAAAA+NgFlrHIsWRmVeSWpSXmKPExsUixCmqrPvNZ0GAQfdMTos7PbtYLK7fnMls + 8WblPFYHZo+ds+6yexz+upDF49mqW8wBzFFcNimpOZllqUX6dglcGe8//WYt6BCq2LaZr4Hx + B18XIweHhICJxKerpl2MnECmmMSFe+vZuhi5OIQE9jFKbD21jRHC2cAoseLUc6jMIyaJL7vm + sUA4cxklzq6eyAzSzyagIbFt/3JGEFtEQFpi593ZrCA2s0CixNIzb8DiwgKGEidftLOD2CwC + qhItk1eBxXkFHCSO/O1jhbhDUaL72QS2CYy8CxgZVjHKpuRW6eYmZuYUpybrFicn5uWlFula + 6OVmluilppRuYgQFC7uL6g7GCYeUDjEKcDAq8fBucFgQIMSaWFZcmXuIUZKDSUmU190bKMSX + lJ9SmZFYnBFfVJqTWnyIUYKDWUmEd5oIUI43JbGyKrUoHyYlzcGiJM57I+Wmv5BAemJJanZq + akFqEUxWhoNDSYKXDxgVQoJFqempFWmZOSUIaSYOTpDhPEDDP4Is5i0uSMwtzkyHyJ9iVJQS + 530EkhAASWSU5sH1wqL5FaM40CvCvAtAqniAiQCu+xXQYCagwY1H5oAMLklESEk1MPLX59x7 + Yx1e+tT78BaDKzPOn9LxVNzsIGXu2vjpeVzwwmNa/HbznxjbvY/on6d5rTrj7Os7KXyvzzes + X+O9PunTgvTgDv1M0xVZfSp2b5reeyZu/1ujGPtrVtKVvyK3dYP+vMiVD9Lmt/iw4LDJoqqv + C1UOR5f8Xs3m8HJDSfKz7wcuvPR8Ea7EUpyRaKjFXFScCAD9ppQwwQIAAA== +Cc: tomi.ollila@iki.fi +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: Mon, 12 Nov 2012 01:12:23 -0000 + +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 check that Emacs 24's shr +renderer didn't crash when given img tags, so use shr if it's +available, html2text otherwise (which is built in), and do only a +simple sanity check of the result. +--- + +This is version 2 of +id:"1351109160-11105-1-git-send-email-amdragon@mit.edu". This makes +fewer assumptions about the output, so hopefully it fixes the problems +with the first version. + + test/emacs | 27 ++++++++++----------------- + 1 file changed, 10 insertions(+), 17 deletions(-) + +diff --git a/test/emacs b/test/emacs +index 1f84b91..64b00db 100755 +--- a/test/emacs ++++ b/test/emacs +@@ -750,13 +750,12 @@ 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 + +- ++ smiley + + --abcd + Content-Type: image/gif +@@ -766,21 +765,15 @@ Content-ID: <330@goomoji.gmail> + R0lGODlhDAAMAKIFAF5LAP/zxAAAANyuAP/gaP///wAAAAAAACH5BAEAAAUALAAAAAAMAAwAAAMl + 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 <EXPECTED +-Notmuch Test Suite (2001-01-05) (inbox) +-Subject: HTML mail with images +-To: Notmuch Test Suite +-Date: Fri, 05 Jan 2001 15:43:57 +0000 +- +-[ multipart/related ] +-[ text/html ] +-* +-EOF +-test_expect_equal_file OUTPUT EXPECTED ++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)" > /dev/null ++# Different Emacs versions and renderers give very different results, ++# so just check that something reasonable showed up. ++test_expect_success "Rendering HTML mail with images" \ ++ 'grep -q smiley OUTPUT' + + + test_done +-- +1.7.10.4 + -- 2.26.2