summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-10-24 11:23:11 (GMT)
committerMontel Laurent <montel@kde.org>2016-10-24 11:23:39 (GMT)
commit5b2b8d9425127698e7e2573d3627d2d0c10b623e (patch)
tree56b68501035f3a1cf1188eb0b630029f9bcc9d29
parent30b2a0d6ba334210a9f43492ddaa07fc5c69f4a7 (diff)
Implement autotest for testing reply to all
-rw-r--r--messagecomposer/autotests/messagefactorytest.cpp23
1 files changed, 20 insertions, 3 deletions
diff --git a/messagecomposer/autotests/messagefactorytest.cpp b/messagecomposer/autotests/messagefactorytest.cpp
index 49bd94f..b158399 100644
--- a/messagecomposer/autotests/messagefactorytest.cpp
+++ b/messagecomposer/autotests/messagefactorytest.cpp
@@ -171,6 +171,7 @@ void MessageFactoryTest::testCreateReplyAllWithMultiEmails()
MessageFactory factory(msg, 0);
factory.setIdentityManager(identMan);
+ factory.setReplyStrategy(ReplyAll);
MessageFactory::MessageReply reply = factory.createReply();
reply.replyAll = true;
@@ -181,9 +182,25 @@ void MessageFactoryTest::testCreateReplyAllWithMultiEmails()
datetime += QLatin1String(" ") + QLocale::system().toString(date.time(), QLocale::LongFormat);
QString replyStr = QString::fromLatin1(QByteArray(QByteArray("On ") + datetime.toLatin1() + QByteArray(" you wrote:\n> All happy families are alike; each unhappy family is unhappy in its own way.\n\n")));
QCOMPARE(reply.msg->subject()->asUnicodeString(), QLatin1String("Re: Test Email Subject"));
- //QCOMPARE_OR_DIFF(reply.msg->body(), replyStr.toLatin1());
- //QByteArray ba;
- //QCOMPARE_OR_DIFF(reply.msg->encodedContent(), ba);
+
+ QString userAgent = reply.msg->userAgent()->asUnicodeString();
+ QString replyTo = reply.msg->inReplyTo()->asUnicodeString();
+ QString reference = reply.msg->references()->asUnicodeString();
+ QString dateStr = reply.msg->date()->asUnicodeString();
+ QString ba = QString::fromLatin1("From: another <another@another.com>\n"
+ "Date: %1\n"
+ "User-Agent: %2\n"
+ "X-KMail-Transport: 0\n"
+ "Cc: you@you.you, you2@you.you, cc@cc.cc, cc2@cc.cc\n"
+ "To: me@me.me\n"
+ "References: %4\n"
+ "In-Reply-To: %3\n"
+ "Subject: Re: Test Email Subject\nContent-Type: text/plain; charset=\"US-ASCII\"\n"
+ "Content-Transfer-Encoding: 8Bit\nMIME-Version: 1.0\n"
+ "X-KMail-Link-Message: 0\n"
+ "X-KMail-Link-Type: reply\n\n> All happy families are alike; each unhappy family is unhappy in its own way.")
+ .arg(dateStr).arg(userAgent).arg(replyTo).arg(reference);
+ QCOMPARE_OR_DIFF(reply.msg->encodedContent(), ba.toLatin1());
delete identMan;
QDir dir(QDir::homePath() + QStringLiteral("/.qttest/"));
dir.removeRecursively();