summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShane Kearns <ext-shane.2.kearns@nokia.com>2012-04-10 14:38:21 (GMT)
committerQt by Nokia <qt-info@nokia.com>2012-04-10 19:39:21 (GMT)
commit4807baf6401a629dbce81146af2a52182e74aac6 (patch)
tree3ea3095c3b67398f95345040238bbe397994c7bb
parent40760383969022be5488bb180dc7e1f8babcc0eb (diff)
downloadQt-4807baf6401a629dbce81146af2a52182e74aac6.zip
Qt-4807baf6401a629dbce81146af2a52182e74aac6.tar.gz
Qt-4807baf6401a629dbce81146af2a52182e74aac6.tar.bz2
Make QSslCertificate test fail instead of crash
If the SSL dlls could not be loaded, then QSslCertificate::fromPath will return an empty list. Make the test check for this before triggering an assertion failure by calling first() Task-number: QTBUG-25229 Change-Id: Ib6280c02130142201016a3f15ddb6bd44bfa0f9f Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>
-rw-r--r--tests/auto/qsslcertificate/tst_qsslcertificate.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/tests/auto/qsslcertificate/tst_qsslcertificate.cpp b/tests/auto/qsslcertificate/tst_qsslcertificate.cpp
index c73416d..ece379e 100644
--- a/tests/auto/qsslcertificate/tst_qsslcertificate.cpp
+++ b/tests/auto/qsslcertificate/tst_qsslcertificate.cpp
@@ -411,8 +411,10 @@ void tst_QSslCertificate::alternateSubjectNames()
void tst_QSslCertificate::utf8SubjectNames()
{
- QSslCertificate cert = QSslCertificate::fromPath("certificates/cert-ss-san-utf8.pem", QSsl::Pem,
- QRegExp::FixedString).first();
+ QList<QSslCertificate> certs = QSslCertificate::fromPath("certificates/cert-ss-san-utf8.pem", QSsl::Pem,
+ QRegExp::FixedString);
+ QVERIFY(!certs.isEmpty());
+ QSslCertificate cert = certs.first();
QVERIFY(!cert.isNull());
// O is "Heavy Metal Records" with heavy use of "decorations" like accents, umlauts etc.,
@@ -676,8 +678,10 @@ void tst_QSslCertificate::certInfo()
"dc:c2:eb:b7:bb:50:18:05:ba:ad:af:08:49:fe:98:63"
"55:ba:e7:fb:95:5d:91";
- QSslCertificate cert = QSslCertificate::fromPath("certificates/cert.pem", QSsl::Pem,
- QRegExp::FixedString).first();
+ QList<QSslCertificate> certs = QSslCertificate::fromPath("certificates/cert.pem", QSsl::Pem,
+ QRegExp::FixedString);
+ QVERIFY(!certs.isEmpty());
+ QSslCertificate cert = certs.first();
QVERIFY(!cert.isNull());
QCOMPARE(cert.issuerInfo(QSslCertificate::Organization), QString("CryptSoft Pty Ltd"));
@@ -733,8 +737,10 @@ void tst_QSslCertificate::certInfo()
void tst_QSslCertificate::certInfoQByteArray()
{
- QSslCertificate cert = QSslCertificate::fromPath("certificates/cert.pem", QSsl::Pem,
- QRegExp::FixedString).first();
+ QList<QSslCertificate> certs = QSslCertificate::fromPath("certificates/cert.pem", QSsl::Pem,
+ QRegExp::FixedString);
+ QVERIFY(!certs.isEmpty());
+ QSslCertificate cert = certs.first();
QVERIFY(!cert.isNull());
// in this test, check the bytearray variants before the enum variants to see if