summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDamien Caliste <dcaliste@free.fr>2018-09-18 16:58:44 +0200
committerPekka Vuorela <pvuorela@iki.fi>2018-09-29 11:51:03 +0000
commitd22dca1bbc17ebc86cb7d7316aacf4b773c3150c (patch)
tree8e709d7ae476126d490a7864a190ba75421d6936 /tests
parentcb5c76944c0c3a8ee6360564369c1a3cc409255e (diff)
Do not allow to pass full content type description to setType() method
Nothing avoid or warn when calling setType("text/plain; charset=UTF-8"). Later calls to subType() or charset() return a wrong value then. Patch simply checks that ';' or '/' is not part of the argument in setType(). Change-Id: I1839c2a5800328e00f422054d5c19e9797be1a94 Reviewed-by: Pekka Vuorela <pvuorela@iki.fi> Reviewed-by: Matthew Vogt <matthew.vogt@qinetic.com.au>
Diffstat (limited to 'tests')
-rw-r--r--tests/tst_qmailmessageheader/tst_qmailmessageheader.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/tst_qmailmessageheader/tst_qmailmessageheader.cpp b/tests/tst_qmailmessageheader/tst_qmailmessageheader.cpp
index 92c724cc..34d8ae63 100644
--- a/tests/tst_qmailmessageheader/tst_qmailmessageheader.cpp
+++ b/tests/tst_qmailmessageheader/tst_qmailmessageheader.cpp
@@ -1322,6 +1322,14 @@ void tst_QMailMessageContentType::setType()
QCOMPARE( type2.type(), QByteArray() );
QCOMPARE( type2.subType(), QByteArray() );
QCOMPARE( type2.toString(), QByteArray("Content-Type:; charset=us-ascii") );
+
+ // Illegal arguments to setType()
+ QMailMessageContentType type3("image/jpeg");
+ // Set the type and charset
+ type3.setType("text/plain; charset=UTF-8");
+ QCOMPARE( type3.type(), QByteArray("image") );
+ QCOMPARE( type3.subType(), QByteArray("jpeg") );
+ QVERIFY( type3.charset().isEmpty() );
}
void tst_QMailMessageContentType::subType()