diff options
author | Kurt Korbatits <kurt.korbatits@nokia.com> | 2012-02-16 08:25:31 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-02-17 05:24:43 +0100 |
commit | 4121f9df29c85d45e0fe128d237c0009cded7574 (patch) | |
tree | 885745d4cb6c68d2d49752e4593a4ff07d18f853 /tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp | |
parent | 20f6dc615ac6dfe97681eb1652a10e6d29affbce (diff) |
Changed qsslkey to work from installation directory
- Changed to use TESTDATA and QFINDTESTDATA instead of SRCDIR
Change-Id: I30bf175c2c9044e1f8556260a032467ca0dfc09f
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
Diffstat (limited to 'tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp')
-rw-r--r-- | tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp | 43 |
1 files changed, 11 insertions, 32 deletions
diff --git a/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp b/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp index 657b91152f..e8941a2642 100644 --- a/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp +++ b/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp @@ -68,14 +68,8 @@ class tst_QSslKey : public QObject void createPlainTestRows(); -public: - tst_QSslKey(); - virtual ~tst_QSslKey(); - public slots: - void initTestCase_data(); - void init(); - void cleanup(); + void initTestCase(); #ifndef QT_NO_OPENSSL @@ -95,16 +89,17 @@ private slots: void passphraseChecks(); #endif +private: + QString testDataDir; }; -tst_QSslKey::tst_QSslKey() +void tst_QSslKey::initTestCase() { -#ifdef Q_OS_MAC - // applicationDirPath() points to a path inside the app bundle on Mac. - QDir dir(qApp->applicationDirPath() + QLatin1String("/../../../keys")); -#else - QDir dir(SRCDIR + QLatin1String("/keys")); // prefer this way to avoid ifdeffery and support shadow builds? -#endif + 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)-(pub|pri)-(\\d+)\\.(pem|der)$")); foreach (QFileInfo fileInfo, fileInfoList) { @@ -118,22 +113,6 @@ tst_QSslKey::tst_QSslKey() } } -tst_QSslKey::~tst_QSslKey() -{ -} - -void tst_QSslKey::initTestCase_data() -{ -} - -void tst_QSslKey::init() -{ -} - -void tst_QSslKey::cleanup() -{ -} - static QByteArray readFile(const QString &absFilePath) { QFile file(absFilePath); @@ -368,7 +347,7 @@ void tst_QSslKey::toEncryptedPemOrDer() void tst_QSslKey::passphraseChecks() { { - QString fileName(SRCDIR "/rsa-with-passphrase.pem"); + QString fileName(testDataDir + "/rsa-with-passphrase.pem"); QFile keyFile(fileName); QVERIFY(keyFile.exists()); { @@ -407,7 +386,7 @@ void tst_QSslKey::passphraseChecks() { // be sure and check a key without passphrase too - QString fileName(SRCDIR "/rsa-without-passphrase.pem"); + QString fileName(testDataDir + "/rsa-without-passphrase.pem"); QFile keyFile(fileName); { if (!keyFile.isOpen()) |