summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2017-04-24 21:40:29 +0200
committerMontel Laurent <[email protected]>2017-04-24 21:40:29 +0200
commit7913383053c3b35cfe80d57d74a7455d50a1358c (patch)
treeaccf4d514db96aeae33ef3e6a2327edbf93e4a55
parent388d59fc29822b92c46419d362dd9c4b4e50dc11 (diff)
Reactivate some tests
-rw-r--r--templateparser/autotests/templateparserjobtest.cpp48
-rw-r--r--templateparser/autotests/templateparserjobtest.h8
2 files changed, 35 insertions, 21 deletions
diff --git a/templateparser/autotests/templateparserjobtest.cpp b/templateparser/autotests/templateparserjobtest.cpp
index 224304c..ed223ef 100644
--- a/templateparser/autotests/templateparserjobtest.cpp
+++ b/templateparser/autotests/templateparserjobtest.cpp
@@ -32,13 +32,14 @@
#include <QLocale>
#include <QTimeZone>
#include <QSignalSpy>
+#include <QStandardPaths>
using namespace MimeTreeParser;
TemplateParserJobTest::TemplateParserJobTest(QObject *parent)
: QObject(parent)
{
-
+ QStandardPaths::setTestModeEnabled(true);
}
TemplateParserJobTest::~TemplateParserJobTest()
@@ -47,7 +48,7 @@ TemplateParserJobTest::~TemplateParserJobTest()
QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
}
-#if 0
+
void TemplateParserJobTest::test_convertedHtml_data()
{
QTest::addColumn<QString>("mailFileName");
@@ -83,12 +84,18 @@ void TemplateParserJobTest::test_convertedHtml()
QCOMPARE(msg->subject()->as7BitString(false).constData(), "Plain Message Test");
QCOMPARE(msg->contents().size(), 0);
- TemplateParser::TemplateParserJob parser(msg, TemplateParser::TemplateParserJob::NewMessage);
- parser.mOtp->parseObjectTree(msg.data());
- QVERIFY(parser.mOtp->htmlContent().isEmpty());
- QVERIFY(!parser.mOtp->plainTextContent().isEmpty());
+ TemplateParser::TemplateParserJob *parser = new TemplateParser::TemplateParserJob(msg, TemplateParser::TemplateParserJob::NewMessage);
+ KIdentityManagement::IdentityManager *identMan = new KIdentityManagement::IdentityManager;
+ parser->setIdentityManager(identMan);
+ parser->mOtp->parseObjectTree(msg.data());
+ QVERIFY(parser->mOtp->htmlContent().isEmpty());
+ QVERIFY(!parser->mOtp->plainTextContent().isEmpty());
+
+ QSignalSpy spy(parser, &TemplateParser::TemplateParserJob::parsingDone);
+ parser->processWithTemplate(QString());
+ QVERIFY(spy.wait());
- const QString convertedHtmlContent = parser.htmlMessageText(false, TemplateParser::TemplateParserJob::NoSelectionAllowed);
+ const QString convertedHtmlContent = parser->htmlMessageText(false, TemplateParser::TemplateParserJob::NoSelectionAllowed);
QVERIFY(!convertedHtmlContent.isEmpty());
QCOMPARE(convertedHtmlContent, referenceData);
@@ -133,19 +140,26 @@ void TemplateParserJobTest::test_replyPlain()
// QCOMPARE(msg->subject()->as7BitString(false).constData(), "Plain Message Test");
// QCOMPARE(msg->contents().size(), 0);
- TemplateParser::TemplateParserJob parser(msg, TemplateParser::TemplateParserJob::Reply);
- parser.mOtp->parseObjectTree(msg.data());
- parser.mOrigMsg = msg;
-// QVERIFY(parser.mOtp->htmlContent().isEmpty());
-// QVERIFY(!parser.mOtp->plainTextContent().isEmpty());
+ TemplateParser::TemplateParserJob *parser = new TemplateParser::TemplateParserJob(msg, TemplateParser::TemplateParserJob::Reply);
+ //KIdentityManagement::IdentityManager *identMan = new KIdentityManagement::IdentityManager;
+ //parser->setIdentityManager(identMan);
- QBENCHMARK {
- const QString convertedHtmlContent = parser.plainMessageText(false, TemplateParser::TemplateParserJob::NoSelectionAllowed);
+ parser->mOtp->parseObjectTree(msg.data());
+ parser->mOrigMsg = msg;
+ //QVERIFY(parser->mOtp->htmlContent().isEmpty());
+ //QVERIFY(!parser->mOtp->plainTextContent().isEmpty());
- QCOMPARE(convertedHtmlContent, referenceData);
- }
+// QSignalSpy spy(parser, &TemplateParser::TemplateParserJob::parsingDone);
+// parser->processWithTemplate(QString());
+// QVERIFY(spy.wait());
+
+
+// QBENCHMARK {
+// const QString convertedHtmlContent = parser->plainMessageText(false, TemplateParser::TemplateParserJob::NoSelectionAllowed);
+
+// QCOMPARE(convertedHtmlContent, referenceData);
+// }
}
-#endif
void TemplateParserJobTest::test_processWithTemplatesForBody_data()
{
diff --git a/templateparser/autotests/templateparserjobtest.h b/templateparser/autotests/templateparserjobtest.h
index dd4ada1..2422a17 100644
--- a/templateparser/autotests/templateparserjobtest.h
+++ b/templateparser/autotests/templateparserjobtest.h
@@ -33,11 +33,11 @@ private Q_SLOTS:
* checks whether text/plain only mails are converted to a valid HTML
*/
-// void test_convertedHtml();
-// void test_convertedHtml_data();
+ void test_convertedHtml();
+ void test_convertedHtml_data();
-// void test_replyPlain();
-// void test_replyPlain_data();
+ void test_replyPlain();
+ void test_replyPlain_data();
/**
* Tests whether templates are returning required body or not