summaryrefslogtreecommitdiffstats
path: root/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp
diff options
context:
space:
mode:
authorMårten Nordheim <marten.nordheim@qt.io>2018-01-05 13:18:28 +0100
committerMårten Nordheim <marten.nordheim@qt.io>2018-01-09 08:52:41 +0000
commita5c58d503da0b1dc7e283caa87c6e7ba988c206a (patch)
tree37f3387bf41f4b5fe0ffeeec992b2e4c407e5b7a /tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp
parenta79d9da8e0bbc69053d00dd1ff1dd55c47258291 (diff)
Revert "Adapt the QSsl* tests to use the resource system"
This reverts commit e1600c1a73e0594f5fbea8f7341a9552d6ae3fbb. The commit missed the fact that TESTDATA exists. Which supports wildcards and then can automatically pick up new files when added (as long as they match a wildcard) and then you don't need to maintain a giant qrc file. Change-Id: Ie31fadb5ef6e8dfe6105f4f9764292f78cffb512 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp')
-rw-r--r--tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp b/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp
index 3c88cddf9a..0112af4ed7 100644
--- a/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp
+++ b/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp
@@ -97,11 +97,17 @@ private slots:
#endif
#endif
+private:
+ QString testDataDir;
};
void tst_QSslKey::initTestCase()
{
- QDir dir(":/keys");
+ testDataDir = QFileInfo(QFINDTESTDATA("rsa-without-passphrase.pem")).absolutePath();
+ if (testDataDir.isEmpty())
+ testDataDir = QCoreApplication::applicationDirPath();
+
+ QDir dir(testDataDir + "/keys");
QFileInfoList fileInfoList = dir.entryInfoList(QDir::Files | QDir::Readable);
QRegExp rx(QLatin1String("^(rsa|dsa|ec)-(pub|pri)-(\\d+)-?\\w*\\.(pem|der)$"));
foreach (QFileInfo fileInfo, fileInfoList) {
@@ -386,9 +392,9 @@ void tst_QSslKey::passphraseChecks_data()
{
QTest::addColumn<QString>("fileName");
- QTest::newRow("DES") << QString(":/rsa-with-passphrase-des.pem");
- QTest::newRow("3DES") << QString(":/rsa-with-passphrase-3des.pem");
- QTest::newRow("RC2") << QString(":/rsa-with-passphrase-rc2.pem");
+ QTest::newRow("DES") << QString(testDataDir + "/rsa-with-passphrase-des.pem");
+ QTest::newRow("3DES") << QString(testDataDir + "/rsa-with-passphrase-3des.pem");
+ QTest::newRow("RC2") << QString(testDataDir + "/rsa-with-passphrase-rc2.pem");
}
void tst_QSslKey::passphraseChecks()
@@ -434,7 +440,7 @@ void tst_QSslKey::passphraseChecks()
void tst_QSslKey::noPassphraseChecks()
{
// be sure and check a key without passphrase too
- QString fileName(":/rsa-without-passphrase.pem");
+ QString fileName(testDataDir + "/rsa-without-passphrase.pem");
QFile keyFile(fileName);
{
if (!keyFile.isOpen())