summaryrefslogtreecommitdiffstats
path: root/tests/auto/testlib/selftests/tst_selftests.cpp
diff options
context:
space:
mode:
authorKurt Korbatits <kurt.korbatits@nokia.com>2012-01-04 12:28:20 +1000
committerQt by Nokia <qt-info@nokia.com>2012-01-05 03:49:45 +0100
commit77ddb00a49fdde54df2b232e9e901a08e48cee6d (patch)
treec417cb06865a1536fbdd3b497d27161ba3f0297c /tests/auto/testlib/selftests/tst_selftests.cpp
parent3c407147997ba84a4e2201417d53dab951f2f110 (diff)
Changed tests: qmake,selftest and lancelot to use QFINDTESTDATA.
Changed these tests to use QFINDTESTDATA macro to detect location of testdata. Checking for a specific file contained in the testdata so as not to be confused by empty directories created during configure. Change-Id: Iac2ac6304b6b9ac79e00886025b93ec0af5a8507 Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com> Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Diffstat (limited to 'tests/auto/testlib/selftests/tst_selftests.cpp')
-rw-r--r--tests/auto/testlib/selftests/tst_selftests.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/auto/testlib/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp
index cb03611af3..e8c4806794 100644
--- a/tests/auto/testlib/selftests/tst_selftests.cpp
+++ b/tests/auto/testlib/selftests/tst_selftests.cpp
@@ -291,8 +291,17 @@ static QList<LoggerSet> allLoggerSets()
void tst_Selftests::initTestCase()
{
+ //Detect the location of the sub programs
+ QString subProgram = QLatin1String("float/float");
+#if defined(Q_OS_WIN)
+ subProgram = QLatin1String("float/float.exe");
+#endif
+ QString testdataDir = QFINDTESTDATA(subProgram);
+ if (testdataDir.lastIndexOf(subProgram) > 0)
+ testdataDir = testdataDir.left(testdataDir.lastIndexOf(subProgram));
+ else
+ testdataDir = QCoreApplication::applicationDirPath();
// chdir to our testdata path and execute helper apps relative to that.
- QString testdataDir = QFileInfo(QFINDTESTDATA("float")).absolutePath();
QVERIFY2(QDir::setCurrent(testdataDir), qPrintable("Could not chdir to " + testdataDir));
}