# HG changeset patch # Parent 4ad03358510af478fe24c0d8d81da53cf4318fc6 # User Szabolcs Hubai Bug 594646 - Tests for UTF-8 mojibake diff --git a/mail/test/mozmill/message-reader/bug594646_newline_charset.eml b/mail/test/mozmill/message-reader/bug594646_newline_charset.eml new file mode 100644 --- /dev/null +++ b/mail/test/mozmill/message-reader/bug594646_newline_charset.eml @@ -0,0 +1,22 @@ +X-Identity-Key: id1 +X-Account-Key: account2 +Date: Tue, 18 Dec 2012 13:42:01 +0100 +X-Mozilla-Draft-Info: internal/draft; vcard=0; receipt=0; DSN=0; uuencode=0 +User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:19.0) Gecko/20121217 Thunderbird/19.0a2 +MIME-Version: 1.0 +Subject: html test +X-Enigmail-Version: 1.5a1pre +Content-Type: text/html; charset=ISO-8859-2 +Content-Transfer-Encoding: 8bit + + + + + + +
+ árvíztűrő tükörfúrógép +
+ + diff --git a/mail/test/mozmill/message-reader/bug594646_reference.eml b/mail/test/mozmill/message-reader/bug594646_reference.eml new file mode 100644 --- /dev/null +++ b/mail/test/mozmill/message-reader/bug594646_reference.eml @@ -0,0 +1,21 @@ +X-Identity-Key: id1 +X-Account-Key: account2 +Date: Tue, 18 Dec 2012 13:42:01 +0100 +X-Mozilla-Draft-Info: internal/draft; vcard=0; receipt=0; DSN=0; uuencode=0 +User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:19.0) Gecko/20121217 Thunderbird/19.0a2 +MIME-Version: 1.0 +Subject: html test +X-Enigmail-Version: 1.5a1pre +Content-Type: text/html; charset=ISO-8859-2 +Content-Transfer-Encoding: 8bit + + + + + + +
+ árvíztűrő tükörfúrógép +
+ + diff --git a/mail/test/mozmill/message-reader/bug594646_reversed_order.eml b/mail/test/mozmill/message-reader/bug594646_reversed_order.eml new file mode 100644 --- /dev/null +++ b/mail/test/mozmill/message-reader/bug594646_reversed_order.eml @@ -0,0 +1,21 @@ +X-Identity-Key: id1 +X-Account-Key: account2 +Date: Tue, 18 Dec 2012 13:42:01 +0100 +X-Mozilla-Draft-Info: internal/draft; vcard=0; receipt=0; DSN=0; uuencode=0 +User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:19.0) Gecko/20121217 Thunderbird/19.0a2 +MIME-Version: 1.0 +Subject: html test +X-Enigmail-Version: 1.5a1pre +Content-Type: text/html; charset=ISO-8859-2 +Content-Transfer-Encoding: 8bit + + + + + + +
+ árvíztűrő tükörfúrógép +
+ + diff --git a/mail/test/mozmill/message-reader/test-bug594646.js b/mail/test/mozmill/message-reader/test-bug594646.js new file mode 100644 --- /dev/null +++ b/mail/test/mozmill/message-reader/test-bug594646.js @@ -0,0 +1,63 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/** + * Tests that opening an .eml file the body of the message is correct, + * that it hasn't been UTF-8 mojibake'd. + */ + +const MODULE_NAME = "test-bug594646"; + +const RELATIVE_ROOT = "../shared-modules"; +const MODULE_REQUIRES = ["folder-display-helpers"]; + +function setupModule(module) { + collector.getModule("folder-display-helpers").installInto(module); + collector.getModule("window-helpers").installInto(module); +} + +function extract_eml_body_textcontent(eml) { + let file = os.getFileForPath(os.abspath(eml, os.getFileForPath(__file__))); + let msgc = open_message_from_file(file); + + // Be sure to view message body as Original HTML + msgc.window.MsgBodyAllowHTML(); + + let textContent = msgc.window.msgWindow.messageWindowDocShell + .contentViewer.DOMDocument.documentElement.textContent; + + close_window(msgc); + return textContent; +} + +/** + * Checks that the text content is equal for the .eml files. + */ +function check_eml_textcontent(emlA, emlB) { + let textContentA = extract_eml_body_textcontent(emlA); + let textContentB = extract_eml_body_textcontent(emlB); + assert_equals(textContentA, textContentB); +} + +/** + * This test excercises the bug for reversed http-equiv, content order: + * + * + * + */ +function test_original_html_characters_head_meta_content_charset_httpEq() { + check_eml_textcontent("./bug594646_reference.eml", "./bug594646_reversed_order.eml"); +} + +/** + * This test excercises the bug for newline delimited charset: + * + * + * + */ +function test_original_html_characters_head_meta_httpEq_content_newline_charset() { + check_eml_textcontent("./bug594646_reference.eml", "./bug594646_newline_charset.eml"); +} + diff --git a/mail/test/mozmill/mozmilltests.list b/mail/test/mozmill/mozmilltests.list --- a/mail/test/mozmill/mozmilltests.list +++ b/mail/test/mozmill/mozmilltests.list @@ -11,16 +11,17 @@ folder-display folder-pane folder-tree-modes folder-widget im instrumentation junk-commands keyboard message-header +message-reader message-window migration-to-rdf-ui-2 migration-to-rdf-ui-3 migration-to-rdf-ui-5 multiple-identities newmailaccount notification override-main-menu-collapse