Fixed installation of corelib tests
authorRohan McGovern <rohan.mcgovern@nokia.com>
Thu, 24 Nov 2011 00:36:10 +0000 (10:36 +1000)
committerQt by Nokia <qt-info@nokia.com>
Thu, 1 Dec 2011 08:12:52 +0000 (09:12 +0100)
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>
84 files changed:
tests/auto/corelib/codecs/qtextcodec/test/test.pro
tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp
tests/auto/corelib/io/qdatastream/qdatastream.pro
tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp
tests/auto/corelib/io/qdir/qdir.pro
tests/auto/corelib/io/qdir/tst_qdir.cpp
tests/auto/corelib/io/qdiriterator/qdiriterator.pro
tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp
tests/auto/corelib/io/qfile/stdinprocess/stdinprocess.pro
tests/auto/corelib/io/qfile/test/test.pro
tests/auto/corelib/io/qfile/tst_qfile.cpp
tests/auto/corelib/io/qfileinfo/qfileinfo.pro
tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
tests/auto/corelib/io/qiodevice/qiodevice.pro
tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp
tests/auto/corelib/io/qprocess/fileWriterProcess/fileWriterProcess.pro
tests/auto/corelib/io/qprocess/test/test.pro
tests/auto/corelib/io/qprocess/testDetached/testDetached.pro
tests/auto/corelib/io/qprocess/testExitCodes/testExitCodes.pro
tests/auto/corelib/io/qprocess/testGuiProcess/testGuiProcess.pro
tests/auto/corelib/io/qprocess/testProcessCrash/testProcessCrash.pro
tests/auto/corelib/io/qprocess/testProcessDeadWhileReading/testProcessDeadWhileReading.pro
tests/auto/corelib/io/qprocess/testProcessEOF/testProcessEOF.pro
tests/auto/corelib/io/qprocess/testProcessEcho/testProcessEcho.pro
tests/auto/corelib/io/qprocess/testProcessEcho2/testProcessEcho2.pro
tests/auto/corelib/io/qprocess/testProcessEcho3/testProcessEcho3.pro
tests/auto/corelib/io/qprocess/testProcessEchoGui/testProcessEchoGui.pro
tests/auto/corelib/io/qprocess/testProcessEnvironment/testProcessEnvironment.pro
tests/auto/corelib/io/qprocess/testProcessLoopback/testProcessLoopback.pro
tests/auto/corelib/io/qprocess/testProcessNormal/testProcessNormal.pro
tests/auto/corelib/io/qprocess/testProcessOutput/testProcessOutput.pro
tests/auto/corelib/io/qprocess/testProcessSpacesArgs/nospace.pro
tests/auto/corelib/io/qprocess/testProcessSpacesArgs/onespace.pro
tests/auto/corelib/io/qprocess/testProcessSpacesArgs/twospaces.pro
tests/auto/corelib/io/qprocess/testSetWorkingDirectory/testSetWorkingDirectory.pro
tests/auto/corelib/io/qprocess/testSoftExit/testSoftExit.pro
tests/auto/corelib/io/qprocess/testSpaceInName/testSpaceInName.pro
tests/auto/corelib/io/qprocess/tst_qprocess.cpp
tests/auto/corelib/io/qresourceengine/qresourceengine.pro
tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp
tests/auto/corelib/io/qstandardpaths/qstandardpaths.pro
tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp
tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro
tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp
tests/auto/corelib/io/qtextstream/readAllStdinProcess/readAllStdinProcess.pro
tests/auto/corelib/io/qtextstream/readLineStdinProcess/readLineStdinProcess.pro
tests/auto/corelib/io/qtextstream/stdinProcess/stdinProcess.pro
tests/auto/corelib/io/qtextstream/test/test.pro
tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp
tests/auto/corelib/kernel/qitemmodel/qitemmodel.pro
tests/auto/corelib/kernel/qobject/signalbug.pro
tests/auto/corelib/kernel/qobject/tst_qobject.cpp
tests/auto/corelib/kernel/qobject/tst_qobject.pro
tests/auto/corelib/kernel/qtranslator/qtranslator.pro
tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp
tests/auto/corelib/plugin/qlibrary/lib/lib.pro
tests/auto/corelib/plugin/qlibrary/lib2/lib2.pro
tests/auto/corelib/plugin/qlibrary/tst/tst.pro
tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp
tests/auto/corelib/plugin/qplugin/tst_qplugin.pro
tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.pro
tests/auto/corelib/plugin/qpluginloader/lib/lib.pro
tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.pro
tests/auto/corelib/plugin/qpluginloader/tst/tst.pro
tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp
tests/auto/corelib/plugin/quuid/test/test.pro
tests/auto/corelib/plugin/quuid/testProcessUniqueness/testProcessUniqueness.pro
tests/auto/corelib/plugin/quuid/tst_quuid.cpp
tests/auto/corelib/thread/qthreadstorage/crashOnExit.pro
tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp
tests/auto/corelib/tools/qbytearray/qbytearray.pro
tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp
tests/auto/corelib/tools/qchar/qchar.pro
tests/auto/corelib/tools/qchar/tst_qchar.cpp
tests/auto/corelib/tools/qelapsedtimer/qelapsedtimer.pro
tests/auto/corelib/tools/qlocale/syslocaleapp/syslocaleapp.pro
tests/auto/corelib/tools/qlocale/test/test.pro
tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
tests/auto/corelib/tools/qsharedpointer/qsharedpointer.pro
tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro
tests/auto/corelib/tools/qtextboundaryfinder/tst_qtextboundaryfinder.cpp
tests/auto/corelib/xml/qxmlstream/qxmlstream.pro
tests/auto/corelib/xml/qxmlstream/tst_qxmlstream.cpp

index 16b831e..29b359c 100644 (file)
@@ -2,23 +2,12 @@ CONFIG += testcase
 QT += testlib
 SOURCES = ../tst_qtextcodec.cpp
 
-!wince* {
-    TARGET = ../tst_qtextcodec
-    win32: {
-        CONFIG(debug, debug|release) {
-            TARGET = ../../debug/tst_qtextcodec
-        } else {
-            TARGET = ../../release/tst_qtextcodec
-        }
+TARGET = ../tst_qtextcodec
+win32 {
+    CONFIG(debug, debug|release) {
+        TARGET = ../../debug/tst_qtextcodec
+    } else {
+        TARGET = ../../release/tst_qtextcodec
     }
-    DEFINES += SRCDIR=\\\"$$PWD/../\\\"
-} else {
-    TARGET = tst_qtextcodec
-    addFiles.files = ../*.txt
-    addFiles.path = .
-    DEPLOYMENT += addFiles
-    qt_not_deployed {
-        DEPLOYMENT_PLUGIN += qcncodecs qjpcodecs qkrcodecs qtwcodecs
-    }
-    DEFINES += SRCDIR=\\\"\\\"
 }
+TESTDATA += ../*.txt
index 845684b..deb983c 100644 (file)
@@ -110,8 +110,8 @@ void tst_QTextCodec::toUnicode_data()
     QTest::addColumn<QString>("fileName");
     QTest::addColumn<QString>("codecName");
 
-    QTest::newRow( "korean-eucKR" ) << SRCDIR "korean.txt" << "eucKR";
-    QTest::newRow( "UTF-8" ) << SRCDIR "utf8.txt" << "UTF-8";
+    QTest::newRow( "korean-eucKR" ) << QFINDTESTDATA("korean.txt") << "eucKR";
+    QTest::newRow( "UTF-8" ) << QFINDTESTDATA("utf8.txt") << "UTF-8";
 }
 
 void tst_QTextCodec::toUnicode()
@@ -288,7 +288,7 @@ void tst_QTextCodec::fromUnicode()
 
 void tst_QTextCodec::toUnicode_codecForHtml()
 {
-    QFile file(QString(SRCDIR "QT4-crashtest.txt"));
+    QFile file(QFINDTESTDATA("QT4-crashtest.txt"));
     QVERIFY(file.open(QFile::ReadOnly));
 
     QByteArray data = file.readAll();
index b8af1b4..84d34b0 100644 (file)
@@ -3,11 +3,4 @@ TARGET = tst_qdatastream
 QT += widgets testlib
 SOURCES = tst_qdatastream.cpp
 
-wince* {
-    addFiles.files = datastream.q42
-    addFiles.path = .
-    DEPLOYMENT += addFiles
-    DEFINES += SRCDIR=\\\"\\\"
-} else {
-    DEFINES += SRCDIR=\\\"$$PWD/\\\"
-}
+TESTDATA += datastream.q42
index db54db6..00cb43e 100644 (file)
@@ -2917,7 +2917,7 @@ void tst_QDataStream::streamRealDataTypes()
     for (int i = 0; i < 2; ++i) {
         QFile file;
         if (i == 0) {
-            file.setFileName(SRCDIR "datastream.q42");
+            file.setFileName(QFINDTESTDATA("datastream.q42"));
         } else {
             file.setFileName("datastream.tmp");
 
index c26262e..14f2d88 100644 (file)
@@ -4,11 +4,4 @@ QT = core testlib
 SOURCES = tst_qdir.cpp
 RESOURCES += qdir.qrc
 
-wince* {
-  DirFiles.files = testdir testData searchdir resources entrylist types tst_qdir.cpp
-  DirFiles.path = .
-  DEPLOYMENT += DirFiles
-  DEFINES += SRCDIR=\\\"\\\"
-} else {
-  DEFINES += SRCDIR=\\\"$$PWD/\\\"
-}
+TESTDATA += testdir testData searchdir resources entrylist types tst_qdir.cpp
index d6944ea..fc63d6e 100644 (file)
@@ -75,6 +75,8 @@ class tst_QDir : public QObject
 Q_OBJECT
 
 private slots:
+    void init();
+
     void getSetCheck();
     void construction();
 
@@ -184,8 +186,21 @@ private slots:
     void isRelative();
 
     void isReadable();
+
+private:
+    QString m_dataPath;
 };
 
+void tst_QDir::init()
+{
+    // Directory under which testdata can be found.
+    m_dataPath = QFileInfo(QFINDTESTDATA("testData")).absolutePath();
+    QVERIFY2(!m_dataPath.isEmpty(), "test data not found");
+
+    // Some tests want to use "." as relative path to data.
+    QVERIFY2(QDir::setCurrent(m_dataPath), qPrintable("Could not chdir to " + m_dataPath));
+}
+
 // Testing get/set functions
 void tst_QDir::getSetCheck()
 {
@@ -328,8 +343,8 @@ void tst_QDir::exists_data()
     QTest::newRow("resource0") << QString(":/tst_qdir/") << true;
     QTest::newRow("resource1") << QString(":/I/Do_not_expect_this_resource_to_exist/") << false;
 
-    QTest::newRow("simple dir") << SRCDIR "resources" << true;
-    QTest::newRow("simple dir with slash") << SRCDIR "resources/" << true;
+    QTest::newRow("simple dir") << (m_dataPath + "/resources") << true;
+    QTest::newRow("simple dir with slash") << (m_dataPath + "/resources/") << true;
 #if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE))
     QTest::newRow("unc 1") << "//" + QtNetworkSettings::winServerName() << true;
     QTest::newRow("unc 2") << "//"  + QtNetworkSettings::winServerName() + "/" << true;
@@ -438,19 +453,19 @@ void tst_QDir::entryList_data()
     QTest::addColumn<int>("filterspec");
     QTest::addColumn<int>("sortspec");
     QTest::addColumn<QStringList>("expected");
-    QTest::newRow("spaces1") << SRCDIR "testdir/spaces" << QStringList("*. bar")
+    QTest::newRow("spaces1") << (m_dataPath + "/testdir/spaces") << QStringList("*. bar")
               << (int)(QDir::NoFilter) << (int)(QDir::NoSort)
               << QStringList("foo. bar"); // notice how spaces5 works
-    QTest::newRow("spaces2") << SRCDIR "testdir/spaces" << QStringList("*.bar")
+    QTest::newRow("spaces2") << (m_dataPath + "/testdir/spaces") << QStringList("*.bar")
               << (int)(QDir::NoFilter) << (int)(QDir::NoSort)
               << QStringList("foo.bar");
-    QTest::newRow("spaces3") << SRCDIR "testdir/spaces" << QStringList("foo.*")
+    QTest::newRow("spaces3") << (m_dataPath + "/testdir/spaces") << QStringList("foo.*")
               << (int)(QDir::NoFilter) << (int)(QDir::NoSort)
               << QString("foo. bar,foo.bar").split(',');
-    QTest::newRow("files1")  << SRCDIR "testdir/dir" << QString("*r.cpp *.pro").split(" ")
+    QTest::newRow("files1")  << (m_dataPath + "/testdir/dir") << QString("*r.cpp *.pro").split(" ")
               << (int)(QDir::NoFilter) << (int)(QDir::NoSort)
               << QString("qdir.pro,qrc_qdir.cpp,tst_qdir.cpp").split(',');
-    QTest::newRow("testdir1")  << SRCDIR "testdir" << QStringList()
+    QTest::newRow("testdir1")  << (m_dataPath + "/testdir") << QStringList()
               << (int)(QDir::AllDirs) << (int)(QDir::NoSort)
               << QString(".,..,dir,spaces").split(',');
     QTest::newRow("resources1") << QString(":/tst_qdir/resources/entryList") << QStringList("*.data")
@@ -460,107 +475,107 @@ void tst_QDir::entryList_data()
                              << (int)(QDir::Files) << (int)(QDir::NoSort)
                              << QString("file1.data,file2.data,file3.data").split(',');
 
-    QTest::newRow("nofilter") << SRCDIR "entrylist/" << QStringList("*")
+    QTest::newRow("nofilter") << (m_dataPath + "/entrylist/") << QStringList("*")
                               << int(QDir::NoFilter) << int(QDir::Name)
                               << filterLinks(QString(".,..,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(','));
-    QTest::newRow("QDir::AllEntries") << SRCDIR "entrylist/" << QStringList("*")
+    QTest::newRow("QDir::AllEntries") << (m_dataPath + "/entrylist/") << QStringList("*")
                               << int(QDir::AllEntries) << int(QDir::Name)
                               << filterLinks(QString(".,..,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(','));
-    QTest::newRow("QDir::Files") << SRCDIR "entrylist/" << QStringList("*")
+    QTest::newRow("QDir::Files") << (m_dataPath + "/entrylist/") << QStringList("*")
                                  << int(QDir::Files) << int(QDir::Name)
                                  << filterLinks(QString("file,linktofile.lnk,writable").split(','));
-    QTest::newRow("QDir::Dirs") << SRCDIR "entrylist/" << QStringList("*")
+    QTest::newRow("QDir::Dirs") << (m_dataPath + "/entrylist/") << QStringList("*")
                                 << int(QDir::Dirs) << int(QDir::Name)
                                 << filterLinks(QString(".,..,directory,linktodirectory.lnk").split(','));
-    QTest::newRow("QDir::Dirs | QDir::NoDotAndDotDot") << SRCDIR "entrylist/" << QStringList("*")
+    QTest::newRow("QDir::Dirs | QDir::NoDotAndDotDot") << (m_dataPath + "/entrylist/") << QStringList("*")
                                                        << int(QDir::Dirs | QDir::NoDotAndDotDot) << int(QDir::Name)
                                 << filterLinks(QString("directory,linktodirectory.lnk").split(','));
-    QTest::newRow("QDir::AllDirs") << SRCDIR "entrylist/" << QStringList("*")
+    QTest::newRow("QDir::AllDirs") << (m_dataPath + "/entrylist/") << QStringList("*")
                                    << int(QDir::AllDirs) << int(QDir::Name)
                                    << filterLinks(QString(".,..,directory,linktodirectory.lnk").split(','));
-    QTest::newRow("QDir::AllDirs | QDir::Dirs") << SRCDIR "entrylist/" << QStringList("*")
+    QTest::newRow("QDir::AllDirs | QDir::Dirs") << (m_dataPath + "/entrylist/") << QStringList("*")
                                                 << int(QDir::AllDirs | QDir::Dirs) << int(QDir::Name)
                                                 << filterLinks(QString(".,..,directory,linktodirectory.lnk").split(','));
-    QTest::newRow("QDir::AllDirs | QDir::Files") << SRCDIR "entrylist/" << QStringList("*")
+    QTest::newRow("QDir::AllDirs | QDir::Files") << (m_dataPath + "/entrylist/") << QStringList("*")
                                                  << int(QDir::AllDirs | QDir::Files) << int(QDir::Name)
                                                  << filterLinks(QString(".,..,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(','));
-    QTest::newRow("QDir::AllEntries | QDir::NoSymLinks") << SRCDIR "entrylist/" << QStringList("*")
+    QTest::newRow("QDir::AllEntries | QDir::NoSymLinks") << (m_dataPath + "/entrylist/") << QStringList("*")
                                       << int(QDir::AllEntries | QDir::NoSymLinks) << int(QDir::Name)
                                       << filterLinks(QString(".,..,directory,file,writable").split(','));
-    QTest::newRow("QDir::AllEntries | QDir::NoSymLinks | QDir::NoDotAndDotDot") << SRCDIR "entrylist/" << QStringList("*")
+    QTest::newRow("QDir::AllEntries | QDir::NoSymLinks | QDir::NoDotAndDotDot") << (m_dataPath + "/entrylist/") << QStringList("*")
                                       << int(QDir::AllEntries | QDir::NoSymLinks | QDir::NoDotAndDotDot) << int(QDir::Name)
                                       << filterLinks(QString("directory,file,writable").split(','));
-    QTest::newRow("QDir::Files | QDir::NoSymLinks") << SRCDIR "entrylist/" << QStringList("*")
+    QTest::newRow("QDir::Files | QDir::NoSymLinks") << (m_dataPath + "/entrylist/") << QStringList("*")
                                                     << int(QDir::Files | QDir::NoSymLinks) << int(QDir::Name)
                                                     << filterLinks(QString("file,writable").split(','));
-    QTest::newRow("QDir::Dirs | QDir::NoSymLinks") << SRCDIR "entrylist/" << QStringList("*")
+    QTest::newRow("QDir::Dirs | QDir::NoSymLinks") << (m_dataPath + "/entrylist/") << QStringList("*")
                                                    << int(QDir::Dirs | QDir::NoSymLinks) << int(QDir::Name)
                                                    << filterLinks(QString(".,..,directory").split(','));
-    QTest::newRow("QDir::Drives | QDir::Files | QDir::NoDotAndDotDot") << SRCDIR "entrylist/" << QStringList("*")
+    QTest::newRow("QDir::Drives | QDir::Files | QDir::NoDotAndDotDot") << (m_dataPath + "/entrylist/") << QStringList("*")
                                                    << int(QDir::Drives | QDir::Files | QDir::NoDotAndDotDot) << int(QDir::Name)
                                                    << filterLinks(QString("file,linktofile.lnk,writable").split(','));
-    QTest::newRow("QDir::System") << SRCDIR "entrylist/" << QStringList("*")
+    QTest::newRow("QDir::System") << (m_dataPath + "/entrylist/") << QStringList("*")
                                   << int(QDir::System) << int(QDir::Name)
                                   << filterLinks(QStringList("brokenlink.lnk"));
-    QTest::newRow("QDir::Hidden") << SRCDIR "entrylist/" << QStringList("*")
+    QTest::newRow("QDir::Hidden") << (m_dataPath + "/entrylist/") << QStringList("*")
                                   << int(QDir::Hidden) << int(QDir::Name)
                                   << QStringList();
-    QTest::newRow("QDir::System | QDir::Hidden") << SRCDIR "entrylist/" << QStringList("*")
+    QTest::newRow("QDir::System | QDir::Hidden") << (m_dataPath + "/entrylist/") << QStringList("*")
                                   << int(QDir::System | QDir::Hidden) << int(QDir::Name)
                                   << filterLinks(QStringList("brokenlink.lnk"));
-    QTest::newRow("QDir::AllDirs | QDir::NoSymLinks") << SRCDIR "entrylist/" << QStringList("*")
+    QTest::newRow("QDir::AllDirs | QDir::NoSymLinks") << (m_dataPath + "/entrylist/") << QStringList("*")
                                                       << int(QDir::AllDirs | QDir::NoSymLinks) << int(QDir::Name)
                                                       << filterLinks(QString(".,..,directory").split(','));
-    QTest::newRow("QDir::AllEntries | QDir::Hidden | QDir::System") << SRCDIR "entrylist/" << QStringList("*")
+    QTest::newRow("QDir::AllEntries | QDir::Hidden | QDir::System") << (m_dataPath + "/entrylist/") << QStringList("*")
                                   << int(QDir::AllEntries | QDir::Hidden | QDir::System) << int(QDir::Name)
                                   << filterLinks(QString(".,..,brokenlink.lnk,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(','));
-    QTest::newRow("QDir::AllEntries | QDir::Readable") << SRCDIR "entrylist/" << QStringList("*")
+    QTest::newRow("QDir::AllEntries | QDir::Readable") << (m_dataPath + "/entrylist/") << QStringList("*")
                                   << int(QDir::AllEntries | QDir::Readable) << int(QDir::Name)
                                                 << filterLinks(QString(".,..,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(','));
-    QTest::newRow("QDir::AllEntries | QDir::Writable") << SRCDIR "entrylist/" << QStringList("*")
+    QTest::newRow("QDir::AllEntries | QDir::Writable") << (m_dataPath + "/entrylist/") << QStringList("*")
                                   << int(QDir::AllEntries | QDir::Writable) << int(QDir::Name)
                                   << filterLinks(QString(".,..,directory,linktodirectory.lnk,writable").split(','));
-    QTest::newRow("QDir::Files | QDir::Readable") << SRCDIR "entrylist/" << QStringList("*")
+    QTest::newRow("QDir::Files | QDir::Readable") << (m_dataPath + "/entrylist/") << QStringList("*")
                                   << int(QDir::Files | QDir::Readable) << int(QDir::Name)
                                   << filterLinks(QString("file,linktofile.lnk,writable").split(','));
-    QTest::newRow("QDir::Dirs | QDir::Readable") << SRCDIR "entrylist/" << QStringList("*")
+    QTest::newRow("QDir::Dirs | QDir::Readable") << (m_dataPath + "/entrylist/") << QStringList("*")
                                   << int(QDir::Dirs | QDir::Readable) << int(QDir::Name)
                                   << filterLinks(QString(".,..,directory,linktodirectory.lnk").split(','));
-    QTest::newRow("Namefilters b*") << SRCDIR "entrylist/" << QStringList("d*")
+    QTest::newRow("Namefilters b*") << (m_dataPath + "/entrylist/") << QStringList("d*")
                                   << int(QDir::NoFilter) << int(QDir::Name)
                                   << filterLinks(QString("directory").split(','));
-    QTest::newRow("Namefilters f*") << SRCDIR "entrylist/" << QStringList("f*")
+    QTest::newRow("Namefilters f*") << (m_dataPath + "/entrylist/") << QStringList("f*")
                                   << int(QDir::NoFilter) << int(QDir::Name)
                                   << filterLinks(QString("file").split(','));
-    QTest::newRow("Namefilters link*") << SRCDIR "entrylist/" << QStringList("link*")
+    QTest::newRow("Namefilters link*") << (m_dataPath + "/entrylist/") << QStringList("link*")
                                   << int(QDir::NoFilter) << int(QDir::Name)
                                   << filterLinks(QString("linktodirectory.lnk,linktofile.lnk").split(','));
-    QTest::newRow("Namefilters *to*") << SRCDIR "entrylist/" << QStringList("*to*")
+    QTest::newRow("Namefilters *to*") << (m_dataPath + "/entrylist/") << QStringList("*to*")
                                   << int(QDir::NoFilter) << int(QDir::Name)
                                   << filterLinks(QString("directory,linktodirectory.lnk,linktofile.lnk").split(','));
-    QTest::newRow("Sorting QDir::Name") << SRCDIR "entrylist/" << QStringList("*")
+    QTest::newRow("Sorting QDir::Name") << (m_dataPath + "/entrylist/") << QStringList("*")
                                   << int(QDir::NoFilter) << int(QDir::Name)
                                   << filterLinks(QString(".,..,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(','));
-    QTest::newRow("Sorting QDir::Name | QDir::Reversed") << SRCDIR "entrylist/" << QStringList("*")
+    QTest::newRow("Sorting QDir::Name | QDir::Reversed") << (m_dataPath + "/entrylist/") << QStringList("*")
                                   << int(QDir::NoFilter) << int(QDir::Name | QDir::Reversed)
                                   << filterLinks(QString("writable,linktofile.lnk,linktodirectory.lnk,file,directory,..,.").split(','));
 
-    QTest::newRow("Sorting QDir::Type") << SRCDIR "types/" << QStringList("*")
+    QTest::newRow("Sorting QDir::Type") << (m_dataPath + "/types/") << QStringList("*")
                                   << int(QDir::NoFilter) << int(QDir::Type)
                                   << QString(".,..,a,b,c,d,e,f,a.a,b.a,c.a,d.a,e.a,f.a,a.b,b.b,c.b,d.b,e.b,f.b,a.c,b.c,c.c,d.c,e.c,f.c").split(',');
-    QTest::newRow("Sorting QDir::Type | QDir::Reversed") << SRCDIR "types/" << QStringList("*")
+    QTest::newRow("Sorting QDir::Type | QDir::Reversed") << (m_dataPath + "/types/") << QStringList("*")
                                   << int(QDir::NoFilter) << int(QDir::Type | QDir::Reversed)
                                   << QString("f.c,e.c,d.c,c.c,b.c,a.c,f.b,e.b,d.b,c.b,b.b,a.b,f.a,e.a,d.a,c.a,b.a,a.a,f,e,d,c,b,a,..,.").split(',');
-    QTest::newRow("Sorting QDir::Type | QDir::DirsLast") << SRCDIR "types/" << QStringList("*")
+    QTest::newRow("Sorting QDir::Type | QDir::DirsLast") << (m_dataPath + "/types/") << QStringList("*")
                                   << int(QDir::NoFilter) << int(QDir::Type | QDir::DirsLast)
                                   << QString("a,b,c,a.a,b.a,c.a,a.b,b.b,c.b,a.c,b.c,c.c,.,..,d,e,f,d.a,e.a,f.a,d.b,e.b,f.b,d.c,e.c,f.c").split(',');
-    QTest::newRow("Sorting QDir::Type | QDir::DirsFirst") << SRCDIR "types/" << QStringList("*")
+    QTest::newRow("Sorting QDir::Type | QDir::DirsFirst") << (m_dataPath + "/types/") << QStringList("*")
                                   << int(QDir::NoFilter) << int(QDir::Type | QDir::DirsFirst)
                                   << QString(".,..,d,e,f,d.a,e.a,f.a,d.b,e.b,f.b,d.c,e.c,f.c,a,b,c,a.a,b.a,c.a,a.b,b.b,c.b,a.c,b.c,c.c").split(',');
-    QTest::newRow("Sorting QDir::Size") << SRCDIR "types/" << QStringList("*")
+    QTest::newRow("Sorting QDir::Size") << (m_dataPath + "/types/") << QStringList("*")
                                   << int(QDir::AllEntries|QDir::NoDotAndDotDot) << int(QDir::Size | QDir::DirsFirst)
                                   << QString("d,d.a,d.b,d.c,e,e.a,e.b,e.c,f,f.a,f.b,f.c,c.a,c.b,c.c,b.a,b.c,b.b,a.c,a.b,a.a,a,b,c").split(',');
-    QTest::newRow("Sorting QDir::Size | QDir::Reversed") << SRCDIR "types/" << QStringList("*")
+    QTest::newRow("Sorting QDir::Size | QDir::Reversed") << (m_dataPath + "/types/") << QStringList("*")
                                   << int(QDir::AllEntries|QDir::NoDotAndDotDot) << int(QDir::Size | QDir::Reversed | QDir::DirsLast)
                                   << QString("c,b,a,a.a,a.b,a.c,b.b,b.c,b.a,c.c,c.b,c.a,f.c,f.b,f.a,f,e.c,e.b,e.a,e,d.c,d.b,d.a,d").split(',');
 }
@@ -573,14 +588,15 @@ void tst_QDir::entryList()
     QFETCH(int, sortspec);
     QFETCH(QStringList, expected);
 
-    QFile(SRCDIR "entrylist/writable").open(QIODevice::ReadWrite);
-    QFile(SRCDIR "entrylist/file").setPermissions(QFile::ReadOwner | QFile::ReadUser);
-    QFile::remove(SRCDIR "entrylist/linktofile");
-    QFile::remove(SRCDIR "entrylist/linktodirectory");
-    QFile::remove(SRCDIR "entrylist/linktofile.lnk");
-    QFile::remove(SRCDIR "entrylist/linktodirectory.lnk");
-    QFile::remove(SRCDIR "entrylist/brokenlink.lnk");
-    QFile::remove(SRCDIR "entrylist/brokenlink");
+    QString entrylistPath = (m_dataPath + "/entrylist/");
+    QFile(entrylistPath + "writable").open(QIODevice::ReadWrite);
+    QFile(entrylistPath + "file").setPermissions(QFile::ReadOwner | QFile::ReadUser);
+    QFile::remove(entrylistPath + "linktofile");
+    QFile::remove(entrylistPath + "linktodirectory");
+    QFile::remove(entrylistPath + "linktofile.lnk");
+    QFile::remove(entrylistPath + "linktodirectory.lnk");
+    QFile::remove(entrylistPath + "brokenlink.lnk");
+    QFile::remove(entrylistPath + "brokenlink");
 
     // WinCE does not have . and .. in the directory listing
 #if defined(Q_OS_WINCE)
@@ -591,13 +607,14 @@ void tst_QDir::entryList()
 #ifndef Q_NO_SYMLINKS
 #if defined(Q_OS_WIN)
     // ### Sadly, this is a platform difference right now.
-    QFile::link(SRCDIR "entryList/file", SRCDIR "entrylist/linktofile.lnk");
-    QFile::link(SRCDIR "entryList/directory", SRCDIR "entrylist/linktodirectory.lnk");
-    QFile::link(SRCDIR "entryList/nothing", SRCDIR "entrylist/brokenlink.lnk");
+    // Note we are using capital L in entryList on one side here, to test case-insensitivity
+    QFile::link((m_dataPath + "/entryList/") + "file", entrylistPath + "linktofile.lnk");
+    QFile::link((m_dataPath + "/entryList/") + "directory", entrylistPath + "linktodirectory.lnk");
+    QFile::link((m_dataPath + "/entryList/") + "nothing"), entrylistPath + "brokenlink.lnk");
 #else
-    QFile::link("file", SRCDIR "entrylist/linktofile.lnk");
-    QFile::link("directory", SRCDIR "entrylist/linktodirectory.lnk");
-    QFile::link("nothing", SRCDIR "entrylist/brokenlink.lnk");
+    QFile::link("file", entrylistPath + "linktofile.lnk");
+    QFile::link("directory", entrylistPath + "linktodirectory.lnk");
+    QFile::link("nothing", entrylistPath + "brokenlink.lnk");
 #endif
 #endif //Q_NO_SYMLINKS
 
@@ -625,13 +642,13 @@ void tst_QDir::entryList()
         QCOMPARE(actual.count(), expected.count());
     }
 
-    QFile::remove(SRCDIR "entrylist/writable");
-    QFile::remove(SRCDIR "entrylist/linktofile");
-    QFile::remove(SRCDIR "entrylist/linktodirectory");
-    QFile::remove(SRCDIR "entrylist/linktofile.lnk");
-    QFile::remove(SRCDIR "entrylist/linktodirectory.lnk");
-    QFile::remove(SRCDIR "entrylist/brokenlink.lnk");
-    QFile::remove(SRCDIR "entrylist/brokenlink");
+    QFile::remove(entrylistPath + "writable");
+    QFile::remove(entrylistPath + "linktofile");
+    QFile::remove(entrylistPath + "linktodirectory");
+    QFile::remove(entrylistPath + "linktofile.lnk");
+    QFile::remove(entrylistPath + "linktodirectory.lnk");
+    QFile::remove(entrylistPath + "brokenlink.lnk");
+    QFile::remove(entrylistPath + "brokenlink");
 }
 
 void tst_QDir::entryListSimple_data()
@@ -641,11 +658,11 @@ void tst_QDir::entryListSimple_data()
 
     QTest::newRow("data2") << "do_not_expect_this_path_to_exist/" << 0;
 #if defined(Q_OS_WINCE)
-    QTest::newRow("simple dir") << SRCDIR "resources" << 0;
-    QTest::newRow("simple dir with slash") << SRCDIR "resources/" << 0;
+    QTest::newRow("simple dir") << (m_dataPath + "/resources") << 0;
+    QTest::newRow("simple dir with slash") << (m_dataPath + "/resources/") << 0;
 #else
-    QTest::newRow("simple dir") << SRCDIR "resources" << 2;
-    QTest::newRow("simple dir with slash") << SRCDIR "resources/" << 2;
+    QTest::newRow("simple dir") << (m_dataPath + "/resources") << 2;
+    QTest::newRow("simple dir with slash") << (m_dataPath + "/resources/") << 2;
 #endif
 
 #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
@@ -721,27 +738,14 @@ void tst_QDir::canonicalPath_data()
 {
     QTest::addColumn<QString>("path");
     QTest::addColumn<QString>("canonicalPath");
-    QString appPath = SRCDIR;
-    if (appPath.isEmpty())
-        appPath = QCoreApplication::instance()->applicationDirPath();
-    else
-        appPath.chop(1);        // remove the ending slash
 
-#if defined Q_OS_WIN
-    if (appPath.endsWith("release", Qt::CaseInsensitive) || appPath.endsWith("debug", Qt::CaseInsensitive)) {
-        QDir appDir(appPath);
-        QVERIFY(appDir.cdUp());
-        appPath = appDir.absolutePath();
-    }
-#endif
-
-    QTest::newRow("relative") << "." << appPath;
-    QTest::newRow("relativeSubDir") << "./testData/../testData" << appPath + "/testData";
+    QTest::newRow("relative") << "." << m_dataPath;
+    QTest::newRow("relativeSubDir") << "./testData/../testData" << m_dataPath + "/testData";
 
 #ifndef Q_OS_WIN
-    QTest::newRow("absPath") << appPath + "/testData/../testData" << appPath + "/testData";
+    QTest::newRow("absPath") << m_dataPath + "/testData/../testData" << m_dataPath + "/testData";
 #else
-    QTest::newRow("absPath") << appPath + "\\testData\\..\\testData" << appPath + "/testData";
+    QTest::newRow("absPath") << m_dataPath + "\\testData\\..\\testData" << m_dataPath + "/testData";
 #endif
     QTest::newRow("nonexistant") << "testd" << QString();
 
@@ -768,16 +772,12 @@ void tst_QDir::canonicalPath_data()
 
 void tst_QDir::canonicalPath()
 {
-    QDir srcPath;
-    if (strlen(SRCDIR) > 0)
-        srcPath = QDir(SRCDIR);
-    else
-        srcPath = QDir(".");
-    if (srcPath.absolutePath() != srcPath.canonicalPath())
+    QDir dataDir(m_dataPath);
+    if (dataDir.absolutePath() != dataDir.canonicalPath())
         QSKIP("This test does not work if this directory path consists of symlinks.");
 
     QString oldpwd = QDir::currentPath();
-    QDir::setCurrent(srcPath.absolutePath());
+    QDir::setCurrent(dataDir.absolutePath());
 
     QFETCH(QString, path);
     QFETCH(QString, canonicalPath);
@@ -796,37 +796,23 @@ void tst_QDir::current_data()
 {
     QTest::addColumn<QString>("path");
     QTest::addColumn<QString>("currentDir");
-    QString appPath = SRCDIR;
-    if (appPath.isEmpty())
-        appPath = QCoreApplication::instance()->applicationDirPath();
-    else
-        appPath.chop(1);        // remove the ending slash
-#if defined Q_OS_WIN
-    if (appPath.endsWith("release", Qt::CaseInsensitive))
-        appPath = appPath.left(appPath.length()-8);
-    else if (appPath.endsWith("debug", Qt::CaseInsensitive))
-        appPath = appPath.left(appPath.length()-6);
-#endif
 
-    QTest::newRow("startup") << QString() << appPath;
-    QTest::newRow("relPath") << "testData" << appPath + "/testData";
+    QTest::newRow("startup") << QString() << m_dataPath;
+    QTest::newRow("relPath") << "testData" << m_dataPath + "/testData";
 #ifndef Q_OS_WIN
-    QTest::newRow("absPath") << appPath + "/testData" << appPath + "/testData";
+    QTest::newRow("absPath") << m_dataPath + "/testData" << m_dataPath + "/testData";
 #else
-    QTest::newRow("absPath") << appPath + "\\testData" << appPath + "/testData";
+    QTest::newRow("absPath") << m_dataPath + "\\testData" << m_dataPath + "/testData";
 #endif
     QTest::newRow("nonexistant") << "testd" << QString();
 
-    QTest::newRow("parent") << ".." << appPath.left(appPath.lastIndexOf('/'));
+    QTest::newRow("parent") << ".." << m_dataPath.left(m_dataPath.lastIndexOf('/'));
 }
 
 void tst_QDir::current()
 {
     QString oldDir = QDir::currentPath();
-    QString appPath = SRCDIR;
-    if (appPath.isEmpty())
-        appPath = QCoreApplication::instance()->applicationDirPath();
-    QDir::setCurrent(appPath);
+    QDir::setCurrent(m_dataPath);
     QFETCH(QString, path);
     QFETCH(QString, currentDir);
 
@@ -855,17 +841,16 @@ void tst_QDir::cd_data()
     QTest::addColumn<bool>("successExpected");
     QTest::addColumn<QString>("newDir");
 
-    QString appPath = QDir::currentPath();
-    int index = appPath.lastIndexOf("/");
-    QTest::newRow("cdUp") << QDir::currentPath() << ".." << true << appPath.left(index==0?1:index);
-    QTest::newRow("noChange") << QDir::currentPath() << "." << true << appPath;
+    int index = m_dataPath.lastIndexOf("/");
+    QTest::newRow("cdUp") << m_dataPath << ".." << true << m_dataPath.left(index==0?1:index);
+    QTest::newRow("noChange") << m_dataPath << "." << true << m_dataPath;
 #if defined(Q_OS_WIN)  // on windows QDir::root() is usually c:/ but cd "/" will not force it to be root
-    QTest::newRow("absolute") << QDir::currentPath() << "/" << true << "/";
+    QTest::newRow("absolute") << m_dataPath << "/" << true << "/";
 #else
-    QTest::newRow("absolute") << QDir::currentPath() << "/" << true << QDir::root().absolutePath();
+    QTest::newRow("absolute") << m_dataPath << "/" << true << QDir::root().absolutePath();
 #endif
-    QTest::newRow("non existant") << "." << "../anonexistingdir" << false << QDir::currentPath();
-    QTest::newRow("self") << "." << (QString("../") + QFileInfo(QDir::currentPath()).fileName()) << true << QDir::currentPath();
+    QTest::newRow("non existant") << "." << "../anonexistingdir" << false << m_dataPath;
+    QTest::newRow("self") << "." << (QString("../") + QFileInfo(m_dataPath).fileName()) << true << m_dataPath;
     QTest::newRow("file") << "." << "qdir.pro" << false << "";
 }
 
@@ -892,19 +877,13 @@ void tst_QDir::setNameFilters_data()
     QTest::addColumn<QStringList>("nameFilters");
     QTest::addColumn<QStringList>("expected");
 
-    QString appPath = SRCDIR;
-    if (appPath.isEmpty())
-        appPath = QCoreApplication::instance()->applicationDirPath();
-    if (!appPath.endsWith("/"))
-        appPath.append("/");
-
-    QTest::newRow("spaces1") << appPath + "testdir/spaces" << QStringList("*. bar")
+    QTest::newRow("spaces1") << m_dataPath + "/testdir/spaces" << QStringList("*. bar")
                           << QStringList("foo. bar");
-    QTest::newRow("spaces2") << appPath + "testdir/spaces" << QStringList("*.bar")
+    QTest::newRow("spaces2") << m_dataPath + "/testdir/spaces" << QStringList("*.bar")
                           << QStringList("foo.bar");
-    QTest::newRow("spaces3") << appPath + "testdir/spaces" << QStringList("foo.*")
+    QTest::newRow("spaces3") << m_dataPath + "/testdir/spaces" << QStringList("foo.*")
                             << QString("foo. bar,foo.bar").split(",");
-    QTest::newRow("files1")  << appPath + "testdir/dir" << QString("*r.cpp *.pro").split(" ")
+    QTest::newRow("files1")  << m_dataPath + "/testdir/dir" << QString("*r.cpp *.pro").split(" ")
                           << QString("qdir.pro,qrc_qdir.cpp,tst_qdir.cpp").split(",");
     QTest::newRow("resources1") << QString(":/tst_qdir/resources/entryList") << QStringList("*.data")
                              << QString("file1.data,file2.data,file3.data").split(',');
@@ -1170,8 +1149,7 @@ void tst_QDir::exists2()
     QFETCH(bool, exists);
 
     QString oldpwd = QDir::currentPath();
-    if (strlen(SRCDIR) > 0)
-        QDir::setCurrent(SRCDIR);
+    QDir::setCurrent((m_dataPath + "/."));
 
     if (path.isEmpty())
         QTest::ignoreMessage(QtWarningMsg, "QDir::exists: Empty or null file name");
@@ -1223,7 +1201,7 @@ void tst_QDir::dotAndDotDot()
 #if defined(Q_OS_WINCE)
     QSKIP("WinCE does not have . nor ..");
 #else
-    QDir dir(QString(SRCDIR "testdir/"));
+    QDir dir(QString((m_dataPath + "/testdir/")));
     QStringList entryList = dir.entryList(QDir::Dirs);
     QCOMPARE(entryList, QStringList() << QString(".") << QString("..") << QString("dir") << QString("spaces"));
     entryList = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
@@ -1309,26 +1287,22 @@ void tst_QDir::searchPaths_data()
     QTest::addColumn<QString>("searchPaths");
     QTest::addColumn<QString>("expectedAbsolutePath");
 
-    QString srcdir = SRCDIR;
-    if (srcdir.isEmpty())
-        srcdir = QDir::currentPath();
-    else
-        srcdir.chop(1);         // remove ending slash
-    QString searchDir = srcdir + "/searchdir";
+    QString searchDir = (m_dataPath + "/searchdir");
+    QString srcdir = QFileInfo(searchDir).absolutePath();
 
     // sanity
     QTest::newRow("nopath") << "picker.png" << QString() << QString() << QString();
     QTest::newRow("emptysearchpath") << "subdir1/picker.png" << QString() << QString() << QString();
-    QTest::newRow("searchpathwithoutprefix") << SRCDIR "searchdir/subdir1/picker.png" << QString("searchpath") << QString("searchdir") << (searchDir+"/subdir1/picker.png");
+    QTest::newRow("searchpathwithoutprefix") << (m_dataPath + "/searchdir/subdir1/picker.png") << QString("searchpath") << QString("searchdir") << (searchDir+"/subdir1/picker.png");
 
     // new
     QTest::newRow("novalidsearchpath") << "searchpath:subdir1/picker.png" << QString() << QString() << QString();
     QTest::newRow("invalidsearchpath") << "searchpath:subdir1/picker.png" << QString("invalid") << QString("invalid") << QString();
-    QTest::newRow("onlyvalidsearchpath") << "searchpath:subdir1/picker.png" << QString("searchpath") << QString(SRCDIR "searchdir") << (searchDir+"/subdir1/picker.png");
-    QTest::newRow("validandinvalidsearchpath") << "searchpath:subdir1/picker.png" << QString("invalid;searchpath") << QString("invalid;" SRCDIR "searchdir") << (searchDir+"/subdir1/picker.png");
-    QTest::newRow("precedence1") << "searchpath:picker.png" << QString("invalid;searchpath") << QString("invalid;" SRCDIR "searchdir/subdir1," SRCDIR "searchdir/subdir2") << (searchDir+"/subdir1/picker.png");
-    QTest::newRow("precedence2") << "searchpath:picker.png" << QString("invalid;searchpath") << QString("invalid;" SRCDIR "searchdir/subdir2," SRCDIR "searchdir/subdir1") << (searchDir+"/subdir2/picker.png");
-    QTest::newRow("precedence3") << "searchpath2:picker.png" << QString("searchpath1;searchpath2") << QString(SRCDIR "searchdir/subdir1;" SRCDIR "searchdir/subdir2") << (searchDir+"/subdir2/picker.png");
+    QTest::newRow("onlyvalidsearchpath") << "searchpath:subdir1/picker.png" << QString("searchpath") << QString((m_dataPath + "/searchdir")) << (searchDir+"/subdir1/picker.png");
+    QTest::newRow("validandinvalidsearchpath") << "searchpath:subdir1/picker.png" << QString("invalid;searchpath") << ("invalid;" + (m_dataPath + "/searchdir")) << (searchDir+"/subdir1/picker.png");
+    QTest::newRow("precedence1") << "searchpath:picker.png" << QString("invalid;searchpath") << ("invalid;" + (m_dataPath + "/searchdir/subdir1") + "," + (m_dataPath + "/searchdir/subdir2")) << (searchDir+"/subdir1/picker.png");
+    QTest::newRow("precedence2") << "searchpath:picker.png" << QString("invalid;searchpath") << ("invalid;" + (m_dataPath + "/searchdir/subdir2") + "," + (m_dataPath + "/searchdir/subdir1")) << (searchDir+"/subdir2/picker.png");
+    QTest::newRow("precedence3") << "searchpath2:picker.png" << QString("searchpath1;searchpath2") << ((m_dataPath + "/searchdir/subdir1") + ";" + (m_dataPath + "/searchdir/subdir2")) << (searchDir+"/subdir2/picker.png");
 
     // re
 }
@@ -1729,8 +1703,8 @@ void tst_QDir::drives()
 
 void tst_QDir::arrayOperator()
 {
-    QDir dir1(SRCDIR "entrylist/");
-    QDir dir2(SRCDIR "entrylist/");
+    QDir dir1((m_dataPath + "/entrylist/"));
+    QDir dir2((m_dataPath + "/entrylist/"));
 
     QStringList entries(dir1.entryList());
     int i = dir2.count();
@@ -1753,8 +1727,8 @@ void tst_QDir::equalityOperator_data()
     QTest::addColumn<int>("rightFilters");
     QTest::addColumn<bool>("expected");
 
-    QTest::newRow("same") << SRCDIR << "*.cpp" << int(QDir::Name) << int(QDir::Files)
-        << SRCDIR << "*.cpp" << int(QDir::Name) << int(QDir::Files)
+    QTest::newRow("same") << (m_dataPath + "/.") << "*.cpp" << int(QDir::Name) << int(QDir::Files)
+        << (m_dataPath + "/.") << "*.cpp" << int(QDir::Name) << int(QDir::Files)
         << true;
 
     QTest::newRow("relativepaths") << "entrylist/" << "*.cpp" << int(QDir::Name) << int(QDir::Files)
@@ -1789,16 +1763,16 @@ void tst_QDir::equalityOperator_data()
         << "another-dir-that-dont-exist" << "*.cpp" << int(QDir::Name) << int(QDir::Files)
         << false;
 
-    QTest::newRow("diff-filters") << SRCDIR << "*.cpp" << int(QDir::Name) << int(QDir::Files)
-        << SRCDIR << "*.cpp" << int(QDir::Name) << int(QDir::Dirs)
+    QTest::newRow("diff-filters") << (m_dataPath + "/.") << "*.cpp" << int(QDir::Name) << int(QDir::Files)
+        << m_dataPath << "*.cpp" << int(QDir::Name) << int(QDir::Dirs)
         << false;
 
-    QTest::newRow("diff-sort") << SRCDIR << "*.cpp" << int(QDir::Name) << int(QDir::Files)
-        << SRCDIR << "*.cpp" << int(QDir::Time) << int(QDir::Files)
+    QTest::newRow("diff-sort") << (m_dataPath + "/.") << "*.cpp" << int(QDir::Name) << int(QDir::Files)
+        << m_dataPath << "*.cpp" << int(QDir::Time) << int(QDir::Files)
         << false;
 
-    QTest::newRow("diff-namefilters") << SRCDIR << "*.cpp" << int(QDir::Name) << int(QDir::Files)
-        << SRCDIR << "*.jpg" << int(QDir::Name) << int(QDir::Files)
+    QTest::newRow("diff-namefilters") << (m_dataPath + "/.") << "*.cpp" << int(QDir::Name) << int(QDir::Files)
+        << m_dataPath << "*.jpg" << int(QDir::Name) << int(QDir::Files)
         << false;
 }
 
index b51a734..cfb3201 100644 (file)
@@ -4,4 +4,6 @@ QT = core testlib
 SOURCES = tst_qdiriterator.cpp
 RESOURCES += qdiriterator.qrc
 
+TESTDATA += entrylist
+
 wince*mips*|wincewm50smart-msvc200*: DEFINES += WINCE_BROKEN_ITERATE=1
index eef504b..e331d09 100644 (file)
@@ -66,10 +66,6 @@ class tst_QDirIterator : public QObject
 {
     Q_OBJECT
 
-public:
-    tst_QDirIterator();
-    virtual ~tst_QDirIterator();
-
 private: // convenience functions
     QStringList createdDirectories;
     QStringList createdFiles;
@@ -106,6 +102,8 @@ private: // convenience functions
     }
 
 private slots:
+    void initTestCase();
+    void cleanupTestCase();
     void iterateRelativeDirectory_data();
     void iterateRelativeDirectory();
     void iterateResource_data();
@@ -124,8 +122,12 @@ private slots:
     void hiddenDirs_hiddenFiles();
 };
 
-tst_QDirIterator::tst_QDirIterator()
+void tst_QDirIterator::initTestCase()
 {
+    // chdir into testdata directory, then find testdata by relative paths.
+    QString testdata_dir = QFileInfo(QFINDTESTDATA("entrylist")).absolutePath();
+    QVERIFY2(QDir::setCurrent(testdata_dir), qPrintable("Could not chdir to " + testdata_dir));
+
     QFile::remove("entrylist/entrylist1.lnk");
     QFile::remove("entrylist/entrylist2.lnk");
     QFile::remove("entrylist/entrylist3.lnk");
@@ -187,7 +189,7 @@ tst_QDirIterator::tst_QDirIterator()
 #endif
 }
 
-tst_QDirIterator::~tst_QDirIterator()
+void tst_QDirIterator::cleanupTestCase()
 {
     Q_FOREACH(QString fileName, createdFiles)
         QFile::remove(fileName);
index bf791ff..8e463e4 100644 (file)
@@ -3,4 +3,6 @@ QT = core
 CONFIG -= app_bundle debug_and_release_target
 CONFIG += console
 
-
+# This app is testdata for tst_qfile
+target.path = $$[QT_INSTALL_TESTS]/tst_qfile/$$TARGET
+INSTALLS += target
index aca034b..2f1e500 100644 (file)
@@ -1,24 +1,13 @@
 CONFIG += testcase
+QT = core network testlib
 TARGET = ../tst_qfile
 SOURCES = ../tst_qfile.cpp
 RESOURCES += ../qfile.qrc ../rename-fallback.qrc ../copy-fallback.qrc
 
-wince* {
-    QT = core gui testlib
-    files.files += ..\\dosfile.txt ..\\noendofline.txt ..\\testfile.txt \
-                     ..\\testlog.txt ..\\two.dots.file ..\\tst_qfile.cpp \
-                     ..\\Makefile ..\\forCopying.txt ..\\forRenaming.txt
-    files.path = .
-    resour.files += ..\\resources\\file1.ext1
-    resour.path = resources
-
-    DEPLOYMENT += files resour
-    SOURCES += $$QT_SOURCE_TREE/src/corelib/kernel/qfunctions_wince.cpp     # needed for QT_OPEN
-    DEFINES += SRCDIR=\\\"\\\"
-} else {
-    QT = core network testlib
-    DEFINES += SRCDIR=\\\"$$PWD/../\\\"
-}
+TESTDATA += ../dosfile.txt ../noendofline.txt ../testfile.txt \
+            ../testlog.txt ../two.dots.file ../tst_qfile.cpp \
+            ../Makefile ../forCopying.txt ../forRenaming.txt \
+            ../resources/file1.ext1
 
 win32 {
     CONFIG(debug, debug|release) {
index 2b71bb7..07f6b44 100644 (file)
@@ -348,6 +348,10 @@ void tst_QFile::cleanup()
 
 void tst_QFile::initTestCase()
 {
+    // chdir to testdata directory and use relative paths.
+    QString testdata_dir = QFileInfo(QFINDTESTDATA("testfile.txt")).absolutePath();
+    QVERIFY2(QDir::setCurrent(testdata_dir), qPrintable("Could not chdir to " + testdata_dir));
+
     QFile::remove("noreadfile");
 
     // create a file and make it read-only
@@ -404,7 +408,7 @@ void tst_QFile::cleanupTestCase()
 
 void tst_QFile::exists()
 {
-    QFile f( SRCDIR "testfile.txt" );
+    QFile f( QFINDTESTDATA("testfile.txt") );
     QCOMPARE( f.exists(), (bool)TRUE );
 
     QFile file("nobodyhassuchafile");
@@ -443,7 +447,7 @@ void tst_QFile::open_data()
     static const QString denied("Permission denied");
 #endif
     QTest::newRow( "exist_readOnly"  )
-        << QString(SRCDIR "testfile.txt") << int(QIODevice::ReadOnly)
+        << QString(QFINDTESTDATA("testfile.txt")) << int(QIODevice::ReadOnly)
         << (bool)TRUE << QFile::NoError;
 
     QTest::newRow( "exist_writeOnly" )
@@ -469,7 +473,7 @@ void tst_QFile::open_data()
     QTest::newRow("nullfile") << QString() << int(QIODevice::ReadOnly) << (bool)FALSE
         << QFile::OpenError;
 
-    QTest::newRow("two-dots") << QString(SRCDIR "two.dots.file") << int(QIODevice::ReadOnly) << (bool)TRUE
+    QTest::newRow("two-dots") << QString(QFINDTESTDATA("two.dots.file")) << int(QIODevice::ReadOnly) << (bool)TRUE
         << QFile::NoError;
 
     QTest::newRow("readonlyfile") << QString("readonlyfile") << int(QIODevice::WriteOnly)
@@ -512,7 +516,7 @@ void tst_QFile::open()
 
 void tst_QFile::openUnbuffered()
 {
-    QFile file(SRCDIR "testfile.txt");
+    QFile file(QFINDTESTDATA("testfile.txt"));
     QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Unbuffered));
     char c = '\0';
     QVERIFY(file.seek(1));
@@ -545,7 +549,7 @@ void tst_QFile::size_data()
     QTest::addColumn<QString>("filename");
     QTest::addColumn<qint64>("size");
 
-    QTest::newRow( "exist01" ) << QString(SRCDIR "testfile.txt") << (qint64)245;
+    QTest::newRow( "exist01" ) << QString(QFINDTESTDATA("testfile.txt")) << (qint64)245;
 #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
     // Only test UNC on Windows./
     QTest::newRow("unc") << "//" + QString(QtNetworkSettings::winServerName() + "/testshare/test.pri") << (qint64)34;
@@ -687,7 +691,7 @@ void tst_QFile::setSizeSeek()
 
 void tst_QFile::atEnd()
 {
-    QFile f( SRCDIR "testfile.txt" );
+    QFile f( QFINDTESTDATA("testfile.txt") );
     QVERIFY(f.open( QIODevice::ReadOnly ));
 
     int size = f.size();
@@ -700,7 +704,7 @@ void tst_QFile::atEnd()
 
 void tst_QFile::readLine()
 {
-    QFile f( SRCDIR "testfile.txt" );
+    QFile f( QFINDTESTDATA("testfile.txt") );
     QVERIFY(f.open( QIODevice::ReadOnly ));
 
     int i = 0;
@@ -720,7 +724,7 @@ void tst_QFile::readLine()
 
 void tst_QFile::readLine2()
 {
-    QFile f( SRCDIR "testfile.txt" );
+    QFile f( QFINDTESTDATA("testfile.txt") );
     f.open( QIODevice::ReadOnly );
 
     char p[128];
@@ -755,13 +759,13 @@ void tst_QFile::readAll_data()
 {
     QTest::addColumn<bool>("textMode");
     QTest::addColumn<QString>("fileName");
-    QTest::newRow( "TextMode unixfile" ) <<  true << SRCDIR "testfile.txt";
-    QTest::newRow( "BinaryMode unixfile" ) <<  false << SRCDIR "testfile.txt";
-    QTest::newRow( "TextMode dosfile" ) <<  true << SRCDIR "dosfile.txt";
-    QTest::newRow( "BinaryMode dosfile" ) <<  false << SRCDIR "dosfile.txt";
-    QTest::newRow( "TextMode bigfile" ) <<  true << SRCDIR "tst_qfile.cpp";
-    QTest::newRow( "BinaryMode  bigfile" ) <<  false << SRCDIR "tst_qfile.cpp";
-    QVERIFY(QFile(SRCDIR "tst_qfile.cpp").size() > 64*1024);
+    QTest::newRow( "TextMode unixfile" ) <<  true << QFINDTESTDATA("testfile.txt");
+    QTest::newRow( "BinaryMode unixfile" ) <<  false << QFINDTESTDATA("testfile.txt");
+    QTest::newRow( "TextMode dosfile" ) <<  true << QFINDTESTDATA("dosfile.txt");
+    QTest::newRow( "BinaryMode dosfile" ) <<  false << QFINDTESTDATA("dosfile.txt");
+    QTest::newRow( "TextMode bigfile" ) <<  true << QFINDTESTDATA("tst_qfile.cpp");
+    QTest::newRow( "BinaryMode  bigfile" ) <<  false << QFINDTESTDATA("tst_qfile.cpp");
+    QVERIFY(QFile(QFINDTESTDATA("tst_qfile.cpp")).size() > 64*1024);
 }
 
 void tst_QFile::readAll()
@@ -923,7 +927,7 @@ void tst_QFile::readLineStdin_lineByLine()
 void tst_QFile::text()
 {
     // dosfile.txt is a binary CRLF file
-    QFile file(SRCDIR "dosfile.txt");
+    QFile file(QFINDTESTDATA("dosfile.txt"));
     QVERIFY(file.open(QFile::Text | QFile::ReadOnly));
     QCOMPARE(file.readLine(),
             QByteArray("/dev/system/root     /                    reiserfs   acl,user_xattr        1 1\n"));
@@ -936,7 +940,7 @@ void tst_QFile::text()
 
 void tst_QFile::missingEndOfLine()
 {
-    QFile file(SRCDIR "noendofline.txt");
+    QFile file(QFINDTESTDATA("noendofline.txt"));
     QVERIFY(file.open(QFile::ReadOnly));
 
     int nlines = 0;
@@ -950,7 +954,7 @@ void tst_QFile::missingEndOfLine()
 
 void tst_QFile::readBlock()
 {
-    QFile f( SRCDIR "testfile.txt" );
+    QFile f( QFINDTESTDATA("testfile.txt") );
     f.open( QIODevice::ReadOnly );
 
     int length = 0;
@@ -965,7 +969,7 @@ void tst_QFile::readBlock()
 
 void tst_QFile::getch()
 {
-    QFile f( SRCDIR "testfile.txt" );
+    QFile f( QFINDTESTDATA("testfile.txt") );
     f.open( QIODevice::ReadOnly );
 
     char c;
@@ -982,7 +986,7 @@ void tst_QFile::getch()
 
 void tst_QFile::ungetChar()
 {
-    QFile f(SRCDIR "testfile.txt");
+    QFile f(QFINDTESTDATA("testfile.txt"));
     QVERIFY(f.open(QIODevice::ReadOnly));
 
     QByteArray array = f.readLine();
@@ -1083,7 +1087,7 @@ void tst_QFile::permissions_data()
     QTest::addColumn<bool>("expected");
 
     QTest::newRow("data0") << QCoreApplication::instance()->applicationFilePath() << uint(QFile::ExeUser) << true;
-    QTest::newRow("data1") << SRCDIR "tst_qfile.cpp" << uint(QFile::ReadUser) << true;
+    QTest::newRow("data1") << QFINDTESTDATA("tst_qfile.cpp") << uint(QFile::ReadUser) << true;
     QTest::newRow("resource1") << ":/tst_qfileinfo/resources/file1.ext1" << uint(QFile::ReadUser) << true;
     QTest::newRow("resource2") << ":/tst_qfileinfo/resources/file1.ext1" << uint(QFile::WriteUser) << false;
     QTest::newRow("resource3") << ":/tst_qfileinfo/resources/file1.ext1" << uint(QFile::ExeUser) << false;
@@ -1121,8 +1125,8 @@ void tst_QFile::copy()
     QFile::setPermissions("tst_qfile_copy.cpp", QFile::WriteUser);
     QFile::remove("tst_qfile_copy.cpp");
     QFile::remove("test2");
-    QVERIFY(QFile::copy(SRCDIR "tst_qfile.cpp", "tst_qfile_copy.cpp"));
-    QFile in1(SRCDIR "tst_qfile.cpp"), in2("tst_qfile_copy.cpp");
+    QVERIFY(QFile::copy(QFINDTESTDATA("tst_qfile.cpp"), "tst_qfile_copy.cpp"));
+    QFile in1(QFINDTESTDATA("tst_qfile.cpp")), in2("tst_qfile_copy.cpp");
     QVERIFY(in1.open(QFile::ReadOnly));
     QVERIFY(in2.open(QFile::ReadOnly));
     QByteArray data1 = in1.readAll(), data2 = in2.readAll();
@@ -1169,9 +1173,9 @@ void tst_QFile::copyAfterFail()
 void tst_QFile::copyRemovesTemporaryFile() const
 {
     const QString newName(QLatin1String("copyRemovesTemporaryFile"));
-    QVERIFY(QFile::copy(SRCDIR "forCopying.txt", newName));
+    QVERIFY(QFile::copy(QFINDTESTDATA("forCopying.txt"), newName));
 
-    QVERIFY(!QFile::exists(QLatin1String( SRCDIR "qt_temp.XXXXXX")));
+    QVERIFY(!QFile::exists(QFINDTESTDATA("qt_temp.XXXXXX")));
     QVERIFY(QFile::remove(newName));
 }
 
@@ -1179,7 +1183,7 @@ void tst_QFile::copyShouldntOverwrite()
 {
     // Copy should not overwrite existing files.
     QFile::remove("tst_qfile.cpy");
-    QFile file(SRCDIR "tst_qfile.cpp");
+    QFile file(QFINDTESTDATA("tst_qfile.cpp"));
     QVERIFY(file.copy("tst_qfile.cpy"));
 
     bool ok = QFile::setPermissions("tst_qfile.cpy", QFile::WriteOther);
@@ -1271,10 +1275,10 @@ void tst_QFile::link()
 {
     QFile::remove("myLink.lnk");
 
-    QFileInfo info1(SRCDIR "tst_qfile.cpp");
+    QFileInfo info1(QFINDTESTDATA("tst_qfile.cpp"));
     QString referenceTarget = QDir::cleanPath(info1.absoluteFilePath());
 
-    QVERIFY(QFile::link(SRCDIR "tst_qfile.cpp", "myLink.lnk"));
+    QVERIFY(QFile::link(QFINDTESTDATA("tst_qfile.cpp"), "myLink.lnk"));
 
     QFileInfo info2("myLink.lnk");
     QVERIFY(info2.isSymLink());
@@ -1386,13 +1390,13 @@ void tst_QFile::readTextFile()
 void tst_QFile::readTextFile2()
 {
     {
-        QFile file(SRCDIR "testlog.txt");
+        QFile file(QFINDTESTDATA("testlog.txt"));
         QVERIFY(file.open(QIODevice::ReadOnly));
         file.read(4097);
     }
 
     {
-        QFile file(SRCDIR "testlog.txt");
+        QFile file(QFINDTESTDATA("testlog.txt"));
         QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Text));
         file.read(4097);
     }
@@ -2015,7 +2019,7 @@ public:
     {
         if (fileName.startsWith(":!")) {
             QDir dir;
-            QString realFile = SRCDIR + fileName.mid(2);
+            QString realFile = QFINDTESTDATA(fileName.mid(2));
             if (dir.exists(realFile))
                 return new QFSFileEngine(realFile);
         }
@@ -2379,7 +2383,7 @@ void tst_QFile::renameWithAtEndSpecialFile() const
     /* Cleanup, so we're a bit more robust. */
     QFile::remove(newName);
 
-    const QString originalName(QString(SRCDIR "forRenaming.txt"));
+    const QString originalName(QString(QFINDTESTDATA("forRenaming.txt")));
 
     PeculiarAtEnd file;
     file.setFileName(originalName);
@@ -2502,7 +2506,7 @@ void tst_QFile::handle()
 {
     int fd;
 #if !defined(Q_OS_WINCE)
-    QFile file(SRCDIR "tst_qfile.cpp");
+    QFile file(QFINDTESTDATA("tst_qfile.cpp"));
     QVERIFY(file.open(QIODevice::ReadOnly));
     fd = int(file.handle());
     QVERIFY(fd > 2);
@@ -2533,7 +2537,7 @@ void tst_QFile::handle()
 
     //test round trip of adopted stdio file handle
     QFile file2;
-    FILE *fp = fopen(SRCDIR "tst_qfile.cpp", "r");
+    FILE *fp = fopen(qPrintable(QFINDTESTDATA("tst_qfile.cpp")), "r");
     file2.open(fp, QIODevice::ReadOnly);
     QCOMPARE(int(file2.handle()), int(fileno(fp)));
     QCOMPARE(int(file2.handle()), int(fileno(fp)));
@@ -2542,7 +2546,7 @@ void tst_QFile::handle()
     //test round trip of adopted posix file handle
 #ifdef Q_OS_UNIX
     QFile file3;
-    fd = QT_OPEN(SRCDIR "tst_qfile.cpp", QT_OPEN_RDONLY);
+    fd = QT_OPEN(qPrintable(QFINDTESTDATA("tst_qfile.cpp")), QT_OPEN_RDONLY);
     file3.open(fd, QIODevice::ReadOnly);
     QCOMPARE(int(file3.handle()), fd);
     QT_CLOSE(fd);
@@ -2599,8 +2603,8 @@ void tst_QFile::readEof_data()
     QTest::addColumn<QString>("filename");
     QTest::addColumn<int>("imode");
 
-    QTest::newRow("buffered") << SRCDIR "testfile.txt" << 0;
-    QTest::newRow("unbuffered") << SRCDIR "testfile.txt" << int(QIODevice::Unbuffered);
+    QTest::newRow("buffered") << QFINDTESTDATA("testfile.txt") << 0;
+    QTest::newRow("unbuffered") << QFINDTESTDATA("testfile.txt") << int(QIODevice::Unbuffered);
 
 #if defined(Q_OS_UNIX)
     QTest::newRow("sequential,buffered") << "/dev/null" << 0;
@@ -2945,7 +2949,7 @@ void tst_QFile::mapOpenMode()
 
 void tst_QFile::openDirectory()
 {
-    QFile f1(SRCDIR "resources");
+    QFile f1(QFINDTESTDATA("resources"));
     // it's a directory, it must exist
     QVERIFY(f1.exists());
 
@@ -3070,7 +3074,7 @@ void tst_QFile::resize()
 void tst_QFile::objectConstructors()
 {
     QObject ob;
-    QFile* file1 = new QFile(SRCDIR "testfile.txt", &ob);
+    QFile* file1 = new QFile(QFINDTESTDATA("testfile.txt"), &ob);
     QFile* file2 = new QFile(&ob);
     QVERIFY(file1->exists());
     QVERIFY(!file2->exists());
index 2f3fa3f..4f00d34 100644 (file)
@@ -4,14 +4,6 @@ QT = core-private testlib
 SOURCES = tst_qfileinfo.cpp
 RESOURCES += qfileinfo.qrc
 
-wince* {
-    deploy.files += qfileinfo.qrc tst_qfileinfo.cpp
-    res.files = resources\\file1 resources\\file1.ext1 resources\\file1.ext1.ext2
-    res.path = resources
-    DEPLOYMENT += deploy res
-    DEFINES += SRCDIR=\\\"\\\"
-} else {
-    DEFINES += SRCDIR=\\\"$$PWD/\\\"
-}
+TESTDATA += qfileinfo.qrc qfileinfo.pro tst_qfileinfo.cpp resources/file1 resources/file1.ext1 resources/file1.ext1.ext2
 
 win32*:LIBS += -ladvapi32 -lnetapi32
index d5de61f..81b4c1b 100644 (file)
@@ -286,7 +286,7 @@ void tst_QFileInfo::isFile_data()
     QTest::addColumn<bool>("expected");
 
     QTest::newRow("data0") << QDir::currentPath() << false;
-    QTest::newRow("data1") << SRCDIR "tst_qfileinfo.cpp" << true;
+    QTest::newRow("data1") << QFINDTESTDATA("tst_qfileinfo.cpp") << true;
     QTest::newRow("data2") << ":/tst_qfileinfo/resources/" << false;
     QTest::newRow("data3") << ":/tst_qfileinfo/resources/file1" << true;
     QTest::newRow("data4") << ":/tst_qfileinfo/resources/afilethatshouldnotexist" << false;
@@ -319,13 +319,13 @@ void tst_QFileInfo::isDir_data()
     QTest::addColumn<bool>("expected");
 
     QTest::newRow("data0") << QDir::currentPath() << true;
-    QTest::newRow("data1") << SRCDIR "tst_qfileinfo.cpp" << false;
+    QTest::newRow("data1") << QFINDTESTDATA("tst_qfileinfo.cpp") << false;
     QTest::newRow("data2") << ":/tst_qfileinfo/resources/" << true;
     QTest::newRow("data3") << ":/tst_qfileinfo/resources/file1" << false;
     QTest::newRow("data4") << ":/tst_qfileinfo/resources/afilethatshouldnotexist" << false;
 
-    QTest::newRow("simple dir") << SRCDIR "resources" << true;
-    QTest::newRow("simple dir with slash") << SRCDIR "resources/" << true;
+    QTest::newRow("simple dir") << QFINDTESTDATA("resources") << true;
+    QTest::newRow("simple dir with slash") << QFINDTESTDATA("resources/") << true;
 
     QTest::newRow("broken link") << "brokenlink.lnk" << false;
 
@@ -365,8 +365,8 @@ void tst_QFileInfo::isRoot_data()
     QTest::newRow("data4") << ":/tst_qfileinfo/resources/" << false;
     QTest::newRow("data5") << ":/" << true;
 
-    QTest::newRow("simple dir") << SRCDIR "resources" << false;
-    QTest::newRow("simple dir with slash") << SRCDIR "resources/" << false;
+    QTest::newRow("simple dir") << QFINDTESTDATA("resources") << false;
+    QTest::newRow("simple dir with slash") << QFINDTESTDATA("resources/") << false;
 #if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE))
     QTest::newRow("drive 1") << "c:" << false;
     QTest::newRow("drive 2") << "c:/" << true;
@@ -397,21 +397,21 @@ void tst_QFileInfo::exists_data()
     QTest::addColumn<bool>("expected");
 
     QTest::newRow("data0") << QDir::currentPath() << true;
-    QTest::newRow("data1") << SRCDIR "tst_qfileinfo.cpp" << true;
+    QTest::newRow("data1") << QFINDTESTDATA("tst_qfileinfo.cpp") << true;
     QTest::newRow("data2") << "/I/do_not_expect_this_path_to_exist/" << false;
     QTest::newRow("data3") << ":/tst_qfileinfo/resources/" << true;
     QTest::newRow("data4") << ":/tst_qfileinfo/resources/file1" << true;
     QTest::newRow("data5") << ":/I/do_not_expect_this_path_to_exist/" << false;
-    QTest::newRow("data6") << SRCDIR "resources/*" << false;
-    QTest::newRow("data7") << SRCDIR "resources/*.foo" << false;
-    QTest::newRow("data8") << SRCDIR "resources/*.ext1" << false;
-    QTest::newRow("data9") << SRCDIR "resources/file?.ext1" << false;
+    QTest::newRow("data6") << (QFINDTESTDATA("resources/") + "*") << false;
+    QTest::newRow("data7") << (QFINDTESTDATA("resources/") + "*.foo") << false;
+    QTest::newRow("data8") << (QFINDTESTDATA("resources/") + "*.ext1") << false;
+    QTest::newRow("data9") << (QFINDTESTDATA("resources/") + "file?.ext1") << false;
     QTest::newRow("data10") << "." << true;
     QTest::newRow("data11") << ". " << false;
     QTest::newRow("empty") << "" << false;
 
-    QTest::newRow("simple dir") << SRCDIR "resources" << true;
-    QTest::newRow("simple dir with slash") << SRCDIR "resources/" << true;
+    QTest::newRow("simple dir") << QFINDTESTDATA("resources") << true;
+    QTest::newRow("simple dir with slash") << QFINDTESTDATA("resources/") << true;
 
 #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
     QTest::newRow("unc 1") << "//"  + QtNetworkSettings::winServerName() << true;
@@ -557,7 +557,7 @@ void tst_QFileInfo::canonicalFilePath()
     // test symlinks
     QFile::remove("link.lnk");
     {
-        QFile file(SRCDIR "tst_qfileinfo.cpp");
+        QFile file(QFINDTESTDATA("tst_qfileinfo.cpp"));
         if (file.link("link.lnk")) {
             QFileInfo info1(file);
             QFileInfo info2("link.lnk");
@@ -583,7 +583,7 @@ void tst_QFileInfo::canonicalFilePath()
             QCOMPARE(info1.canonicalFilePath(), info2.canonicalFilePath());
 
             QFileInfo info3(link + QDir::separator() + "link.lnk");
-            QFileInfo info4(SRCDIR "tst_qfileinfo.cpp");
+            QFileInfo info4(QFINDTESTDATA("tst_qfileinfo.cpp"));
             QVERIFY(!info3.canonicalFilePath().isEmpty());
             QCOMPARE(info4.canonicalFilePath(), info3.canonicalFilePath());
 
@@ -830,7 +830,7 @@ void tst_QFileInfo::permission_data()
     QTest::addColumn<bool>("expected");
 
     QTest::newRow("data0") << QCoreApplication::instance()->applicationFilePath() << int(QFile::ExeUser) << true;
-    QTest::newRow("data1") << SRCDIR "tst_qfileinfo.cpp" << int(QFile::ReadUser) << true;
+    QTest::newRow("data1") << QFINDTESTDATA("tst_qfileinfo.cpp") << int(QFile::ReadUser) << true;
     QTest::newRow("resource1") << ":/tst_qfileinfo/resources/file1.ext1" << int(QFile::ReadUser) << true;
     QTest::newRow("resource2") << ":/tst_qfileinfo/resources/file1.ext1" << int(QFile::WriteUser) << false;
     QTest::newRow("resource3") << ":/tst_qfileinfo/resources/file1.ext1" << int(QFile::ExeUser) << false;
@@ -898,11 +898,11 @@ void tst_QFileInfo::compare_data()
 #endif
 
     QTest::newRow("data0")
-        << QString::fromLatin1(SRCDIR "tst_qfileinfo.cpp")
-        << QString::fromLatin1(SRCDIR "tst_qfileinfo.cpp")
+        << QFINDTESTDATA("tst_qfileinfo.cpp")
+        << QFINDTESTDATA("tst_qfileinfo.cpp")
         << true;
     QTest::newRow("data1")
-        << QString::fromLatin1(SRCDIR "tst_qfileinfo.cpp")
+        << QFINDTESTDATA("tst_qfileinfo.cpp")
         << QString::fromLatin1("/tst_qfileinfo.cpp")
         << false;
     QTest::newRow("data2")
@@ -910,8 +910,8 @@ void tst_QFileInfo::compare_data()
         << QDir::currentPath() + QString::fromLatin1("/tst_qfileinfo.cpp")
         << true;
     QTest::newRow("casesense1")
-        << QString::fromLatin1(SRCDIR "tst_qfileInfo.cpp")
-        << QString::fromLatin1(SRCDIR "tst_qfileinfo.cpp")
+        << QFINDTESTDATA("tst_qfileinfo.cpp").replace("info", "Info")
+        << QFINDTESTDATA("tst_qfileinfo.cpp")
 #if defined(Q_OS_WIN)
         << true;
 #elif defined(Q_OS_MAC)
@@ -1098,7 +1098,7 @@ void tst_QFileInfo::isSymLink_data()
     QFile::remove("brokenlink.lnk");
     QFile::remove("dummyfile");
 
-    QFile file1(SRCDIR "tst_qfileinfo.cpp");
+    QFile file1(QFINDTESTDATA("tst_qfileinfo.cpp"));
     QVERIFY(file1.link("link.lnk"));
 
     QFile file2("dummyfile");
@@ -1110,8 +1110,8 @@ void tst_QFileInfo::isSymLink_data()
     QTest::addColumn<bool>("isSymLink");
     QTest::addColumn<QString>("linkTarget");
 
-    QTest::newRow("existent file") << SRCDIR "tst_qfileinfo.cpp" << false << "";
-    QTest::newRow("link") << "link.lnk" << true << QFileInfo(SRCDIR "tst_qfileinfo.cpp").absoluteFilePath();
+    QTest::newRow("existent file") << QFINDTESTDATA("tst_qfileinfo.cpp") << false << "";
+    QTest::newRow("link") << "link.lnk" << true << QFileInfo(QFINDTESTDATA("tst_qfileinfo.cpp")).absoluteFilePath();
     QTest::newRow("broken link") << "brokenlink.lnk" << true << QFileInfo("dummyfile").absoluteFilePath();
 }
 
@@ -1347,7 +1347,7 @@ void tst_QFileInfo::ntfsJunctionPointsAndSymlinks_data()
     }
     {
         //File symlinks
-        QFileInfo target(SRCDIR "tst_qfileinfo.cpp");
+        QFileInfo target(QFINDTESTDATA("tst_qfileinfo.cpp"));
         QString absTarget = QDir::toNativeSeparators(target.absoluteFilePath());
         QString absSymlink = QDir::toNativeSeparators(pwd.absolutePath()).append("\\abs_symlink.cpp");
         QString relTarget = QDir::toNativeSeparators(pwd.relativeFilePath(target.absoluteFilePath()));
@@ -1462,7 +1462,7 @@ void tst_QFileInfo::isExecutable()
     QFileInfo fi(appPath);
     QCOMPARE(fi.isExecutable(), true);
 
-    QCOMPARE(QFileInfo(SRCDIR "qfileinfo.pro").isExecutable(), false);
+    QCOMPARE(QFileInfo(QFINDTESTDATA("qfileinfo.pro")).isExecutable(), false);
 
 #ifdef Q_OS_UNIX
     QFile::remove("link.lnk");
@@ -1474,7 +1474,7 @@ void tst_QFileInfo::isExecutable()
     QFile::remove("link.lnk");
 
     // Symlink to .pro file
-    QFile proFile(SRCDIR "qfileinfo.pro");
+    QFile proFile(QFINDTESTDATA("qfileinfo.pro"));
     QVERIFY(proFile.link("link.lnk"));
     QCOMPARE(QFileInfo("link.lnk").isExecutable(), false);
     QFile::remove("link.lnk");
index 2a90ca1..a8295ec 100644 (file)
@@ -3,15 +3,7 @@ TARGET = tst_qiodevice
 QT = core network testlib
 SOURCES = tst_qiodevice.cpp
 
-wince* {
-    addFiles.files = tst_qiodevice.cpp
-    addFiles.path = .
-    DEPLOYMENT += addFiles
-    DEFINES += SRCDIR=\\\"\\\"
-    !wince50standard-x86-msvc2005: DEFINES += WINCE_EMULATOR_TEST=1
-} else {
-    DEFINES += SRCDIR=\\\"$$PWD/\\\"
-}
+TESTDATA += tst_qiodevice.cpp
 MOC_DIR=tmp
 
 mac: CONFIG += insignificant_test # QTBUG-22766
index 02a04a5..c3d4e54 100644 (file)
@@ -147,7 +147,7 @@ void tst_QIODevice::constructing_QFile()
 
     QVERIFY(!device->isOpen());
 
-    file.setFileName(SRCDIR "tst_qiodevice.cpp");
+    file.setFileName(QFINDTESTDATA("tst_qiodevice.cpp"));
     QVERIFY(file.open(QFile::ReadOnly));
     QVERIFY(device->isOpen());
     QCOMPARE((int) device->openMode(), (int) QFile::ReadOnly);
@@ -176,7 +176,7 @@ void tst_QIODevice::constructing_QFile()
 
 void tst_QIODevice::read_QByteArray()
 {
-    QFile f(SRCDIR "tst_qiodevice.cpp");
+    QFile f(QFINDTESTDATA("tst_qiodevice.cpp"));
     f.open(QIODevice::ReadOnly);
 
     QByteArray b = f.read(10);
index c9f87ba..360981f 100644 (file)
@@ -4,7 +4,6 @@ CONFIG -= app_bundle
 QT = core
 DESTDIR = ./
 
-# no install rule for application used by test
-INSTALLS =
-
-
+# This app is testdata for tst_qprocess
+target.path = $$[QT_INSTALL_TESTS]/tst_qprocess/$$TARGET
+INSTALLS += target
index bb21f76..39ce734 100644 (file)
@@ -3,92 +3,13 @@ QT = core testlib network
 embedded: QT += gui
 SOURCES = ../tst_qprocess.cpp
 
-!wince*: {
-    TARGET = ../tst_qprocess
-    win32: {
-        CONFIG(debug, debug|release) {
-            TARGET = ../../debug/tst_qprocess
-        } else {
-            TARGET = ../../release/tst_qprocess
-        }
+TARGET = ../tst_qprocess
+win32 {
+    CONFIG(debug, debug|release) {
+        TARGET = ../../debug/tst_qprocess
+    } else {
+        TARGET = ../../release/tst_qprocess
     }
-} else {
-    TARGET = tst_qprocess
-    addFile_fileWriterProcess.files = $$OUT_PWD/../fileWriterProcess/fileWriterProcess.exe
-    addFile_fileWriterProcess.path = fileWriterProcess
-
-    addFile_testBatFiles.files = $$PWD/../testBatFiles/*
-    addFile_testBatFiles.path = testBatFiles
-
-    addFile_testDetached.files = $$OUT_PWD/../testDetached/testDetached.exe
-    addFile_testDetached.path = testDetached
-
-    addFile_testExitCodes.files = $$OUT_PWD/../testExitCodes/testExitCodes.exe
-    addFile_testExitCodes.path = testExitCodes
-
-    addFile_testGuiProcess.files = $$OUT_PWD/../testGuiProcess/testGuiProcess.exe
-    addFile_testGuiProcess.path = testGuiProcess
-
-    addFile_testProcessCrash.files = $$OUT_PWD/../testProcessCrash/testProcessCrash.exe
-    addFile_testProcessCrash.path = testProcessCrash
-
-    addFile_testProcessDeadWhileReading.files = $$OUT_PWD/../testProcessDeadWhileReading/testProcessDeadWhileReading.exe
-    addFile_testProcessDeadWhileReading.path = testProcessDeadWhileReading
-
-    addFile_testProcessEcho.files = $$OUT_PWD/../testProcessEcho/testProcessEcho.exe
-    addFile_testProcessEcho.path = testProcessEcho
-
-    addFile_testProcessEcho2.files = $$OUT_PWD/../testProcessEcho2/testProcessEcho2.exe
-    addFile_testProcessEcho2.path = testProcessEcho2
-
-    addFile_testProcessEcho3.files = $$OUT_PWD/../testProcessEcho3/testProcessEcho3.exe
-    addFile_testProcessEcho3.path = testProcessEcho3
-
-    addFile_testProcessEOF.files = $$OUT_PWD/../testProcessEOF/testProcessEOF.exe
-    addFile_testProcessEOF.path = testProcessEOF
-
-    addFile_testProcessLoopback.files = $$OUT_PWD/../testProcessLoopback/testProcessLoopback.exe
-    addFile_testProcessLoopback.path = testProcessLoopback
-
-    addFile_testProcessNormal.files = $$OUT_PWD/../testProcessNormal/testProcessNormal.exe
-    addFile_testProcessNormal.path = testProcessNormal
-
-    addFile_testProcessOutput.files = $$OUT_PWD/../testProcessOutput/testProcessOutput.exe
-    addFile_testProcessOutput.path = testProcessOutput
-
-    addFile_testProcessNoSpacesArgs.files = $$OUT_PWD/../testProcessSpacesArgs/nospace.exe
-    addFile_testProcessNoSpacesArgs.path = testProcessSpacesArgs
-
-    addFile_testProcessOneSpacesArgs.files = $$OUT_PWD/../testProcessSpacesArgs/"one space".exe
-    addFile_testProcessOneSpacesArgs.path = testProcessSpacesArgs
-
-    addFile_testProcessTwoSpacesArgs.files = $$OUT_PWD/../testProcessSpacesArgs/"two space s".exe
-    addFile_testProcessTwoSpacesArgs.path = testProcessSpacesArgs
-
-    addFile_testSoftExit.files = $$OUT_PWD/../testSoftExit/testSoftExit.exe
-    addFile_testSoftExit.path = testSoftExit
-
-    addFile_testSpaceInName.files = $$OUT_PWD/../"test Space In Name"/testSpaceInName.exe
-    addFile_testSpaceInName.path = "test Space In Name"
-
-    DEPLOYMENT += addFile_fileWriterProcess \
-                  addFile_testBatFiles \
-                  addFile_testDetached \
-                  addFile_testExitCodes  \
-                  addFile_testGuiProcess \
-                  addFile_testProcessCrash \
-                  addFile_testProcessDeadWhileReading \
-                  addFile_testProcessEcho \
-                  addFile_testProcessEcho2 \
-                  addFile_testProcessEcho3 \
-                  addFile_testProcessEchoGui \
-                  addFile_testProcessEOF \
-                  addFile_testProcessLoopback \
-                  addFile_testProcessNormal \
-                  addFile_testProcessOutput \
-                  addFile_testProcessNoSpacesArgs \
-                  addFile_testProcessOneSpacesArgs \
-                  addFile_testProcessTwoSpacesArgs \
-                  addFile_testSoftExit \
-                  addFile_testSpaceInName
 }
+
+TESTDATA += ../testBatFiles/*
index 8d1fcba..e307379 100644 (file)
@@ -4,3 +4,7 @@ CONFIG += console
 CONFIG -= app_bundle
 INSTALLS =
 DESTDIR = ./
+
+# This app is testdata for tst_qprocess
+target.path = $$[QT_INSTALL_TESTS]/tst_qprocess/$$TARGET
+INSTALLS += target
index b083718..afa8e4c 100644 (file)
@@ -3,3 +3,7 @@ CONFIG -= qt app_bundle
 CONFIG += console
 
 DESTDIR = ./
+
+# This app is testdata for tst_qprocess
+target.path = $$[QT_INSTALL_TESTS]/tst_qprocess/$$TARGET
+INSTALLS += target
index b26a583..992188b 100644 (file)
@@ -3,3 +3,6 @@ QT += widgets
 CONFIG += console
 DESTDIR = ./
 
+# This app is testdata for tst_qprocess
+target.path = $$[QT_INSTALL_TESTS]/tst_qprocess/$$TARGET
+INSTALLS += target
index abd8167..98c5b96 100644 (file)
@@ -4,5 +4,6 @@ CONFIG -= qt app_bundle
 
 DESTDIR = ./
 
-# no install rule for application used by test
-INSTALLS =
+# This app is testdata for tst_qprocess
+target.path = $$[QT_INSTALL_TESTS]/tst_qprocess/$$TARGET
+INSTALLS += target
index 2168ba5..a5f4697 100644 (file)
@@ -4,7 +4,6 @@ CONFIG += console
 
 DESTDIR = ./
 
-# no install rule for application used by test
-INSTALLS =
-
-
+# This app is testdata for tst_qprocess
+target.path = $$[QT_INSTALL_TESTS]/tst_qprocess/$$TARGET
+INSTALLS += target
index 756bd23..4efdad9 100644 (file)
@@ -5,5 +5,6 @@ CONFIG += console
 win32:!win32-g++*:!equals(TEMPLATE_PREFIX, "vc"):QMAKE_CXXFLAGS += /GS-
 DESTDIR = ./
 
-
-
+# This app is testdata for tst_qprocess
+target.path = $$[QT_INSTALL_TESTS]/tst_qprocess/$$TARGET
+INSTALLS += target
index a14c1fe..f8dc695 100644 (file)
@@ -3,6 +3,6 @@ CONFIG -= qt
 CONFIG += console
 DESTDIR = ./
 
-# no install rule for application used by test
-INSTALLS =
-
+# This app is testdata for tst_qprocess
+target.path = $$[QT_INSTALL_TESTS]/tst_qprocess/$$TARGET
+INSTALLS += target
index d8a303a..f8dc695 100644 (file)
@@ -3,8 +3,6 @@ CONFIG -= qt
 CONFIG += console
 DESTDIR = ./
 
-# no install rule for application used by test
-INSTALLS =
-
-
-
+# This app is testdata for tst_qprocess
+target.path = $$[QT_INSTALL_TESTS]/tst_qprocess/$$TARGET
+INSTALLS += target
index 3b8f2fb..f8dc695 100644 (file)
@@ -3,7 +3,6 @@ CONFIG -= qt
 CONFIG += console
 DESTDIR = ./
 
-# no install rule for application used by test
-INSTALLS =
-
-
+# This app is testdata for tst_qprocess
+target.path = $$[QT_INSTALL_TESTS]/tst_qprocess/$$TARGET
+INSTALLS += target
index b3be74c..65b408f 100644 (file)
@@ -6,8 +6,6 @@ win32 {
 CONFIG -= qt
 DESTDIR = ./
 
-# no install rule for application used by test
-INSTALLS =
-
-
-
+# This app is testdata for tst_qprocess
+target.path = $$[QT_INSTALL_TESTS]/tst_qprocess/$$TARGET
+INSTALLS += target
index 14ddae5..43378b6 100644 (file)
@@ -7,6 +7,6 @@ mac {
   CONFIG -= app_bundle
 }
 
-# no install rule for application used by test
-INSTALLS =
-
+# This app is testdata for tst_qprocess
+target.path = $$[QT_INSTALL_TESTS]/tst_qprocess/$$TARGET
+INSTALLS += target
index a14c1fe..f8dc695 100644 (file)
@@ -3,6 +3,6 @@ CONFIG -= qt
 CONFIG += console
 DESTDIR = ./
 
-# no install rule for application used by test
-INSTALLS =
-
+# This app is testdata for tst_qprocess
+target.path = $$[QT_INSTALL_TESTS]/tst_qprocess/$$TARGET
+INSTALLS += target
index 3c6a595..98c5b96 100644 (file)
@@ -4,6 +4,6 @@ CONFIG -= qt app_bundle
 
 DESTDIR = ./
 
-# no install rule for application used by test
-INSTALLS =
-
+# This app is testdata for tst_qprocess
+target.path = $$[QT_INSTALL_TESTS]/tst_qprocess/$$TARGET
+INSTALLS += target
index 3b8f2fb..f8dc695 100644 (file)
@@ -3,7 +3,6 @@ CONFIG -= qt
 CONFIG += console
 DESTDIR = ./
 
-# no install rule for application used by test
-INSTALLS =
-
-
+# This app is testdata for tst_qprocess
+target.path = $$[QT_INSTALL_TESTS]/tst_qprocess/$$TARGET
+INSTALLS += target
index f55f02e..93d0afb 100644 (file)
@@ -3,7 +3,6 @@ CONFIG -= qt app_bundle
 CONFIG += console
 DESTDIR = ./
 
-# no install rule for application used by test
-INSTALLS =
-
-
+# This app is testdata for tst_qproces
+target.path = $$[QT_INSTALL_TESTS]/tst_qprocess/testProcessSpacesArgs
+INSTALLS += target
index 2a56a95..f53e579 100644 (file)
@@ -3,9 +3,8 @@ CONFIG -= qt app_bundle
 CONFIG += console
 DESTDIR = ./
 
-TARGET = "one space"
-
-# no install rule for application used by test
-INSTALLS =
-
+TARGET = one space
 
+# This app is testdata for tst_qprocess
+target.path = $$[QT_INSTALL_TESTS]/tst_qprocess/testProcessSpacesArgs
+INSTALLS += target
index d7c74a6..a4ee0cf 100644 (file)
@@ -3,10 +3,8 @@ CONFIG -= qt app_bundle
 CONFIG += console
 DESTDIR = ./
 
-TARGET = "two space s"
-
-# no install rule for application used by test
-INSTALLS =
-
-
+TARGET = two space s
 
+# This app is testdata for tst_qprocess
+target.path = $$[QT_INSTALL_TESTS]/tst_qprocess/testProcessSpacesArgs
+INSTALLS += target
index b723604..d6cc96b 100644 (file)
@@ -2,6 +2,6 @@ SOURCES = main.cpp
 CONFIG += console
 DESTDIR = ./
 
-# no install rule for application used by test
-INSTALLS =
-
+# This app is testdata for tst_qprocess
+target.path = $$[QT_INSTALL_TESTS]/tst_qprocess/$$TARGET
+INSTALLS += target
index 9220359..5d4ec4f 100644 (file)
@@ -10,7 +10,6 @@ CONFIG -= qt app_bundle
 CONFIG += console
 DESTDIR = ./
 
-# no install rule for application used by test
-INSTALLS =
-
-
+# This app is testdata for tst_qprocess
+target.path = $$[QT_INSTALL_TESTS]/tst_qprocess/$$TARGET
+INSTALLS += target
index 913e868..eac0b59 100644 (file)
@@ -7,7 +7,6 @@ mac {
   CONFIG -= app_bundle
 }
 
-# no install rule for application used by test
-INSTALLS =
-
-
+# This app is testdata for tst_qprocess
+target.path = "$$[QT_INSTALL_TESTS]/tst_qprocess/test Space In Name"
+INSTALLS += target
index 32cd6b7..f5754c0 100644 (file)
@@ -73,10 +73,9 @@ class tst_QProcess : public QObject
 {
     Q_OBJECT
 
-#ifdef QT_NO_PROCESS
 public slots:
     void initTestCase();
-#else
+#ifndef QT_NO_PROCESS
 private slots:
     void getSetCheck();
     void constructing();
@@ -166,13 +165,18 @@ private:
 #endif
 };
 
-#ifdef QT_NO_PROCESS
 void tst_QProcess::initTestCase()
 {
+#ifdef QT_NO_PROCESS
     QSKIP("This test requires QProcess support");
+#else
+    // chdir to our testdata path and execute helper apps relative to that.
+    QString testdata_dir = QFileInfo(QFINDTESTDATA("testProcessNormal")).absolutePath();
+    QVERIFY2(QDir::setCurrent(testdata_dir), qPrintable("Could not chdir to " + testdata_dir));
+#endif
 }
 
-#else
+#ifndef QT_NO_PROCESS
 
 // Testing get/set functions
 void tst_QProcess::getSetCheck()
index 1bb7bd9..d6e2cb3 100644 (file)
@@ -10,26 +10,14 @@ runtime_resource.commands = $$QMAKE_RCC -root /runtime_resource/ -binary $${runt
 QMAKE_EXTRA_TARGETS = runtime_resource
 PRE_TARGETDEPS += $${runtime_resource.target}
 
-wince* {
-    deploy.files += runtime_resource.rcc parentdir.txt
-    test.files = testqrc/*
-    test.path = testqrc
-    alias.files = testqrc/aliasdir/*
-    alias.path = testqrc/aliasdir
-    other.files = testqrc/otherdir/*
-    other.path = testqrc/otherdir
-    search1.files = testqrc/searchpath1/*
-    search1.path = testqrc/searchpath1
-    search2.files = testqrc/searchpath2/*
-    search2.path = testqrc/searchpath2
-    sub.files = testqrc/subdir/*
-    sub.path = testqrc/subdir
-    testsub.files = testqrc/test/*
-    testsub.path = testqrc/test
-    testsub2.files = testqrc/test/test/*
-    testsub2.path = testqrc/test/test
-    DEPLOYMENT += deploy test alias other search1 search2 sub testsub testsub2
-    DEFINES += SRCDIR=\\\"\\\"
-} else {
-    DEFINES += SRCDIR=\\\"$$PWD/\\\"
-}
+TESTDATA += \
+    parentdir.txt \
+    testqrc/*
+
+# Special case needed for runtime_resource.rcc installation,
+# since it does not exist at qmake runtime.
+load(testcase)  # to get value of target.path
+runtime_resource_install.CONFIG = no_check_exist
+runtime_resource_install.files = $$OUT_PWD/$${runtime_resource.target}
+runtime_resource_install.path = $${target.path}
+INSTALLS += runtime_resource_install
index 4a2dfb3..2a40a64 100644 (file)
@@ -59,9 +59,6 @@ private slots:
     void searchPath();
     void doubleSlashInRoot();
     void setLocale();
-
-private:
-    QString builddir;
 };
 
 Q_DECLARE_METATYPE(QLocale)
@@ -69,26 +66,15 @@ Q_DECLARE_METATYPE(qlonglong)
 
 void tst_QResourceEngine::initTestCase()
 {
-    QVERIFY(QResource::registerResource("runtime_resource.rcc"));
-    QVERIFY(QResource::registerResource("runtime_resource.rcc", "/secondary_root/"));
-    QString srcdir(QLatin1String(SRCDIR));
-    if (!srcdir.isEmpty()) {
-        builddir = QDir::current().absolutePath();
-        if (!builddir.endsWith(QDir::separator()))
-            builddir.append(QDir::separator());
-        QDir::setCurrent(srcdir);
-    }
+    QVERIFY(QResource::registerResource(QFINDTESTDATA("runtime_resource.rcc")));
+    QVERIFY(QResource::registerResource(QFINDTESTDATA("runtime_resource.rcc"), "/secondary_root/"));
 }
 
 void tst_QResourceEngine::cleanupTestCase()
 {
-    if (!builddir.isEmpty()) {
-        QDir::setCurrent(builddir);
-    }
-
     // make sure we don't leak memory
-    QVERIFY(QResource::unregisterResource("runtime_resource.rcc"));
-    QVERIFY(QResource::unregisterResource("runtime_resource.rcc", "/secondary_root/"));
+    QVERIFY(QResource::unregisterResource(QFINDTESTDATA("runtime_resource.rcc")));
+    QVERIFY(QResource::unregisterResource(QFINDTESTDATA("runtime_resource.rcc"), "/secondary_root/"));
 }
 
 void tst_QResourceEngine::checkStructure_data()
@@ -182,7 +168,7 @@ void tst_QResourceEngine::checkStructure_data()
                                                   << QLocale::c()
                                                   << qlonglong(0);
 
-        info = QFileInfo("testqrc/test/test/test1.txt");
+        info = QFileInfo(QFINDTESTDATA("testqrc/test/test/test1.txt"));
         QTest::newRow(QString(root + "test1 text").toLatin1().constData())        << QString(root + "test/test/test1.txt")
                                                   << QString("abc")
                                                   << QStringList()
@@ -190,7 +176,7 @@ void tst_QResourceEngine::checkStructure_data()
                                                   << QLocale::c()
                                                   << qlonglong(info.size());
 
-        info = QFileInfo("testqrc/blahblah.txt");
+        info = QFileInfo(QFINDTESTDATA("testqrc/blahblah.txt"));
         QTest::newRow(QString(root + "text no slashes").toLatin1().constData())   << QString(root + "withoutslashes/blahblah.txt")
                                                   << QString("qwerty")
                                                   << QStringList()
@@ -199,7 +185,7 @@ void tst_QResourceEngine::checkStructure_data()
                                                   << qlonglong(info.size());
 
 
-        info = QFileInfo("testqrc/test/test/test2.txt");
+        info = QFileInfo(QFINDTESTDATA("testqrc/test/test/test2.txt"));
         QTest::newRow(QString(root + "test1 text").toLatin1().constData())        << QString(root + "test/test/test2.txt")
                                                   << QString("def")
                                                   << QStringList()
@@ -207,7 +193,7 @@ void tst_QResourceEngine::checkStructure_data()
                                                   << QLocale::c()
                                                   << qlonglong(info.size());
 
-        info = QFileInfo("testqrc/currentdir.txt");
+        info = QFileInfo(QFINDTESTDATA("testqrc/currentdir.txt"));
         QTest::newRow(QString(root + "currentdir text").toLatin1().constData())   << QString(root + "test/abc/123/+++/currentdir.txt")
                                                   << QString("\"This is the current dir\" ")
                                                   << QStringList()
@@ -215,7 +201,7 @@ void tst_QResourceEngine::checkStructure_data()
                                                   << QLocale::c()
                                                   << qlonglong(info.size());
 
-        info = QFileInfo("testqrc/currentdir2.txt");
+        info = QFileInfo(QFINDTESTDATA("testqrc/currentdir2.txt"));
         QTest::newRow(QString(root + "currentdir text2").toLatin1().constData())  << QString(root + "test/abc/123/+++/currentdir2.txt")
                                                   << QString("\"This is also the current dir\" ")
                                                   << QStringList()
@@ -223,7 +209,7 @@ void tst_QResourceEngine::checkStructure_data()
                                                   << QLocale::c()
                                                   << qlonglong(info.size());
 
-        info = QFileInfo("parentdir.txt");
+        info = QFileInfo(QFINDTESTDATA("parentdir.txt"));
         QTest::newRow(QString(root + "parentdir text").toLatin1().constData())    << QString(root + "test/abc/123/+++/parentdir.txt")
                                                   << QString("abcdefgihklmnopqrstuvwxyz ")
                                                   << QStringList()
@@ -231,7 +217,7 @@ void tst_QResourceEngine::checkStructure_data()
                                                   << QLocale::c()
                                                   << qlonglong(info.size());
 
-        info = QFileInfo("testqrc/subdir/subdir.txt");
+        info = QFileInfo(QFINDTESTDATA("testqrc/subdir/subdir.txt"));
         QTest::newRow(QString(root + "subdir text").toLatin1().constData())       << QString(root + "test/abc/123/+++/subdir/subdir.txt")
                                                   << QString("\"This is in the sub directory\" ")
                                                   << QStringList()
@@ -239,7 +225,7 @@ void tst_QResourceEngine::checkStructure_data()
                                                   << QLocale::c()
                                                   << qlonglong(info.size());
 
-        info = QFileInfo("testqrc/test/testdir.txt");
+        info = QFileInfo(QFINDTESTDATA("testqrc/test/testdir.txt"));
         QTest::newRow(QString(root + "testdir text").toLatin1().constData())      << QString(root + "test/testdir.txt")
                                                   << QString("\"This is in the test directory\" ")
                                                   << QStringList()
@@ -247,7 +233,7 @@ void tst_QResourceEngine::checkStructure_data()
                                                   << QLocale::c()
                                                   << qlonglong(info.size());
 
-        info = QFileInfo("testqrc/otherdir/otherdir.txt");
+        info = QFileInfo(QFINDTESTDATA("testqrc/otherdir/otherdir.txt"));
         QTest::newRow(QString(root + "otherdir text").toLatin1().constData())     << QString(root + "otherdir/otherdir.txt")
                                                   << QString("\"This is the other dir\" ")
                                                   << QStringList()
@@ -255,7 +241,7 @@ void tst_QResourceEngine::checkStructure_data()
                                                   << QLocale::c()
                                                   << qlonglong(info.size());
 
-        info = QFileInfo("testqrc/test/testdir2.txt");
+        info = QFileInfo(QFINDTESTDATA("testqrc/test/testdir2.txt"));
         QTest::newRow(QString(root + "alias text").toLatin1().constData())        << QString(root + "aliasdir/aliasdir.txt")
                                                   << QString("\"This is another file in this directory\" ")
                                                   << QStringList()
@@ -263,7 +249,7 @@ void tst_QResourceEngine::checkStructure_data()
                                                   << QLocale::c()
                                                   << qlonglong(info.size());
 
-        info = QFileInfo("testqrc/aliasdir/aliasdir.txt");
+        info = QFileInfo(QFINDTESTDATA("testqrc/aliasdir/aliasdir.txt"));
         QTest::newRow(QString(root + "korean text").toLatin1().constData())       << QString(root + "aliasdir/aliasdir.txt")
                                                   << QString("\"This is a korean text file\" ")
                                                   << QStringList()
@@ -271,7 +257,7 @@ void tst_QResourceEngine::checkStructure_data()
                                                   << QLocale("ko")
                                                   << qlonglong(info.size());
 
-        info = QFileInfo("testqrc/aliasdir/aliasdir.txt");
+        info = QFileInfo(QFINDTESTDATA("testqrc/aliasdir/aliasdir.txt"));
         QTest::newRow(QString(root + "korean text 2").toLatin1().constData())     << QString(root + "aliasdir/aliasdir.txt")
                                                   << QString("\"This is a korean text file\" ")
                                                   << QStringList()
@@ -279,7 +265,7 @@ void tst_QResourceEngine::checkStructure_data()
                                                   << QLocale("ko_KR")
                                                   << qlonglong(info.size());
 
-        info = QFileInfo("testqrc/test/german.txt");
+        info = QFileInfo(QFINDTESTDATA("testqrc/test/german.txt"));
         QTest::newRow(QString(root + "german text").toLatin1().constData())   << QString(root + "aliasdir/aliasdir.txt")
                                               << QString("Deutsch")
                                               << QStringList()
@@ -287,7 +273,7 @@ void tst_QResourceEngine::checkStructure_data()
                                               << QLocale("de")
                                               << qlonglong(info.size());
 
-        info = QFileInfo("testqrc/test/german.txt");
+        info = QFileInfo(QFINDTESTDATA("testqrc/test/german.txt"));
         QTest::newRow(QString(root + "german text 2").toLatin1().constData())   << QString(root + "aliasdir/aliasdir.txt")
                                                 << QString("Deutsch")
                                                 << QStringList()
@@ -295,9 +281,9 @@ void tst_QResourceEngine::checkStructure_data()
                                                 << QLocale("de_DE")
                                                 << qlonglong(info.size());
 
-        QFile file("testqrc/aliasdir/compressme.txt");
+        QFile file(QFINDTESTDATA("testqrc/aliasdir/compressme.txt"));
         file.open(QFile::ReadOnly);
-        info = QFileInfo("testqrc/aliasdir/compressme.txt");
+        info = QFileInfo(QFINDTESTDATA("testqrc/aliasdir/compressme.txt"));
         QTest::newRow(QString(root + "compressed text").toLatin1().constData())   << QString(root + "aliasdir/aliasdir.txt")
                                                   << QString(file.readAll())
                                                   << QStringList()
@@ -416,9 +402,9 @@ void tst_QResourceEngine::checkUnregisterResource_data()
     QTest::addColumn<QString>("file_check");
     QTest::addColumn<int>("size");
 
-    QTest::newRow("currentdir.txt") << builddir + QString("runtime_resource.rcc") << QString("/check_unregister/")
+    QTest::newRow("currentdir.txt") << QFINDTESTDATA("runtime_resource.rcc") << QString("/check_unregister/")
                                     << QString(":/check_unregister/runtime_resource/test/abc/123/+++/currentdir.txt") 
-                                    << (int)QFileInfo("testqrc/currentdir.txt").size();
+                                    << (int)QFileInfo(QFINDTESTDATA("testqrc/currentdir.txt")).size();
 }
 
 void tst_QResourceEngine::checkUnregisterResource()
index c39204a..2ceef97 100644 (file)
@@ -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
index 67abd09..be0c85e 100644 (file)
@@ -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);
index b9650b8..e06265b 100644 (file)
@@ -2,4 +2,4 @@ CONFIG += testcase parallel_test
 TARGET = tst_qtemporaryfile
 QT = core testlib
 SOURCES = tst_qtemporaryfile.cpp
-DEFINES += SRCDIR=\\\"$$PWD/\\\"
+TESTDATA += tst_qtemporaryfile.cpp
index dd8b782..fb459e9 100644 (file)
@@ -418,7 +418,7 @@ void tst_QTemporaryFile::renameFdLeak()
     static const int count = 10;
     int bunch_of_files[count];
     for (int i = 0; i < count; ++i) {
-        bunch_of_files[i] = ::open(SRCDIR "tst_qtemporaryfile.cpp", O_RDONLY);
+        bunch_of_files[i] = ::open(qPrintable(QFINDTESTDATA("tst_qtemporaryfile.cpp")), O_RDONLY);
         QVERIFY(bunch_of_files[i] != -1);
     }
 
index 9cf4d19..4a4c091 100644 (file)
@@ -4,4 +4,6 @@ CONFIG += console
 CONFIG -= app_bundle
 DESTDIR = ./
 
-
+# This app is testdata for tst_qtextstream
+target.path = $$[QT_INSTALL_TESTS]/tst_qtextstream/$$TARGET
+INSTALLS += target
index 9cf4d19..4a4c091 100644 (file)
@@ -4,4 +4,6 @@ CONFIG += console
 CONFIG -= app_bundle
 DESTDIR = ./
 
-
+# This app is testdata for tst_qtextstream
+target.path = $$[QT_INSTALL_TESTS]/tst_qtextstream/$$TARGET
+INSTALLS += target
index 9cf4d19..4a4c091 100644 (file)
@@ -4,4 +4,6 @@ CONFIG += console
 CONFIG -= app_bundle
 DESTDIR = ./
 
-
+# This app is testdata for tst_qtextstream
+target.path = $$[QT_INSTALL_TESTS]/tst_qtextstream/$$TARGET
+INSTALLS += target
index def7921..577f529 100644 (file)
@@ -12,15 +12,12 @@ win32 {
     }
 }
 
-wince* {
-    addFiles.files = ../rfc3261.txt ../shift-jis.txt ../task113817.txt ../qtextstream.qrc ../tst_qtextstream.cpp
-    addFiles.path = .
-    res.files = ../resources
-    res.path = .
-    DEPLOYMENT += addFiles
-    DEFINES += SRCDIR=\\\"\\\"
-} else {
-    DEFINES += SRCDIR=\\\"$$PWD/../\\\"
-}
+TESTDATA += \
+    ../rfc3261.txt \
+    ../shift-jis.txt \
+    ../task113817.txt \
+    ../qtextstream.qrc \
+    ../tst_qtextstream.cpp \
+    ../resources
 
 mac: CONFIG += insignificant_test # QTBUG-22767
index 049ab2d..86a5ac1 100644 (file)
@@ -47,7 +47,6 @@
 
 #include <QBuffer>
 #include <QByteArray>
-#include <QCoreApplication>
 #include <QDebug>
 #include <QFile>
 #include <QTcpSocket>
@@ -247,16 +246,16 @@ private:
 void tst_QTextStream::initTestCase()
 {
     QVERIFY(QtNetworkSettings::verifyTestNetworkSettings());
+
+    // chdir into the testdata dir and refer to our helper apps with relative paths
+    QString testdata_dir = QFileInfo(QFINDTESTDATA("stdinProcess")).absolutePath();
+    QVERIFY2(QDir::setCurrent(testdata_dir), qPrintable("Could not chdir to " + testdata_dir));
 }
 
 // Testing get/set functions
 void tst_QTextStream::getSetCheck()
 {
     // Initialize codecs
-    int argc = 0;
-    char **argv = 0;
-    QCoreApplication app(argc, argv);
-
     QTextStream obj1;
     // QTextCodec * QTextStream::codec()
     // void QTextStream::setCodec(QTextCodec *)
@@ -753,7 +752,7 @@ void tst_QTextStream::generateAllData(bool for_QString)
 // ------------------------------------------------------------------------------
 void tst_QTextStream::readLineUntilNull()
 {
-    QFile file(SRCDIR "rfc3261.txt");
+    QFile file(QFINDTESTDATA("rfc3261.txt"));
     QVERIFY(file.open(QFile::ReadOnly));
 
     QTextStream stream(&file);
@@ -872,7 +871,7 @@ void tst_QTextStream::lineCount_data()
     QTest::newRow("buffersize+1 line") << QByteArray(16384, '\n') << 16384;
     QTest::newRow("buffersize+2 line") << QByteArray(16385, '\n') << 16385;
 
-    QFile file(SRCDIR "rfc3261.txt"); file.open(QFile::ReadOnly);
+    QFile file(QFINDTESTDATA("rfc3261.txt")); file.open(QFile::ReadOnly);
     QTest::newRow("rfc3261") << file.readAll() << 15067;
 }
 
@@ -908,7 +907,7 @@ void tst_QTextStream::performance()
 
         stopWatch.restart();
         int nlines1 = 0;
-        QFile file(SRCDIR "rfc3261.txt");
+        QFile file(QFINDTESTDATA("rfc3261.txt"));
         QVERIFY(file.open(QFile::ReadOnly));
 
         while (!file.atEnd()) {
@@ -920,7 +919,7 @@ void tst_QTextStream::performance()
         stopWatch.restart();
 
         int nlines2 = 0;
-        QFile file2(SRCDIR "rfc3261.txt");
+        QFile file2(QFINDTESTDATA("rfc3261.txt"));
         QVERIFY(file2.open(QFile::ReadOnly));
 
         QTextStream stream(&file2);
@@ -1089,11 +1088,7 @@ void tst_QTextStream::ws_manipulator()
 // ------------------------------------------------------------------------------
 void tst_QTextStream::stillOpenWhenAtEnd()
 {
-    int argc = 0;
-    char **argv = 0;
-    QCoreApplication app(argc, argv);
-
-    QFile file(SRCDIR "tst_qtextstream.cpp");
+    QFile file(QFINDTESTDATA("tst_qtextstream.cpp"));
     QVERIFY(file.open(QFile::ReadOnly));
 
     QTextStream stream(&file);
@@ -1141,7 +1136,7 @@ void tst_QTextStream::readNewlines()
 // ------------------------------------------------------------------------------
 void tst_QTextStream::seek()
 {
-    QFile file(SRCDIR "rfc3261.txt");
+    QFile file(QFINDTESTDATA("rfc3261.txt"));
     QVERIFY(file.open(QFile::ReadOnly));
 
     QTextStream stream(&file);
@@ -1189,8 +1184,6 @@ void tst_QTextStream::seek()
 // ------------------------------------------------------------------------------
 void tst_QTextStream::pos()
 {
-    int argc = 1;
-    QCoreApplication app(argc, 0);
     {
         // Strings
         QString str("this is a test");
@@ -1236,7 +1229,7 @@ void tst_QTextStream::pos()
     }
     {
         // Latin1 device
-        QFile file(SRCDIR "rfc3261.txt");
+        QFile file(QFINDTESTDATA("rfc3261.txt"));
         QVERIFY(file.open(QIODevice::ReadOnly));
 
         QTextStream stream(&file);
@@ -1268,7 +1261,7 @@ void tst_QTextStream::pos()
     {
         // Shift-JIS device
         for (int i = 0; i < 2; ++i) {
-            QFile file(SRCDIR "shift-jis.txt");
+            QFile file(QFINDTESTDATA("shift-jis.txt"));
             if (i == 0)
                 QVERIFY(file.open(QIODevice::ReadOnly));
             else
@@ -2870,22 +2863,6 @@ void tst_QTextStream::int_write_with_locale()
 
 // ------------------------------------------------------------------------------
 
-// like QTEST_APPLESS_MAIN, but initialising the locale on Unix
-#if defined (Q_OS_UNIX)
-QT_BEGIN_NAMESPACE
-extern bool qt_locale_initialized;
-QT_END_NAMESPACE
-#endif
-
-int main(int argc, char *argv[])
-{
-#if defined (Q_OS_UNIX)
-    ::setlocale(LC_ALL, "");
-    qt_locale_initialized = true;
-#endif
-    tst_QTextStream tc;
-    return QTest::qExec(&tc, argc, argv);
-}
-
+QTEST_MAIN(tst_QTextStream)
 #include "tst_qtextstream.moc"
 
index 9df1364..ff21d6a 100644 (file)
@@ -2,14 +2,3 @@ CONFIG += testcase
 TARGET = tst_qitemmodel
 QT += widgets sql testlib
 SOURCES = tst_qitemmodel.cpp
-
-# NOTE: The deployment of the sqldrivers is disabled on purpose.
-#       If we deploy the plugins, they are loaded twice when running
-#       the tests on the autotest system. In that case we run out of
-#       memory on Windows Mobile 5.
-
-#wince*: {
-#   plugFiles.files = $$QT_BUILD_TREE/plugins/sqldrivers/*.dll
-#   plugFiles.path    = sqldrivers
-#   DEPLOYMENT += plugFiles 
-#}
index a835264..ed3adf0 100644 (file)
@@ -1,7 +1,3 @@
-######################################################################
-# Automatically generated by qmake (2.01a) Tue Aug 15 13:45:41 2006
-######################################################################
-
 TEMPLATE = app
 TARGET = 
 DEPENDPATH += .
@@ -16,4 +12,6 @@ wince*: {
 HEADERS += signalbug.h
 SOURCES += signalbug.cpp
 
-
+# This app is testdata for tst_qobject
+target.path = $$[QT_INSTALL_TESTS]/tst_qobject
+INSTALLS += target
index 1b5e3bd..b20b98d 100644 (file)
@@ -2796,7 +2796,8 @@ void tst_QObject::dynamicProperties()
 void tst_QObject::recursiveSignalEmission()
 {
     QProcess proc;
-    proc.start("./signalbug");
+    // signalbug helper app should always be next to this test binary
+    proc.start(QCoreApplication::applicationDirPath() + "/signalbug");
     QVERIFY(proc.waitForFinished());
     QVERIFY(proc.exitStatus() == QProcess::NormalExit);
     QCOMPARE(proc.exitCode(), 0);
index bbc02ce..e138526 100644 (file)
@@ -6,9 +6,3 @@ SOURCES = tst_qobject.cpp
 # this is here for a reason, moc_oldnormalizedobject.cpp is not auto-generated, it was generated by
 # moc from Qt 4.6, and should *not* be generated by the current moc
 SOURCES += moc_oldnormalizeobject.cpp
-
-wince* { 
-    addFiles.files = signalbug.exe
-    addFiles.path = .
-    DEPLOYMENT += addFiles
-}
index f44be7d..c644f83 100644 (file)
@@ -4,8 +4,4 @@ QT += widgets testlib
 SOURCES = tst_qtranslator.cpp
 RESOURCES += qtranslator.qrc
 
-wince* {
-   addFiles.files = hellotr_la.qm msgfmt_from_po.qm
-   addFiles.path = .
-   DEPLOYMENT += addFiles
-}
+TESTDATA += hellotr_la.qm msgfmt_from_po.qm
index 5908c33..f47c02f 100644 (file)
@@ -56,6 +56,8 @@ public:
 protected:
     bool event(QEvent *event);
 private slots:
+    void initTestCase();
+
     void load();
     void load2();
     void threadLoad();
@@ -76,6 +78,14 @@ tst_QTranslator::tst_QTranslator()
     hide();
 }
 
+void tst_QTranslator::initTestCase()
+{
+    // chdir into the directory containing our testdata,
+    // to make the code simpler (load testdata via relative paths)
+    QString testdata_dir = QFileInfo(QFINDTESTDATA("hellotr_la.qm")).absolutePath();
+    QVERIFY2(QDir::setCurrent(testdata_dir), qPrintable("Could not chdir to " + testdata_dir));
+}
+
 bool tst_QTranslator::event(QEvent *event)
 {
     if (event->type() == QEvent::LanguageChange)
@@ -228,10 +238,11 @@ void tst_QTranslator::loadFromResource()
 
 void tst_QTranslator::loadDirectory()
 {
-    QVERIFY(QFileInfo("../qtranslator").isDir());
+    QString current_base = QDir::current().dirName();
+    QVERIFY(QFileInfo("../" + current_base).isDir());
 
     QTranslator tor;
-    tor.load("qtranslator", "..");
+    tor.load(current_base, "..");
     QVERIFY(tor.isEmpty());
 }
 
index f95e633..d8551fa 100644 (file)
@@ -10,5 +10,6 @@ wince*: DEFINES += WIN32_MSVC
 win32-msvc: DEFINES += WIN32_MSVC
 win32-borland: DEFINES += WIN32_BORLAND
 
-#no special install rule for the library used by test
-INSTALLS =
+# This project is testdata for tst_qlibrary
+target.path = $$[QT_INSTALL_TESTS]/tst_qlibrary
+INSTALLS += target
index 835240a..7d319d6 100644 (file)
@@ -26,13 +26,17 @@ win32 {
     src = $(DESTDIR)$(TARGET)
     files = libmylib.so2 system.trolltech.test.mylib.so
 }
+
+# This project is testdata for tst_qlibrary
+target.path = $$[QT_INSTALL_TESTS]$${QMAKE_DIR_SEP}tst_qlibrary
+renamed_target.path = $$target.path
+
 for(file, files) {
     QMAKE_POST_LINK += $$QMAKE_COPY $$src ..$$QMAKE_DIR_SEP$$file &&
+    renamed_target.extra += $$QMAKE_COPY $$src $(INSTALL_ROOT)$${target.path}$$QMAKE_DIR_SEP$$file &&
     CLEAN_FILES += ../$$file
 }
+renamed_target.extra = $$member(renamed_target.extra, 0, -2)
 QMAKE_POST_LINK = $$member(QMAKE_POST_LINK, 0, -2)
 
-#no special install rule for the library used by test
-INSTALLS =
-
-
+INSTALLS += target renamed_target
index a1854ad..6e71ec8 100644 (file)
@@ -11,11 +11,4 @@ win32 {
     }
 }
 
-wince* {
-    addFiles.files = ../*.dll ../*.dl2 ../mylib_noextension
-    addFiles.path = .
-    DEPLOYMENT += addFiles
-    DEFINES += SRCDIR=\\\"\\\"
-} else {
-    DEFINES += SRCDIR=\\\"$$PWD/../\\\"
-}
+TESTDATA += ../library_path/invalid.so
index 97e38ff..c1f090a 100644 (file)
@@ -115,10 +115,6 @@ class tst_QLibrary : public QObject
 {
     Q_OBJECT
 
-public:
-    tst_QLibrary();
-    virtual ~tst_QLibrary();
-
 enum QLibraryOperation {
     Load = 1,
     Unload = 2,
@@ -127,6 +123,8 @@ enum QLibraryOperation {
     DontSetFileName = 0x100
 };
 private slots:
+    void initTestCase();
+
     void load();
     void load_data();
     void library_data();
@@ -146,33 +144,17 @@ private slots:
     void fileName_data();
     void fileName();
     void multipleInstancesForOneLibrary();
-
-#ifdef Q_OS_WINCE
-private:
-    QCoreApplication* app;
-#endif
 };
 
-tst_QLibrary::tst_QLibrary()
-
-{
-#ifdef Q_OS_WINCE
-    char* argv = "app";
-    int argc = 1;
-    app = new QCoreApplication(argc,&argv);
-#endif
-}
+typedef int (*VersionFunction)(void);
 
-tst_QLibrary::~tst_QLibrary()
+void tst_QLibrary::initTestCase()
 {
-#ifdef Q_OS_WINCE
-    app->quit();
-#endif
+    // chdir to our testdata directory, and use relative paths in some tests.
+    QString testdatadir = QFileInfo(QFINDTESTDATA("library_path")).absolutePath();
+    QVERIFY2(QDir::setCurrent(testdatadir), qPrintable("Could not chdir to " + testdatadir));
 }
 
-
-typedef int (*VersionFunction)(void);
-
 void tst_QLibrary::version_data()
 {
     QTest::addColumn<QString>("lib");
@@ -376,10 +358,6 @@ void tst_QLibrary::errorString_data()
 
     QString currDir = QDir::currentPath();
 
-    QString srcDir = SRCDIR;
-    if (srcDir.isEmpty())
-        srcDir = currDir;
-
     QTest::newRow("bad load()") << (int)Load << QString("nosuchlib") << false << QString("Cannot load library nosuchlib: .*");
     QTest::newRow("call errorString() on QLibrary with no d-pointer (crashtest)") << (int)(Load | DontSetFileName) << QString() << false << QString("Unknown error");
 #ifdef Q_OS_WINCE
@@ -394,7 +372,7 @@ void tst_QLibrary::errorString_data()
 //    QTest::newRow("bad unload") << (int)Unload << QString("nosuchlib.dll") << false << QString("QLibrary::unload_sys: Cannot unload nosuchlib.dll (The specified module could not be found.)");
 #elif defined Q_OS_MAC
 #else
-    QTest::newRow("load invalid file") << (int)Load << srcDir + "/library_path/invalid.so" << false << QString("Cannot load library.*");
+    QTest::newRow("load invalid file") << (int)Load << QFINDTESTDATA("library_path/invalid.so") << false << QString("Cannot load library.*");
 #endif
 }
 
@@ -569,5 +547,5 @@ void tst_QLibrary::multipleInstancesForOneLibrary()
     QCOMPARE(lib2.isLoaded(), true);
 }
 
-QTEST_APPLESS_MAIN(tst_QLibrary)
+QTEST_MAIN(tst_QLibrary)
 #include "tst_qlibrary.moc"
index a569cff..8c6540f 100644 (file)
@@ -3,8 +3,4 @@ TARGET = tst_qplugin
 QT = core testlib
 SOURCES = tst_qplugin.cpp
 
-wince* {
-   plugins.files = plugins/*
-   plugins.path = plugins
-   DEPLOYMENT += plugins
-}
+TESTDATA += plugins/*
index b45509e..333b19d 100644 (file)
@@ -5,3 +5,7 @@ SOURCES       = almostplugin.cpp
 TARGET        = almostplugin
 DESTDIR       = ../bin
 *-g++*:QMAKE_LFLAGS -= -Wl,--no-undefined
+
+# This is testdata for the tst_qpluginloader test.
+target.path = $$[QT_INSTALL_TESTS]/tst_qpluginloader/bin
+INSTALLS += target
index 1a78492..a45df71 100644 (file)
@@ -9,5 +9,6 @@ QT = core
 win32-msvc: DEFINES += WIN32_MSVC
 win32-borland: DEFINES += WIN32_BORLAND
 
-#no special install rule for the library used by test
-INSTALLS =
+# This is testdata for the tst_qpluginloader test.
+target.path = $$[QT_INSTALL_TESTS]/tst_qpluginloader/bin
+INSTALLS += target
index bd318a3..382250a 100644 (file)
@@ -4,3 +4,7 @@ HEADERS       = theplugin.h
 SOURCES       = theplugin.cpp
 TARGET        = $$qtLibraryTarget(theplugin)
 DESTDIR       = ../bin
+
+# This is testdata for the tst_qpluginloader test.
+target.path = $$[QT_INSTALL_TESTS]/tst_qpluginloader/bin
+INSTALLS += target
index 0de46be..810efe8 100644 (file)
@@ -3,7 +3,6 @@ TARGET  = ../tst_qpluginloader
 QT = core testlib
 SOURCES = ../tst_qpluginloader.cpp
 HEADERS = ../theplugin/plugininterface.h
-DEFINES += SRCDIR=\\\"$$PWD/../\\\"
 
 win32 {
     CONFIG(debug, debug|release) {
@@ -13,10 +12,6 @@ win32 {
     }
 }
 
-wince* {
-   addFiles.files = $$OUT_PWD/../bin/*.dll
-   addFiles.path = bin
-   DEPLOYMENT += addFiles
-}
+TESTDATA += ../elftest
 
 mac: CONFIG += insignificant_test # QTBUG-22765
index a874324..4b1ed71 100644 (file)
@@ -95,8 +95,7 @@
 
 static QString sys_qualifiedLibraryName(const QString &fileName)
 {
-    QString currDir = QDir::currentPath();
-    return currDir + "/bin/" + PREFIX + fileName + SUFFIX;
+    return QFINDTESTDATA(QString("bin/%1%2%3").arg(PREFIX).arg(fileName).arg(SUFFIX));
 }
 
 //TESTED_CLASS=
@@ -249,8 +248,8 @@ void tst_QPluginLoader::deleteinstanceOnUnload()
 void tst_QPluginLoader::loadDebugObj()
 {
 #if defined (__ELF__)
-    QVERIFY(QFile::exists(SRCDIR "elftest/debugobj.so"));
-    QPluginLoader lib1(SRCDIR "elftest/debugobj.so");
+    QVERIFY(QFile::exists(QFINDTESTDATA("elftest/debugobj.so")));
+    QPluginLoader lib1(QFINDTESTDATA("elftest/debugobj.so"));
     QCOMPARE(lib1.load(), false);
 #endif
 }
@@ -259,21 +258,21 @@ void tst_QPluginLoader::loadCorruptElf()
 {
 #if defined (__ELF__)
     if (sizeof(void*) == 8) {
-        QVERIFY(QFile::exists(SRCDIR "elftest/corrupt1.elf64.so"));
+        QVERIFY(QFile::exists(QFINDTESTDATA("elftest/corrupt1.elf64.so")));
 
-        QPluginLoader lib1(SRCDIR "elftest/corrupt1.elf64.so");
+        QPluginLoader lib1(QFINDTESTDATA("elftest/corrupt1.elf64.so"));
         QCOMPARE(lib1.load(), false);
         QVERIFY2(lib1.errorString().contains("not an ELF object"), qPrintable(lib1.errorString()));
 
-        QPluginLoader lib2(SRCDIR "elftest/corrupt2.elf64.so");
+        QPluginLoader lib2(QFINDTESTDATA("elftest/corrupt2.elf64.so"));
         QCOMPARE(lib2.load(), false);
         QVERIFY2(lib2.errorString().contains("invalid"), qPrintable(lib2.errorString()));
 
-        QPluginLoader lib3(SRCDIR "elftest/corrupt3.elf64.so");
+        QPluginLoader lib3(QFINDTESTDATA("elftest/corrupt3.elf64.so"));
         QCOMPARE(lib3.load(), false);
         QVERIFY2(lib3.errorString().contains("invalid"), qPrintable(lib3.errorString()));
     } else if (sizeof(void*) == 4) {
-        QPluginLoader libW(SRCDIR "elftest/corrupt3.elf64.so");
+        QPluginLoader libW(QFINDTESTDATA("elftest/corrupt3.elf64.so"));
         QCOMPARE(libW.load(), false);
         QVERIFY2(libW.errorString().contains("architecture"), qPrintable(libW.errorString()));
     } else {
@@ -286,12 +285,12 @@ void tst_QPluginLoader::loadGarbage()
 {
 #if defined (Q_OS_UNIX)
     for (int i=0; i<5; i++) {
-        QPluginLoader lib(QString(SRCDIR "elftest/garbage%1.so").arg(i));
+        QPluginLoader lib(QFINDTESTDATA(QString("elftest/garbage%1.so").arg(i)));
         QCOMPARE(lib.load(), false);
         QVERIFY(lib.errorString() != QString("Unknown error"));
     }
 #endif
 }
 
-QTEST_APPLESS_MAIN(tst_QPluginLoader)
+QTEST_MAIN(tst_QPluginLoader)
 #include "tst_qpluginloader.moc"
index 4999177..0f6f915 100644 (file)
@@ -12,9 +12,3 @@ CONFIG(debug_and_release_target) {
 } else {
     DESTDIR = ..
 }
-
-wince* {
-    addFile_processUniqueness.files = $$OUT_PWD/../testProcessUniqueness/testProcessUniqueness.exe
-    addFile_processUniqueness.path = testProcessUniqueness
-    DEPLOYMENT += addFile_processUniqueness
-}
index 88df1a2..958127e 100644 (file)
@@ -3,6 +3,6 @@ CONFIG += console
 
 DESTDIR = ./
 
-# no install rule for application used by test
-INSTALLS =
-
+# This app is testdata for tst_quuid
+target.path = $$[QT_INSTALL_TESTS]/tst_quuid/$$TARGET
+INSTALLS += target
index 5761ea1..fc0f923 100644 (file)
@@ -56,10 +56,9 @@ class tst_QUuid : public QObject
 {
     Q_OBJECT
 
-public:
-    tst_QUuid();
-
 private slots:
+    void initTestCase();
+
     void fromChar();
     void toString();
     void fromString();
@@ -90,13 +89,17 @@ public:
     QUuid uuidB;
 };
 
-tst_QUuid::tst_QUuid()
+void tst_QUuid::initTestCase()
 {
     //"{fc69b59e-cc34-4436-a43c-ee95d128b8c5}";
     uuidA = QUuid(0xfc69b59e, 0xcc34 ,0x4436 ,0xa4 ,0x3c ,0xee ,0x95 ,0xd1 ,0x28 ,0xb8 ,0xc5);
 
     //"{1ab6e93a-b1cb-4a87-ba47-ec7e99039a7b}";
     uuidB = QUuid(0x1ab6e93a ,0xb1cb ,0x4a87 ,0xba ,0x47 ,0xec ,0x7e ,0x99 ,0x03 ,0x9a ,0x7b);
+
+    // chdir to the directory containing our testdata, then refer to it with relative paths
+    QString testdata_dir = QFileInfo(QFINDTESTDATA("testProcessUniqueness")).absolutePath();
+    QVERIFY2(QDir::setCurrent(testdata_dir), qPrintable("Could not chdir to " + testdata_dir));
 }
 
 void tst_QUuid::fromChar()
index 918ef39..68d0f12 100644 (file)
@@ -2,3 +2,7 @@ SOURCES += crashOnExit.cpp
 QT = core
 CONFIG-=app_bundle
 CONFIG+=console
+
+# This app is testdata for tst_qthreadstorage
+target.path = $$[QT_INSTALL_TESTS]/tst_qthreadstorage
+INSTALLS += target
index ceb74b3..e0fa30b 100644 (file)
@@ -291,15 +291,9 @@ void tst_QThreadStorage::ensureCleanupOrder()
 void tst_QThreadStorage::crashOnExit()
 {
     QProcess process;
-#ifdef Q_OS_WIN
-# ifdef QT_NO_DEBUG
-    process.start("release/crashOnExit");
-# else
-    process.start("debug/crashOnExit");
-# endif
-#else
-    process.start("./crashOnExit");
-#endif
+    // crashOnExit is always expected to be in the same directory
+    // as this test binary
+    process.start(QCoreApplication::applicationDirPath() + "/crashOnExit");
     QVERIFY(process.waitForFinished());
     QVERIFY(process.exitStatus() != QProcess::CrashExit);
 }
index 20aaf86..25a9f9c 100644 (file)
@@ -3,11 +3,4 @@ TARGET = tst_qbytearray
 QT = core-private testlib
 SOURCES = tst_qbytearray.cpp
 
-wince* {
-    addFile.files = rfc3252.txt
-    addFile.path = .
-    DEPLOYMENT += addFile
-    DEFINES += SRCDIR=\\\"./\\\"
-} else {
-    DEFINES += SRCDIR=\\\"$$PWD/\\\"
-}
+TESTDATA += rfc3252.txt
index 5f9751c..f3c33f1 100644 (file)
@@ -172,7 +172,7 @@ void tst_QByteArray::qCompress_data()
     char** tmpArgv = 0;
     QCoreApplication app(tmpArgc, tmpArgv);
 #endif
-    QFile file( SRCDIR "rfc3252.txt" );
+    QFile file( QFINDTESTDATA("rfc3252.txt") );
     QVERIFY( file.open(QIODevice::ReadOnly) );
     QTest::newRow( "04" ) << file.readAll();
 }
index c0a9f1b..4a7072c 100644 (file)
@@ -3,9 +3,4 @@ TARGET = tst_qchar
 QT = core-private testlib
 SOURCES = tst_qchar.cpp
 
-wince* {
-    deploy.files += NormalizationTest.txt
-    DEPLOYMENT += deploy
-}
-
-DEFINES += SRCDIR=\\\"$$PWD/\\\"
+TESTDATA += NormalizationTest.txt
index 8391034..652ad5e 100644 (file)
@@ -583,7 +583,7 @@ void tst_QChar::normalization_data()
     int linenum = 0;
     int part = 0;
 
-    QFile f(SRCDIR "NormalizationTest.txt");
+    QFile f(QFINDTESTDATA("NormalizationTest.txt"));
     QVERIFY(f.exists());
 
     f.open(QIODevice::ReadOnly);
index f03343f..9bb1bdc 100644 (file)
@@ -3,8 +3,3 @@ TARGET = tst_qelapsedtimer
 QT = core testlib
 SOURCES = tst_qelapsedtimer.cpp
 
-wince* {
-    DEFINES += SRCDIR=\\\"\\\"
-} else {
-    DEFINES += SRCDIR=\\\"$$PWD/\\\"
-}
index d3188c0..d510d82 100644 (file)
@@ -1,8 +1,10 @@
 SOURCES += syslocaleapp.cpp
 DESTDIR = ./
 
+CONFIG -= app_bundle
+
 QT = core
 
-# no install rule for application used by test
-INSTALLS =
-CONFIG -= app_bundle
+# This app is testdata for tst_qlocale
+target.path = $$[QT_INSTALL_TESTS]/tst_qlocale/$$TARGET
+INSTALLS += target
index 4649d78..5a4fb67 100644 (file)
@@ -3,20 +3,14 @@ QT = core testlib network
 embedded: QT += gui
 SOURCES = ../tst_qlocale.cpp
 
-!wince* {
-    TARGET = ../tst_qlocale
-    win32: {
-        CONFIG(debug, debug|release) {
-            TARGET = ../../debug/tst_qlocale
-        } else {
-            TARGET = ../../release/tst_qlocale
-        }
+TARGET = ../tst_qlocale
+win32 {
+    CONFIG(debug, debug|release) {
+        TARGET = ../../debug/tst_qlocale
+    } else {
+        TARGET = ../../release/tst_qlocale
     }
-} else {
-    TARGET = tst_qlocale
-    addFiles.files = ../syslocaleapp
-    addFiles.path = "\\Program Files\\tst_qlocale"
-    DEPLOYMENT += addFiles
 }
+TESTDATA += syslocaleapp
 
 mac: CONFIG += insignificant_test # QTBUG-22769
index a5a247f..1cd695a 100644 (file)
@@ -372,7 +372,7 @@ void tst_QLocale::emptyCtor()
     /* because of caching of the system locale. */ \
     QProcess process; \
     process.setEnvironment(QStringList(env) << QString("LANG=%1").arg(req_lc)); \
-    process.start("syslocaleapp/syslocaleapp"); \
+    process.start(syslocaleapp_dir + "syslocaleapp"); \
     process.waitForReadyRead(); \
     QString ret = QString(process.readAll()); \
     process.waitForFinished(); \
@@ -389,10 +389,12 @@ void tst_QLocale::emptyCtor()
         env << entry;
     }
 
+    QString syslocaleapp_dir = QFINDTESTDATA("syslocaleapp/");
+
     // Get default locale.
     QProcess p;
     p.setEnvironment(env);
-    p.start("syslocaleapp/syslocaleapp");
+    p.start(syslocaleapp_dir + "syslocaleapp");
     p.waitForReadyRead();
     QString defaultLoc = QString(p.readAll());
     p.waitForFinished();
index 8ee58a0..b1cd309 100644 (file)
@@ -10,6 +10,6 @@ SOURCES = tst_qsharedpointer.cpp \
 HEADERS = forwarddeclared.h \
     wrapper.h
 
-DEFINES += SRCDIR=\\\"$$PWD/\\\"
+TESTDATA += forwarddeclared.cpp forwarddeclared.h
 
 include(externaltests.pri)
index c4acf5b..416ce14 100644 (file)
@@ -1786,7 +1786,7 @@ void tst_QSharedPointer::invalidConstructs()
 
     QTest::QExternalTest test;
     test.setQtModules(QTest::QExternalTest::QtCore);
-    test.setExtraProgramSources(QStringList() << SRCDIR "forwarddeclared.cpp");
+    test.setExtraProgramSources(QStringList() << QFINDTESTDATA("forwarddeclared.cpp"));
     test.setProgramHeader(
         "#define QT_SHAREDPOINTER_TRACK_POINTERS\n"
         "#define QT_DEBUG\n"
index 68f189b..448b2ef 100644 (file)
@@ -2,10 +2,5 @@ CONFIG += testcase parallel_test
 TARGET = tst_qtextboundaryfinder
 QT = core testlib
 SOURCES = tst_qtextboundaryfinder.cpp
-DEFINES += SRCDIR=\\\"$$PWD\\\"
 
-wince* {
-   addFiles.files = data
-   addFiles.path = .
-   DEPLOYMENT += addFiles
-}
+TESTDATA += data
index f2a356b..4cc1dc0 100644 (file)
@@ -69,7 +69,9 @@ private slots:
 void tst_QTextBoundaryFinder::init()
 {
 #ifndef Q_OS_IRIX
-    QDir::setCurrent(SRCDIR);
+    // chdir into the top-level data dir, then refer to our testdata using relative paths
+    QString testdata_dir = QFileInfo(QFINDTESTDATA("data")).absolutePath();
+    QVERIFY2(QDir::setCurrent(testdata_dir), qPrintable("Could not chdir to " + testdata_dir));
 #endif
 }
 
index f2534ca..0a739f0 100644 (file)
@@ -3,11 +3,4 @@ TARGET = tst_qxmlstream
 QT = core xml network testlib
 SOURCES = tst_qxmlstream.cpp
 
-wince* {
-    addFiles.files = data XML-Test-Suite
-    addFiles.path = .
-    DEPLOYMENT += addFiles
-    DEFINES += SRCDIR=\\\"\\\"
-} else {
-    DEFINES += SRCDIR=\\\"$$PWD/\\\"
-}
+TESTDATA += data XML-Test-Suite
index aeca426..1040a3e 100644 (file)
@@ -57,7 +57,7 @@
 
 Q_DECLARE_METATYPE(QXmlStreamReader::ReadElementTextBehaviour)
 
-static const char *const catalogFile = SRCDIR "XML-Test-Suite/xmlconf/finalCatalog.xml";
+static const char *const catalogFile = "XML-Test-Suite/xmlconf/finalCatalog.xml";
 static const int expectedRunCount = 1646;
 static const int expectedSkipCount = 532;
 
@@ -529,7 +529,7 @@ class tst_QXmlStream: public QObject
 {
     Q_OBJECT
 public:
-    tst_QXmlStream() : m_handler(QUrl::fromLocalFile(QLatin1String(catalogFile)))
+    tst_QXmlStream() : m_handler(QUrl::fromLocalFile(QFINDTESTDATA(catalogFile)))
     {
     }
 
@@ -581,7 +581,7 @@ private:
 
 void tst_QXmlStream::initTestCase()
 {
-    QFile file(QString::fromLatin1(catalogFile));
+    QFile file(QFINDTESTDATA(catalogFile));
     QVERIFY2(file.open(QIODevice::ReadOnly),
              qPrintable(QString::fromLatin1("Failed to open the test suite catalog; %1").arg(file.fileName())));
 
@@ -807,7 +807,7 @@ void tst_QXmlStream::testReader_data() const
     QTest::addColumn<QString>("xml");
     QTest::addColumn<QString>("ref");
     QDir dir;
-    dir.cd(SRCDIR "data/");
+    dir.cd(QFINDTESTDATA("data/"));
     foreach(QString filename , dir.entryList(QStringList() << "*.xml")) {
         QString reference =  QFileInfo(filename).baseName() + ".ref";
         QTest::newRow(dir.filePath(filename).toLatin1().data()) << dir.filePath(filename) << dir.filePath(reference);
@@ -1120,7 +1120,7 @@ void tst_QXmlStream::crashInUTF16Codec() const
     QEventLoop eventLoop;
 
     QNetworkAccessManager networkManager;
-    QNetworkRequest request(QUrl::fromLocalFile(QLatin1String(SRCDIR "data/051reduced.xml")));
+    QNetworkRequest request(QUrl::fromLocalFile(QFINDTESTDATA("data/051reduced.xml")));
     QNetworkReply *const reply = networkManager.get(request);
     eventLoop.connect(reply, SIGNAL(finished()), SLOT(quit()));