diff options
Diffstat (limited to 'framework/domain/mimetreeparser/tests')
-rw-r--r-- | framework/domain/mimetreeparser/tests/data/html.mbox | 12 | ||||
-rw-r--r-- | framework/domain/mimetreeparser/tests/interfacetest.cpp | 25 |
2 files changed, 24 insertions, 13 deletions
diff --git a/framework/domain/mimetreeparser/tests/data/html.mbox b/framework/domain/mimetreeparser/tests/data/html.mbox index eebd4283..d476a8d4 100644 --- a/framework/domain/mimetreeparser/tests/data/html.mbox +++ b/framework/domain/mimetreeparser/tests/data/html.mbox | |||
@@ -9,16 +9,6 @@ X-KMail-Drafts: 7 | |||
9 | X-KMail-Templates: 9 | 9 | X-KMail-Templates: 9 |
10 | User-Agent: KMail/4.6 beta5 (Linux/2.6.34.7-0.7-desktop; KDE/4.6.41; x86_64; git-0269848; 2011-04-19) | 10 | User-Agent: KMail/4.6 beta5 (Linux/2.6.34.7-0.7-desktop; KDE/4.6.41; x86_64; git-0269848; 2011-04-19) |
11 | MIME-Version: 1.0 | 11 | MIME-Version: 1.0 |
12 | Content-Type: multipart/alternative; boundary="nextPart8606278.tpV19BTJKu" | ||
13 | Content-Transfer-Encoding: 7Bit | ||
14 | |||
15 | |||
16 | --nextPart8606278.tpV19BTJKu | ||
17 | Content-Transfer-Encoding: 7Bit | ||
18 | Content-Type: text/plain; charset="windows-1252" | ||
19 | |||
20 | Some HTML text | ||
21 | --nextPart8606278.tpV19BTJKu | ||
22 | Content-Transfer-Encoding: 7Bit | 12 | Content-Transfer-Encoding: 7Bit |
23 | Content-Type: text/html; charset="windows-1252" | 13 | Content-Type: text/html; charset="windows-1252" |
24 | 14 | ||
@@ -27,5 +17,3 @@ Content-Type: text/html; charset="windows-1252" | |||
27 | p, li { white-space: pre-wrap; } | 17 | p, li { white-space: pre-wrap; } |
28 | </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> | 18 | </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> |
29 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">Some <span style=" font-weight:600;">HTML</span> text</p></body></html> | 19 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">Some <span style=" font-weight:600;">HTML</span> text</p></body></html> |
30 | --nextPart8606278.tpV19BTJKu-- | ||
31 | |||
diff --git a/framework/domain/mimetreeparser/tests/interfacetest.cpp b/framework/domain/mimetreeparser/tests/interfacetest.cpp index 1e8c5302..fd828960 100644 --- a/framework/domain/mimetreeparser/tests/interfacetest.cpp +++ b/framework/domain/mimetreeparser/tests/interfacetest.cpp | |||
@@ -39,7 +39,30 @@ private slots: | |||
39 | { | 39 | { |
40 | Parser parser(readMailFromFile("plaintext.mbox")); | 40 | Parser parser(readMailFromFile("plaintext.mbox")); |
41 | auto contentPart = parser.collectContentPart(); | 41 | auto contentPart = parser.collectContentPart(); |
42 | //QVERIFY((bool)contentPart); | 42 | QVERIFY((bool)contentPart); |
43 | QCOMPARE(contentPart->availableContents(), ContentPart::PlainText); | ||
44 | auto contentList = contentPart->content(ContentPart::PlainText); | ||
45 | QCOMPARE(contentList.size(), 1); | ||
46 | QCOMPARE(contentList[0]->content(), QStringLiteral("If you can see this text it means that your email client couldn't display our newsletter properly.\nPlease visit this link to view the newsletter on our website: http://www.gog.com/newsletter/\n\n- GOG.com Team\n\n").toLocal8Bit()); | ||
47 | QCOMPARE(contentList[0]->charset(), QStringLiteral("utf-8").toLocal8Bit()); | ||
48 | QCOMPARE(contentList[0]->encryptions().size(), 0); | ||
49 | QCOMPARE(contentList[0]->signatures().size(), 0); | ||
50 | } | ||
51 | |||
52 | void testTextAlternative() | ||
53 | { | ||
54 | Parser parser(readMailFromFile("alternative.mbox")); | ||
55 | auto contentPart = parser.collectContentPart(); | ||
56 | QVERIFY((bool)contentPart); | ||
57 | QCOMPARE(contentPart->availableContents(), ContentPart::PlainText | ContentPart::Html); | ||
58 | } | ||
59 | |||
60 | void testTextHtml() | ||
61 | { | ||
62 | Parser parser(readMailFromFile("html.mbox")); | ||
63 | auto contentPart = parser.collectContentPart(); | ||
64 | QVERIFY((bool)contentPart); | ||
65 | QCOMPARE(contentPart->availableContents(), ContentPart::Html); | ||
43 | } | 66 | } |
44 | }; | 67 | }; |
45 | 68 | ||