Changeset View
Changeset View
Standalone View
Standalone View
mimetreeparser/autotests/basicobjecttreeparsertest.cpp
Show First 20 Lines • Show All 274 Lines • ▼ Show 20 Line(s) | 258 | { | |||
---|---|---|---|---|---|
275 | // Job ended | 275 | // Job ended | ||
276 | { | 276 | { | ||
277 | ObjectTreeParser otp(&testSource, &nodeHelper); | 277 | ObjectTreeParser otp(&testSource, &nodeHelper); | ||
278 | otp.setAllowAsync(true); | 278 | otp.setAllowAsync(true); | ||
279 | otp.parseObjectTree(originalMessage.data()); | 279 | otp.parseObjectTree(originalMessage.data()); | ||
280 | QCOMPARE(otp.plainTextContent(), output); | 280 | QCOMPARE(otp.plainTextContent(), output); | ||
281 | } | 281 | } | ||
282 | } | 282 | } | ||
283 | | ||||
284 | void ObjectTreeParserTest::testHtmlContent_data() | ||||
285 | { | ||||
286 | QTest::addColumn<QString>("mailFileName"); | ||||
287 | QTest::addColumn<QString>("output"); | ||||
288 | | ||||
289 | QTest::newRow("html-attachments1") << QStringLiteral("html-attachment1.mbox") << QStringLiteral( | ||||
290 | "<html><head></head><body><p><span style=\"font-family:Arial;\">A Body Text</span></p></body></html>"); | ||||
291 | QTest::newRow("html-attachments2") << QStringLiteral("html-attachment2.mbox") | ||||
292 | << QStringLiteral("<html><head></head><body>HTML Text</body></html>"); | ||||
293 | } | ||||
294 | | ||||
295 | void ObjectTreeParserTest::testHtmlContent() | ||||
296 | { | ||||
297 | QFETCH(QString, mailFileName); | ||||
298 | QFETCH(QString, output); | ||||
299 | | ||||
300 | KMime::Message::Ptr originalMessage = readAndParseMail(mailFileName); | ||||
301 | NodeHelper nodeHelper; | ||||
302 | SimpleObjectTreeSource testSource; | ||||
303 | ObjectTreeParser otp(&testSource, &nodeHelper); | ||||
304 | testSource.setDecryptMessage(true); | ||||
305 | otp.parseObjectTree(originalMessage.data()); | ||||
306 | | ||||
307 | QVERIFY(otp.plainTextContent().isEmpty()); | ||||
308 | QCOMPARE(otp.htmlContent(), output); | ||||
309 | } |