Bug 1511950 - Add MozMill test for message display in cp932. r=mkmelin
authorJorg K <jorgk@jorgk.com>
Wed, 05 Dec 2018 23:06:00 +0100
changeset 33857 f4b9e739d180fcd1f813978893b7d9907737193b
parent 33856 060cb49e2b681b2b741672049be79543c5034088
child 33858 b97c1a62e3d09bb93b3ae9b58462b3282ba9aeb6
push id388
push userclokep@gmail.com
push dateMon, 28 Jan 2019 20:54:56 +0000
reviewersmkmelin
bugs1511950
Bug 1511950 - Add MozMill test for message display in cp932. r=mkmelin
mail/test/mozmill/composition/charset-cp932.eml
mail/test/mozmill/composition/test-cp932-display.js
new file mode 100644
--- /dev/null
+++ b/mail/test/mozmill/composition/charset-cp932.eml
@@ -0,0 +1,11 @@
+Date: Tue, 4 Dec 2018 15:23:22 +0900
+From: from@example.org
+Subject: =?cp932?Q?=82=b1=82=b1=82=c9=96=7b=95=b6=82=aa=82=ab=82=dc=82=b7=81=42?=
+To: to@example.org
+Message-Id: <424F4F74-05B4-4575-8B0D-473334183C69@example.org>
+Mime-Version: 1.0 (1.0)
+Content-Type: text/plain; charset=cp932
+Content-Transfer-Encoding: 8bit
+
+ここに本文がきます。
+
new file mode 100644
--- /dev/null
+++ b/mail/test/mozmill/composition/test-cp932-display.js
@@ -0,0 +1,40 @@
+/* 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 messages in cp932, Thunderbirds alias for Shift_JIS, are correctly displayed.
+ */
+
+// mozmake SOLO_TEST=composition/test-cp932-display.js mozmill-one
+
+"use strict";
+
+var MODULE_NAME = "test-cp932-display.js";
+
+var RELATIVE_ROOT = "../shared-modules";
+var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
+
+var os = {};
+ChromeUtils.import("chrome://mozmill/content/stdlib/os.js", os);
+
+function setupModule(module) {
+  for (let lib of MODULE_REQUIRES) {
+    collector.getModule(lib).installInto(module);
+  }
+}
+
+function test_cp932_display() {
+  let file = os.getFileForPath(os.abspath("./charset-cp932.eml",
+                               os.getFileForPath(__file__)));
+  let msgc = open_message_from_file(file);
+  let subjectText = msgc.e("expandedsubjectBox").textContent;
+  let bodyText = msgc.e("messagepane").contentDocument
+                     .querySelector("body").textContent;
+  close_window(msgc);
+
+  assert_true(subjectText.includes("縺薙%縺ォ譛ャ譁縺後″縺セ縺吶"),
+              "Decoded cp932 text not found in message subject.");
+  assert_true(bodyText.includes("縺薙%縺ォ譛ャ譁縺後″縺セ縺吶"),
+              "Decoded cp932 text not found in message body.");
+}