aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2017-05-31 07:09:38 +0200
committerMontel Laurent <[email protected]>2017-05-31 07:09:38 +0200
commitada4b4038dda1c6d639f0efa1ed4210d83b1f773 (patch)
tree2e1d32053170ec370d6083fa62d1f11e2fe51767
parentcdfd44e69e0b5089e8ae45bfcd02b522cf98457c (diff)
Improve autotest
-rw-r--r--autotests/contenttest.cpp19
-rw-r--r--autotests/contenttest.h1
2 files changed, 15 insertions, 5 deletions
diff --git a/autotests/contenttest.cpp b/autotests/contenttest.cpp
index d3a8626..d2b18fd 100644
--- a/autotests/contenttest.cpp
+++ b/autotests/contenttest.cpp
@@ -743,10 +743,10 @@ void ContentTest::testFreezing()
delete msg;
}
-
-void ContentTest::testContentTypeMimetype()
+void ContentTest::testContentTypeMimetype_data()
{
- //TODO improve test
+ QTest::addColumn<QByteArray>("data");
+ QTest::addColumn<QByteArray>("mimetype");
QByteArray data =
"From: Nathaniel Borenstein <[email protected]>\n"
"To: Ned Freed <[email protected]>\n"
@@ -773,10 +773,19 @@ void ContentTest::testContentTypeMimetype()
"\n"
"This is the epilogue. It is also to be ignored.\n";
+ QTest::newRow("multipart") << data << QByteArrayLiteral("multipart/mixed");
+
+}
+
+
+void ContentTest::testContentTypeMimetype()
+{
+ QFETCH(QByteArray, data);
+ QFETCH(QByteArray, mimetype);
+
// test parsing
Message *msg = new Message();
msg->setContent(data);
msg->parse();
- QVERIFY(msg->contentType()->isMultipart());
- QCOMPARE(msg->contentType(false)->mimeType(), QByteArrayLiteral("multipart/mixed"));
+ QCOMPARE(msg->contentType(false)->mimeType(), mimetype);
}
diff --git a/autotests/contenttest.h b/autotests/contenttest.h
index a813be3..a46759c 100644
--- a/autotests/contenttest.h
+++ b/autotests/contenttest.h
@@ -44,6 +44,7 @@ private Q_SLOTS:
// TODO: grab samples from http://www.yenc.org/develop.htm and make a Yenc test
void testParent();
void testFreezing();
+ void testContentTypeMimetype_data();
void testContentTypeMimetype();
};