Bug 456053 - Test. r=aceman
authorJorg K
Fri, 30 Sep 2016 16:36:01 +0200
changeset 20496 decaccbe1d8ab52ceb093be2a84b06c252d143a4
parent 20495 bc84637f93882097abfe75db5d02cbef034ab24e
child 20497 8063298200aaad3d5129c5b8240ade87079d5c00
push id12364
push usermozilla@jorgk.com
push dateFri, 30 Sep 2016 14:37:55 +0000
treeherdercomm-central@decaccbe1d8a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaceman
bugs456053
Bug 456053 - Test. r=aceman
mail/test/mozmill/composition/format-flowed.eml
mail/test/mozmill/composition/test-reply-format-flowed.js
new file mode 100644
--- /dev/null
+++ b/mail/test/mozmill/composition/format-flowed.eml
@@ -0,0 +1,12 @@
+To: test1@test.invalid
+From: test2@test.invalid
+Subject: test format flowed reply
+Date: Tue, 27 Sep 2016 13:00:40 +0200
+MIME-Version: 1.0
+Content-Type: text/plain; charset=windows-1252; format=flowed
+Content-Language: en-US
+Content-Transfer-Encoding: 7bit
+
+first first first first first text text text text text text text text 
+text text text text text text text text text text text text text text 
+last last last last last last last last last last last last last last
new file mode 100644
--- /dev/null
+++ b/mail/test/mozmill/composition/test-reply-format-flowed.js
@@ -0,0 +1,73 @@
+/* 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 the reply to a format=flowed message is also flowed.
+ */
+
+// make SOLO_TEST=composition/test-reply-format-flowed.js mozmill-one
+
+var MODULE_NAME = "test-reply-format-flowed";
+
+var RELATIVE_ROOT = "../shared-modules";
+var MODULE_REQUIRES = ["folder-display-helpers", "compose-helpers", "window-helpers"];
+
+Cu.import("resource://gre/modules/Services.jsm");
+Cu.import("resource:///modules/mailServices.js");
+
+var os = {};
+Cu.import('resource://mozmill/stdlib/os.js', os);
+
+function setupModule(module) {
+  for (let lib of MODULE_REQUIRES) {
+    collector.getModule(lib).installInto(module);
+  }
+
+  Services.prefs.setBoolPref("mail.identity.id1.compose_html", false);
+}
+
+function subtest_reply_format_flowed(aFlowed) {
+  let file = os.getFileForPath(os.abspath("./format-flowed.eml",
+                               os.getFileForPath(__file__)));
+  let msgc = open_message_from_file(file);
+
+  Services.prefs.setBoolPref("mailnews.send_plaintext_flowed", aFlowed);
+
+  let cwc = open_compose_with_reply(msgc);
+
+  close_window(msgc);
+
+  // Now send the message.
+  plan_for_window_close(cwc);
+  cwc.window.goDoCommand("cmd_sendLater");
+  wait_for_window_close();
+
+  // Now check the message content in the outbox.
+  let outbox = MailServices.accounts.localFoldersServer.rootFolder
+                           .getChildNamed("Outbox");
+  be_in_folder(outbox);
+  let message = select_click_row(0);
+  let messageContent = get_msg_source(message);
+
+  // Check for a single line that contains text and make sure there is a
+  // space at the end for a flowed reply.
+  assert_true(
+    messageContent.includes(
+      "\r\n> text text text text text text text text text text text text text text" +
+      (aFlowed ? " \r\n" : "\r\n")),
+    "Expected line not found in message.");
+
+  // Delete the outgoing message.
+  press_delete();
+}
+
+function test_reply_format_flowed() {
+  subtest_reply_format_flowed(true);
+  subtest_reply_format_flowed(false);
+}
+
+function teardownModule() {
+  Services.prefs.clearUserPref("mail.identity.id1.compose_html");
+  Services.prefs.clearUserPref("mailnews.send_plaintext_flowed");
+}