summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/io/qstandardpaths
diff options
context:
space:
mode:
authorRohan McGovern <rohan.mcgovern@nokia.com>2011-11-24 10:36:10 +1000
committerQt by Nokia <qt-info@nokia.com>2011-12-01 09:12:52 +0100
commit3385fb91e1e55e1bfa1f78dfb8ce2e9f3fdaedef (patch)
treeb77bb527bf3a21dc95a317248b2640c73751f629 /tests/auto/corelib/io/qstandardpaths
parent13eba9ddf47d570fc4562c20fcfbacd1dfa4a61a (diff)
Fixed installation of corelib tests
In .pro files, removed wince/symbian-specific DEPLOYMENT cases and replaced them with TESTDATA where appropriate. In .cpp files, removed SRCDIR and relative paths to testdata and replaced them with the QFINDTESTDATA macro where appropriate. Modified test helper apps/libs to install themselves under the test they relate to. This change allows corelib tests to be correctly installed, along with their testdata, via `make install'. Change-Id: I5e202e2f3b577af7e39072d5c9fe13e0ca125304 Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
Diffstat (limited to 'tests/auto/corelib/io/qstandardpaths')
-rw-r--r--tests/auto/corelib/io/qstandardpaths/qstandardpaths.pro8
-rw-r--r--tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp9
2 files changed, 6 insertions, 11 deletions
diff --git a/tests/auto/corelib/io/qstandardpaths/qstandardpaths.pro b/tests/auto/corelib/io/qstandardpaths/qstandardpaths.pro
index c39204af51..2ceef978cc 100644
--- a/tests/auto/corelib/io/qstandardpaths/qstandardpaths.pro
+++ b/tests/auto/corelib/io/qstandardpaths/qstandardpaths.pro
@@ -2,10 +2,4 @@ CONFIG += testcase parallel_test
TARGET = tst_qstandardpaths
QT = core testlib
SOURCES = tst_qstandardpaths.cpp
-
-wince* {
- DEFINES += SRCDIR=\\\"\\\"
-} else {
- DEFINES += SRCDIR=\\\"$$PWD/\\\"
-}
-
+TESTDATA += tst_qstandardpaths.cpp qstandardpaths.pro
diff --git a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp
index 67abd0939b..be0c85e380 100644
--- a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp
+++ b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp
@@ -73,8 +73,7 @@ private slots:
private:
void setCustomLocations() {
- m_thisDir = QFile::decodeName(SRCDIR);
- m_thisDir.chop(1); // remove trailing slash!
+ m_thisDir = QFileInfo(QFINDTESTDATA("tst_qstandardpaths.cpp")).absolutePath();
qputenv("XDG_CONFIG_HOME", QFile::encodeName(m_thisDir));
QDir parent(m_thisDir);
@@ -116,6 +115,8 @@ void tst_qstandardpaths::testCustomLocations()
// test writableLocation()
QCOMPARE(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation), m_thisDir);
+ QString thisDir_base = QFileInfo(m_thisDir).fileName();
+
// test locate()
const QString thisFileName = QString::fromLatin1("tst_qstandardpaths.cpp");
QVERIFY(QFile::exists(m_thisDir + '/' + thisFileName));
@@ -123,9 +124,9 @@ void tst_qstandardpaths::testCustomLocations()
QVERIFY(!thisFile.isEmpty());
QVERIFY(thisFile.endsWith(thisFileName));
- const QString dir = QStandardPaths::locate(QStandardPaths::ConfigLocation, QString::fromLatin1("../qstandardpaths"), QStandardPaths::LocateDirectory);
+ const QString dir = QStandardPaths::locate(QStandardPaths::ConfigLocation, QString::fromLatin1("../") + thisDir_base, QStandardPaths::LocateDirectory);
QVERIFY(!dir.isEmpty());
- const QString thisDirAsFile = QStandardPaths::locate(QStandardPaths::ConfigLocation, QString::fromLatin1("../qstandardpaths"));
+ const QString thisDirAsFile = QStandardPaths::locate(QStandardPaths::ConfigLocation, QString::fromLatin1("../") + thisDir_base);
QVERIFY(thisDirAsFile.isEmpty()); // not a file
const QStringList dirs = QStandardPaths::standardLocations(QStandardPaths::ConfigLocation);