summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-10-24 11:33:16 (GMT)
committerMontel Laurent <montel@kde.org>2016-10-24 11:33:16 (GMT)
commit0f5709bf42b6df0910c86d0ae3532a85c2ecf0e0 (patch)
treee131d26eb1bb8176f9bfa6fd84677313cd8c59ad
parent5b2b8d9425127698e7e2573d3627d2d0c10b623e (diff)
Add reply to author autotest
-rw-r--r--messagecomposer/autotests/messagefactorytest.cpp28
1 files changed, 24 insertions, 4 deletions
diff --git a/messagecomposer/autotests/messagefactorytest.cpp b/messagecomposer/autotests/messagefactorytest.cpp
index b158399..b45544c 100644
--- a/messagecomposer/autotests/messagefactorytest.cpp
+++ b/messagecomposer/autotests/messagefactorytest.cpp
@@ -135,7 +135,6 @@ void MessageFactoryTest::initTestCase()
void MessageFactoryTest::testCreateReplyToAuthor()
{
- /*
KMime::Message::Ptr msg = createPlainTestMessage();
KIdentityManagement::IdentityManager *identMan = new KIdentityManagement::IdentityManager;
KIdentityManagement::Identity ident = identMan->newFromScratch(QStringLiteral("foo"));
@@ -144,6 +143,7 @@ void MessageFactoryTest::testCreateReplyToAuthor()
MessageFactory factory(msg, 0);
factory.setIdentityManager(identMan);
+ factory.setReplyStrategy(ReplyAuthor);
MessageFactory::MessageReply reply = factory.createReply();
reply.replyAll = true;
@@ -155,10 +155,30 @@ void MessageFactoryTest::testCreateReplyToAuthor()
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());
+ 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"
+ "To: me@me.me\n"
+ "References: %4\n"
+ "In-Reply-To: %3\n"
+ "Subject: Re: Test Email Subject\n"
+ "X-KMail-CursorPos: 134\n"
+ "Content-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"
+ "%5")
+ .arg(dateStr).arg(userAgent).arg(replyTo).arg(reference).arg(replyStr);
+ QCOMPARE_OR_DIFF(reply.msg->encodedContent(), ba.toLatin1());
+
delete identMan;
- QDir dir(QDir::homePath() + QStringLiteral("/.qttest/"));
- dir.removeRecursively();
- */
+ //QDir dir(QDir::homePath() + QStringLiteral("/.qttest/"));
+ //dir.removeRecursively();
}
void MessageFactoryTest::testCreateReplyAllWithMultiEmails()