diff options
author | Rémi Nicole <nicole@kolabsystems.com> | 2018-02-21 21:11:01 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-02-21 21:19:32 +0100 |
commit | d3228a2899992370e3fb19609eb1433d02de0f40 (patch) | |
tree | a78d3d04de3856ad4da058d16174ef58797a43cc /framework/src/domain/mime/tests/mailtemplatetest.cpp | |
parent | 6299a2fee34e53938d7c230e7e29611a6bcdb2b9 (diff) | |
download | kube-d3228a2899992370e3fb19609eb1433d02de0f40.tar.gz kube-d3228a2899992370e3fb19609eb1433d02de0f40.zip |
T7024 fix: implement attachment-based forwarding
Summary:
Implement attachment-based forwarding.
Some notes:
- `loadAsDraft` was removed in favor of new enum `loadType` in QML, and callback based generic programming in C++
Reviewers: cmollekopf
Tags: #kube
Maniphest Tasks: T7024
Differential Revision: https://phabricator.kde.org/D10676
Diffstat (limited to 'framework/src/domain/mime/tests/mailtemplatetest.cpp')
-rw-r--r-- | framework/src/domain/mime/tests/mailtemplatetest.cpp | 24 |
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"}}; |