summaryrefslogtreecommitdiffstats
path: root/framework/src/domain/mime/tests/mailtemplatetest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src/domain/mime/tests/mailtemplatetest.cpp')
-rw-r--r--framework/src/domain/mime/tests/mailtemplatetest.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/framework/src/domain/mime/tests/mailtemplatetest.cpp b/framework/src/domain/mime/tests/mailtemplatetest.cpp
index 302fae95..8d044608 100644
--- a/framework/src/domain/mime/tests/mailtemplatetest.cpp
+++ b/framework/src/domain/mime/tests/mailtemplatetest.cpp
@@ -224,6 +224,30 @@ private slots:
224 QCOMPARE(result->cc()->addresses(), l); 224 QCOMPARE(result->cc()->addresses(), l);
225 } 225 }
226 226
227 void testForwardAsAttachment()
228 {
229 auto msg = readMail("plaintext.mbox");
230 KMime::Message::Ptr result;
231 MailTemplates::forward(msg, [&] (const KMime::Message::Ptr &r) {
232 result = r;
233 });
234 QTRY_VERIFY(result);
235 QCOMPARE(result->subject(false)->asUnicodeString(), {"FW: A random subject with alternative contenttype"});
236 QCOMPARE(result->to()->addresses(), {});
237 QCOMPARE(result->cc()->addresses(), {});
238
239 auto attachments = result->attachments();
240 QCOMPARE(attachments.size(), 1);
241 auto attachment = attachments[0];
242 QCOMPARE(attachment->contentDisposition(false)->disposition(), KMime::Headers::CDinline);
243 QCOMPARE(attachment->contentDisposition(false)->filename(), {"A random subject with alternative contenttype.eml"});
244 QVERIFY(attachment->bodyIsMessage());
245
246 attachment->parse();
247 auto origMsg = attachment->bodyAsMessage();
248 QCOMPARE(origMsg->subject(false)->asUnicodeString(), {"A random subject with alternative contenttype"});
249 }
250
227 void testCreatePlainMail() 251 void testCreatePlainMail()
228 { 252 {
229 QStringList to = {{"to@example.org"}}; 253 QStringList to = {{"to@example.org"}};