diff --git a/tests/auto/checkxmlfiles/checkxmlfiles.pro b/tests/auto/checkxmlfiles/checkxmlfiles.pro index c1adf1568d7c19bbcf3dc7d25c3e873a9d9c4462..62a72ddb9ae9ac7cc1f473cef630d907825afe95 100644 --- a/tests/auto/checkxmlfiles/checkxmlfiles.pro +++ b/tests/auto/checkxmlfiles/checkxmlfiles.pro @@ -16,4 +16,6 @@ addFiles.files = \ $$QT_SOURCE_TREE/examples/tools/undo/undo.qrc addFiles.path = xmlfiles DEPLOYMENT += addFiles +} else { + DEFINES += SOURCETREE=\\\"$$absolute_path(../../..)/\\\" } diff --git a/tests/auto/checkxmlfiles/tst_checkxmlfiles.cpp b/tests/auto/checkxmlfiles/tst_checkxmlfiles.cpp index 240cc628bf2f101bbad011b00b1269be16e0584b..1d9a08890336bd0eacc3243fe97401bb03bd7795 100644 --- a/tests/auto/checkxmlfiles/tst_checkxmlfiles.cpp +++ b/tests/auto/checkxmlfiles/tst_checkxmlfiles.cpp @@ -97,11 +97,11 @@ void tst_CheckXMLFiles::checkXMLFiles_data() const patterns.append(QLatin1String("*.xhtml")); #ifndef Q_OS_WINCE - QString path = QLatin1String("../../../"); + QString path = QLatin1String(SOURCETREE); #else - QString path = QLatin1String("xmlfiles"); + QString path = QFINDTESTDATA("xmlfiles"); #endif - QDirIterator it(inputFile(path), patterns, QDir::AllEntries, QDirIterator::Subdirectories); + QDirIterator it(path, patterns, QDir::AllEntries, QDirIterator::Subdirectories); while(it.hasNext()) { it.next(); diff --git a/tests/auto/patternistexamples/patternistexamples.pro b/tests/auto/patternistexamples/patternistexamples.pro index c36c1203ec4f4cebe16acdfcd6cd8bfa2f03b334..97c792a2ff81c84f683f98fbcd738bc2da823c15 100644 --- a/tests/auto/patternistexamples/patternistexamples.pro +++ b/tests/auto/patternistexamples/patternistexamples.pro @@ -19,5 +19,7 @@ wince*: { DEPLOYMENT += snippets widgetRen globVar filetree recipes files # take care of dependency QT += network +} else { + DEFINES += SOURCETREE=\\\"$$absolute_path(../../..)/\\\" } include (../xmlpatterns.pri) diff --git a/tests/auto/patternistexamples/tst_patternistexamples.cpp b/tests/auto/patternistexamples/tst_patternistexamples.cpp index 3ae263b18236dcfd301d16f6b5a9a54705ba96e8..8d0c46d786ff89d40a031458c626bbf67d0fde1d 100644 --- a/tests/auto/patternistexamples/tst_patternistexamples.cpp +++ b/tests/auto/patternistexamples/tst_patternistexamples.cpp @@ -82,17 +82,17 @@ private: void tst_PatternistExamples::initTestCase() { #ifndef Q_OS_WINCE - m_dirs.append(QDir(QLatin1String("../../../doc/src/snippets/patternist/"))); - m_dirs.append(QDir(QLatin1String("../../../examples/xmlpatterns/xquery/globalVariables/"))); - m_dirs.append(QDir(QLatin1String("../../../examples/xmlpatterns/filetree/"))); - m_dirs.append(QDir(QLatin1String("../../../examples/xmlpatterns/recipes/"))); - m_dirs.append(QDir(QLatin1String("../../../examples/xmlpatterns/recipes/files/"))); + m_dirs.append(QDir(QLatin1String(SOURCETREE "doc/src/snippets/patternist/"))); + m_dirs.append(QDir(QLatin1String(SOURCETREE "examples/xmlpatterns/xquery/globalVariables/"))); + m_dirs.append(QDir(QLatin1String(SOURCETREE "examples/xmlpatterns/filetree/"))); + m_dirs.append(QDir(QLatin1String(SOURCETREE "examples/xmlpatterns/recipes/"))); + m_dirs.append(QDir(QLatin1String(SOURCETREE "examples/xmlpatterns/recipes/files/"))); #else - m_dirs.append(QDir(QLatin1String("patternist/"))); - m_dirs.append(QDir(QLatin1String("globalVariables/"))); - m_dirs.append(QDir(QLatin1String("filetree/"))); - m_dirs.append(QDir(QLatin1String("recipes/"))); - m_dirs.append(QDir(QLatin1String("recipes/files/"))); + m_dirs.append(QDir(QFINDTESTDATA("patternist/"))); + m_dirs.append(QDir(QFINDTESTDATA("globalVariables/"))); + m_dirs.append(QDir(QFINDTESTDATA("filetree/"))); + m_dirs.append(QDir(QFINDTESTDATA("recipes/"))); + m_dirs.append(QDir(QFINDTESTDATA("recipes/files/"))); #endif for(int i = 0; i < m_dirs.size(); ++i) QVERIFY(m_dirs.at(i).exists()); diff --git a/tests/auto/qxmlformatter/tst_qxmlformatter.cpp b/tests/auto/qxmlformatter/tst_qxmlformatter.cpp index 231455dde902db7c8b94776559cec2f2d51a7a2a..9ec0e4e16c4146d77a012dec6d9e9c7c7420e57f 100644 --- a/tests/auto/qxmlformatter/tst_qxmlformatter.cpp +++ b/tests/auto/qxmlformatter/tst_qxmlformatter.cpp @@ -139,7 +139,7 @@ void tst_QXmlFormatter::format() { QFETCH(QString, testName); - const QString location(QLatin1String("input/") + testName); + const QString location(QFINDTESTDATA("input/") + testName); QFile queryFile(location); QVERIFY(queryFile.open(QIODevice::ReadOnly)); @@ -154,7 +154,7 @@ void tst_QXmlFormatter::format() QVERIFY(query.evaluateTo(&formatter)); - QFile expectedFile(QLatin1String("baselines/") + testName.left(testName.length() - 2) + QString::fromLatin1("xml")); + QFile expectedFile(QFINDTESTDATA("baselines/") + testName.left(testName.length() - 2) + QString::fromLatin1("xml")); if(expectedFile.exists()) { @@ -178,7 +178,7 @@ void tst_QXmlFormatter::format_data() const QTest::addColumn<QString>("testName"); QDir dir; - dir.cd(QLatin1String("input")); + dir.cd(QFINDTESTDATA("input")); const QStringList entries(dir.entryList(QStringList(QLatin1String("*.xq")))); for(int i = 0; i < entries.count(); ++i) diff --git a/tests/auto/qxmlquery/qxmlquery.pro b/tests/auto/qxmlquery/qxmlquery.pro index 392a5884d2a63aa79469d5a30acf1ff51afaa11c..7dca9b923459d880c760a286a4419fe3eab21811 100644 --- a/tests/auto/qxmlquery/qxmlquery.pro +++ b/tests/auto/qxmlquery/qxmlquery.pro @@ -13,12 +13,6 @@ QT += network testlib TESTDATA = data/* pushBaselines/* input.xml -wince* { - DEFINES += SRCDIR=\\\"./\\\" -} else { - DEFINES += SRCDIR=\\\"$$PWD/\\\" -} - include (../xmlpatterns.pri) wince*: { diff --git a/tests/auto/qxmlquery/tst_qxmlquery.cpp b/tests/auto/qxmlquery/tst_qxmlquery.cpp index ea1da1179aeb350b633bee626e787337c2fca3ae..c8d911067e3e782ed34bf26202cfe1bb2456838e 100644 --- a/tests/auto/qxmlquery/tst_qxmlquery.cpp +++ b/tests/auto/qxmlquery/tst_qxmlquery.cpp @@ -744,7 +744,7 @@ void tst_QXmlQuery::bindVariableQStringQIODeviceWithString() const void tst_QXmlQuery::bindVariableQStringQIODeviceWithQFile() const { QXmlQuery query; - QFile inDevice(QLatin1String(SRCDIR "input.xml")); + QFile inDevice(QFINDTESTDATA("input.xml")); QVERIFY(inDevice.open(QIODevice::ReadOnly)); @@ -967,7 +967,7 @@ void tst_QXmlQuery::evaluateToReceiver() QVERIFY(push.isValid()); query.evaluateTo(&push); - const QString baselineName(inputFile(QLatin1String(SRCDIR "pushBaselines/") + inputQuery.left(inputQuery.length() - 2) + QString::fromLatin1("ref"))); + const QString baselineName(QFINDTESTDATA("pushBaselines/") + inputQuery.left(inputQuery.length() - 2) + QString::fromLatin1("ref")); QFile baseline(baselineName); if(baseline.exists()) @@ -2030,7 +2030,7 @@ void tst_QXmlQuery::fnDocNetworkAccessSuccess_data() const QTest::addColumn<QByteArray>("expectedOutput"); QTest::newRow("file scheme") - << inputFileAsURI(QLatin1String(SRCDIR "input.xml")) + << inputFileAsURI(QFINDTESTDATA("input.xml")) << QByteArray("<!-- This is just a file for testing. --><input/>"); QTest::newRow("data scheme with ASCII") diff --git a/tests/auto/xmlpatterns/tst_xmlpatterns.cpp b/tests/auto/xmlpatterns/tst_xmlpatterns.cpp index 29efbe476a98f45849315a8ee637b8f7fbfadced..e723d1d39441908537ef8aff70588f2266730b51 100644 --- a/tests/auto/xmlpatterns/tst_xmlpatterns.cpp +++ b/tests/auto/xmlpatterns/tst_xmlpatterns.cpp @@ -161,9 +161,9 @@ void tst_XmlPatterns::xquerySupport() // convert Windows line endings to Unix ones fixedStderr.replace("\r\n", "\n"); - const QString errorFileName(inputFile(QLatin1String(SRCDIR "stderrBaselines/") + - QString::fromUtf8(QTest::currentDataTag()).remove(m_normalizeTestName) + - QLatin1String(".txt"))); + const QString errorFileName(QFINDTESTDATA("stderrBaselines/") + + QString::fromUtf8(QTest::currentDataTag()).remove(m_normalizeTestName) + + QLatin1String(".txt")); QFile writeErr(errorFileName); @@ -227,8 +227,10 @@ void tst_XmlPatterns::xquerySupport_data() const return; #endif + QString path = QFINDTESTDATA("queries/"); + /* Check one file for existence, to avoid possible false positives. */ - QVERIFY(QFile::exists(inputFile(QLatin1String(SRCDIR "queries/onePlusOne.xq")))); + QVERIFY(QFile::exists(path + QLatin1String("onePlusOne.xq"))); QTest::addColumn<int>("expectedExitCode"); QTest::addColumn<QByteArray>("expectedQueryOutput"); @@ -239,21 +241,21 @@ void tst_XmlPatterns::xquerySupport_data() const QTest::newRow("A simple math query") << 0 << QByteArray("2\n") - << QStringList((QLatin1String(SRCDIR "queries/onePlusOne.xq"))) + << QStringList((path + QLatin1String("onePlusOne.xq"))) << QString() << QString(); QTest::newRow("An unbound external variable") << 2 << QByteArray() - << QStringList(QLatin1String(SRCDIR "queries/externalVariable.xq")) + << QStringList(path + QLatin1String("externalVariable.xq")) << QString() << QString(); QTest::newRow("Bind an external variable") << 0 << QByteArray("1 4<e>1</e>true\n") - << (QStringList() << QLatin1String(SRCDIR "queries/externalVariable.xq") + << (QStringList() << path + QLatin1String("externalVariable.xq") << QLatin1String("-param") << QLatin1String("externalVariable=1")) << QString() @@ -264,21 +266,21 @@ void tst_XmlPatterns::xquerySupport_data() const << QByteArray("1 4<e>1</e>true\n") << (QStringList() << QLatin1String("-param") << QLatin1String("externalVariable=1") - << QLatin1String(SRCDIR "queries/externalVariable.xq")) + << path + QLatin1String("externalVariable.xq")) << QString() << QString(); QTest::newRow("Use fn:doc") << 0 << QByteArray("<e xmlns=\"http://example.com\" xmlns:p=\"http://example.com/P\" attr=\"1\" p:attr=\"\">\n <?target data?>\n <!-- a comment -->\n <e/>text <f/>text node</e>\n") - << QStringList(QLatin1String(SRCDIR "queries/openDocument.xq")) + << QStringList(path + QLatin1String("openDocument.xq")) << QString() << QString(); QTest::newRow("Use fn:doc, together with -no-format, last") << 0 << QByteArray("<e xmlns=\"http://example.com\" xmlns:p=\"http://example.com/P\" attr=\"1\" p:attr=\"\"><?target data?><!-- a comment --><e/>text <f/>text node</e>") - << (QStringList() << QLatin1String(SRCDIR "queries/openDocument.xq") + << (QStringList() << path + QLatin1String("openDocument.xq") << QLatin1String("-no-format")) << QString() << QString(); @@ -287,7 +289,7 @@ void tst_XmlPatterns::xquerySupport_data() const << 0 << QByteArray("<e xmlns=\"http://example.com\" xmlns:p=\"http://example.com/P\" attr=\"1\" p:attr=\"\"><?target data?><!-- a comment --><e/>text <f/>text node</e>") << (QStringList() << QLatin1String("-no-format") - << QLatin1String(SRCDIR "queries/openDocument.xq")) + << path + QLatin1String("openDocument.xq")) << QString() << QString(); @@ -295,28 +297,28 @@ void tst_XmlPatterns::xquerySupport_data() const QTest::newRow("Make sure query paths are resolved against CWD, not the location of the executable.") << 0 << QByteArray("2\n") - << QStringList(QLatin1String(SRCDIR "queries/onePlusOne.xq")) - << QString::fromLatin1("queries") + << QStringList(QFINDTESTDATA("queries/onePlusOne.xq")) + << QFINDTESTDATA("queries") << QString(); QTest::newRow("Call fn:error()") << 2 << QByteArray() - << QStringList(QLatin1String(SRCDIR "queries/errorFunction.xq")) + << QStringList(path + QLatin1String("errorFunction.xq")) << QString() << QString(); QTest::newRow("Evaluate a library module") << 2 << QByteArray() - << QStringList(QLatin1String(SRCDIR "queries/simpleLibraryModule.xq")) + << QStringList(path + QLatin1String("simpleLibraryModule.xq")) << QString() << QString(); QTest::newRow("Trigger a static error.") << 2 << QByteArray() - << QStringList(QLatin1String(SRCDIR "queries/staticError.xq")) + << QStringList(path + QLatin1String("staticError.xq")) << QString() << QString(); @@ -330,7 +332,7 @@ void tst_XmlPatterns::xquerySupport_data() const QTest::newRow("Open an nonexistent file") << 2 << QByteArray() - << QStringList(QLatin1String(SRCDIR "queries/ThisFileDoesNotExist.xq")) + << QStringList(path + QLatin1String("ThisFileDoesNotExist.xq")) << QString() << QString(); @@ -339,63 +341,63 @@ void tst_XmlPatterns::xquerySupport_data() const QTest::newRow("XQuery-function message markups") << 2 << QByteArray() - << QStringList(QLatin1String(SRCDIR "queries/wrongArity.xq")) + << QStringList(path + QLatin1String("wrongArity.xq")) << QString() << QString(); QTest::newRow("XQuery-type message markups") << 2 << QByteArray() - << QStringList(QLatin1String(SRCDIR "queries/typeError.xq")) + << QStringList(path + QLatin1String("typeError.xq")) << QString() << QString(); QTest::newRow("XQuery-data & XQuery-keyword message markups") << 2 << QByteArray() - << QStringList(QLatin1String(SRCDIR "queries/zeroDivision.xq")) + << QStringList(path + QLatin1String("zeroDivision.xq")) << QString() << QString(); QTest::newRow("XQuery-uri message markups") << 2 << QByteArray() - << QStringList(QLatin1String(SRCDIR "queries/unsupportedCollation.xq")) + << QStringList(path + QLatin1String("unsupportedCollation.xq")) << QString() << QString(); QTest::newRow("XQuery-expression message markups") << 2 << QByteArray() - << QStringList(QLatin1String(SRCDIR "queries/invalidRegexp.xq")) + << QStringList(path + QLatin1String("invalidRegexp.xq")) << QString() << QString(); QTest::newRow("Print a list of available regexp flags(The available flags are formatted in a complex way.)") << 2 << QByteArray() - << QStringList(QLatin1String(SRCDIR "queries/invalidRegexpFlag.xq")) + << QStringList(path + QLatin1String("invalidRegexpFlag.xq")) << QString() << QString(); QTest::newRow("Trigger an assert in QPatternist::ColorOutput. The query naturally contains an error; XPTY0004.") << 2 << QByteArray() - << QStringList(QLatin1String(SRCDIR "queries/flwor.xq")) + << QStringList(path + QLatin1String("flwor.xq")) << QString() << QString(); QTest::newRow("Trigger a second assert in QPatternist::ColorOutput. The query naturally contains XPST0003.") << 2 << QByteArray() - << QStringList(QLatin1String(SRCDIR "queries/syntaxError.xq")) + << QStringList(path + QLatin1String("syntaxError.xq")) << QString() << QString(); QTest::newRow("-param is missing so multiple queries appear") << 2 << QByteArray() - << (QStringList() << QLatin1String(SRCDIR "queries/reportGlobals.xq") + << (QStringList() << path + QLatin1String("reportGlobals.xq") << QLatin1String("fileToOpen=globals.gccxml")) << QString() << QString(); @@ -410,7 +412,7 @@ void tst_XmlPatterns::xquerySupport_data() const QTest::newRow("Basic use of -output, query first") << 0 << QByteArray("2\n") - << (QStringList() << QLatin1String(SRCDIR "queries/onePlusOne.xq") + << (QStringList() << path + QLatin1String("onePlusOne.xq") << QLatin1String("-output") << QLatin1String("basicOutput.out")) << QString() @@ -421,22 +423,22 @@ void tst_XmlPatterns::xquerySupport_data() const << QByteArray("<e/>\n") << (QStringList() << QLatin1String("-output") << QLatin1String("basicOutput2.out") - << QLatin1String(SRCDIR "queries/oneElement.xq")) + << path + QLatin1String("oneElement.xq")) << QString() << QString::fromLatin1("basicOutput2.out"); QTest::newRow("A single query, that does not exist") << 2 << QByteArray() - << (QStringList() << QLatin1String(SRCDIR "doesNotExist.xq")) + << (QStringList() << path + QLatin1String("doesNotExist.xq")) << QString() << QString(); QTest::newRow("Specify two identical query names") << 2 << QByteArray() - << (QStringList() << QLatin1String(SRCDIR "query.xq") - << QLatin1String(SRCDIR "query.xq")) + << (QStringList() << path + QLatin1String("query.xq") + << path + QLatin1String("query.xq")) << QString() << QString(); @@ -466,7 +468,7 @@ void tst_XmlPatterns::xquerySupport_data() const << QByteArray() << (QStringList() << QLatin1String("-output") << filename - << QLatin1String(SRCDIR "queries/onePlusOne.xq")) + << path + QLatin1String("onePlusOne.xq")) << QString() << filename; } @@ -483,7 +485,7 @@ void tst_XmlPatterns::xquerySupport_data() const << QByteArray("2\n") << (QStringList() << QLatin1String("-output") << outName - << QLatin1String(SRCDIR "queries/onePlusOne.xq")) + << path + QLatin1String("onePlusOne.xq")) << QString() << outName; } @@ -491,7 +493,7 @@ void tst_XmlPatterns::xquerySupport_data() const QTest::newRow("one query, and a terminating dash at the end") << 0 << QByteArray("2\n") - << (QStringList() << QLatin1String(SRCDIR "queries/onePlusOne.xq") + << (QStringList() << path + QLatin1String("onePlusOne.xq") << QLatin1String("-")) << QString() << QString(); @@ -500,7 +502,7 @@ void tst_XmlPatterns::xquerySupport_data() const << 0 << QByteArray("2\n") << (QStringList() << QLatin1String("-") - << QLatin1String(SRCDIR "queries/onePlusOne.xq")) + << path + QLatin1String("onePlusOne.xq")) << QString() << QString(); @@ -587,21 +589,21 @@ void tst_XmlPatterns::xquerySupport_data() const QTest::newRow("Run a query which evaluates to the empty sequence.") << 0 << QByteArray("\n") - << (QStringList() << QLatin1String(SRCDIR "queries/emptySequence.xq")) + << (QStringList() << path + QLatin1String("emptySequence.xq")) << QString() << QString(); QTest::newRow("Run a query which evaluates to a single document node with no children.") << 0 << QByteArray("\n") - << (QStringList() << QLatin1String(SRCDIR "queries/onlyDocumentNode.xq")) + << (QStringList() << path + QLatin1String("onlyDocumentNode.xq")) << QString() << QString(); QTest::newRow("Invoke with invalid -param value.") << 1 << QByteArray() - << (QStringList() << QLatin1String(SRCDIR "queries/externalVariable.xq") + << (QStringList() << path + QLatin1String("externalVariable.xq") << QLatin1String("-param") << QLatin1String("EqualSignIsMissing")) << QString() @@ -610,7 +612,7 @@ void tst_XmlPatterns::xquerySupport_data() const QTest::newRow("Invoke with colon in variable name.") << 1 << QByteArray() - << (QStringList() << QLatin1String(SRCDIR "queries/externalVariable.xq") + << (QStringList() << path + QLatin1String("externalVariable.xq") << QLatin1String("-param") << QLatin1String("xs:name=value")) << QString() @@ -619,7 +621,7 @@ void tst_XmlPatterns::xquerySupport_data() const QTest::newRow("Invoke with missing name in -param arg.") << 1 << QByteArray() - << (QStringList() << QLatin1String(SRCDIR "queries/externalVariable.xq") + << (QStringList() << path + QLatin1String("externalVariable.xq") << QLatin1String("-param") << QLatin1String("=value")) << QString() @@ -628,7 +630,7 @@ void tst_XmlPatterns::xquerySupport_data() const QTest::newRow("Invoke with -param that has two adjacent equal signs.") << 0 << QByteArray("START =text END\n") - << (QStringList() << QLatin1String(SRCDIR "queries/externalStringVariable.xq") + << (QStringList() << path + QLatin1String("externalStringVariable.xq") << QLatin1String("-param") << QLatin1String("externalString==text")) << QString() @@ -637,7 +639,7 @@ void tst_XmlPatterns::xquerySupport_data() const QTest::newRow("Pass in an external variable, but the query doesn't use it.") << 0 << QByteArray("2\n") - << (QStringList() << QLatin1String(SRCDIR "queries/onePlusOne.xq") + << (QStringList() << path + QLatin1String("onePlusOne.xq") << QLatin1String("-param") << QLatin1String("externalString==text")) << QString() @@ -647,7 +649,7 @@ void tst_XmlPatterns::xquerySupport_data() const QTest::newRow("Invoke with -param that has no value.") << 0 << QByteArray("START END\n") - << (QStringList() << QLatin1String(SRCDIR "queries/externalStringVariable.xq") + << (QStringList() << path + QLatin1String("externalStringVariable.xq") << QLatin1String("-param") << QLatin1String("externalString=")) << QString() @@ -663,7 +665,7 @@ void tst_XmlPatterns::xquerySupport_data() const QTest::newRow("Use a native path") << 0 << QByteArray("2\n") - << (QStringList() << QDir::toNativeSeparators(QLatin1String(SRCDIR "queries/onePlusOne.xq"))) + << (QStringList() << QDir::toNativeSeparators(path + QLatin1String("onePlusOne.xq"))) << QString() << QString(); @@ -678,8 +680,8 @@ void tst_XmlPatterns::xquerySupport_data() const QTest::newRow("A valid, existing query, followed by a bogus one") << 1 << QByteArray() - << (QStringList() << QLatin1String(SRCDIR "queries/onePlusOne.xq") - << QLatin1String(SRCDIR "doesNotExist.xq")) + << (QStringList() << path + QLatin1String("onePlusOne.xq") + << path + QLatin1String("doesNotExist.xq")) << QString() << QString(); */ @@ -688,8 +690,8 @@ void tst_XmlPatterns::xquerySupport_data() const QTest::newRow("Specify two different query names") << 1 << QByteArray() - << (QStringList() << QLatin1String(SRCDIR "query1.xq") - << QLatin1String(SRCDIR "query2.xq")) + << (QStringList() << path + QLatin1String("query1.xq") + << path + QLatin1String("query2.xq")) << QString() << QString(); */ @@ -703,7 +705,7 @@ void tst_XmlPatterns::xquerySupport_data() const QTest::newRow("Use -param twice") << 0 << QByteArray("param1 param2\n") - << (QStringList() << QLatin1String(SRCDIR "queries/twoVariables.xq") + << (QStringList() << path + QLatin1String("twoVariables.xq") << QLatin1String("-param") << QLatin1String("var1=param1") << QLatin1String("-param") @@ -714,7 +716,7 @@ void tst_XmlPatterns::xquerySupport_data() const QTest::newRow("Use -param thrice") << 0 << QByteArray("param1 param2 third\n") - << (QStringList() << QLatin1String(SRCDIR "queries/threeVariables.xq") + << (QStringList() << path + QLatin1String("threeVariables.xq") << QLatin1String("-param") << QLatin1String("var1=param1") << QLatin1String("-param") @@ -727,7 +729,7 @@ void tst_XmlPatterns::xquerySupport_data() const QTest::newRow("Specify the same parameter twice, different values") << 1 << QByteArray() - << (QStringList() << QLatin1String(SRCDIR "queries/onePlusOne.xq") + << (QStringList() << path + QLatin1String("onePlusOne.xq") << QLatin1String("-param") << QLatin1String("duplicated=param1") << QLatin1String("-param") @@ -738,7 +740,7 @@ void tst_XmlPatterns::xquerySupport_data() const QTest::newRow("Specify the same parameter twice, same values") << 1 << QByteArray() - << (QStringList() << QLatin1String(SRCDIR "queries/onePlusOne.xq") + << (QStringList() << path + QLatin1String("onePlusOne.xq") << QLatin1String("-param") << QLatin1String("duplicated=param1") << QLatin1String("-param") @@ -749,7 +751,7 @@ void tst_XmlPatterns::xquerySupport_data() const QTest::newRow("Open a non-existing collection.") << 2 << QByteArray() - << (QStringList() << QLatin1String(SRCDIR "queries/nonexistingCollection.xq")) + << (QStringList() << path + QLatin1String("nonexistingCollection.xq")) << QString() << QString(); @@ -811,7 +813,7 @@ void tst_XmlPatterns::stdoutFailure() const //process.setStandardOutputFile(outName); process.setWorkingDirectory(QDir::current().absoluteFilePath(QString())); - process.start(m_command, QStringList(SRCDIR "queries/onePlusOne.xq")); + process.start(m_command, QStringList(QFINDTESTDATA("queries/onePlusOne.xq"))); QCOMPARE(process.exitStatus(), QProcess::NormalExit); QVERIFY(process.waitForFinished()); @@ -856,6 +858,9 @@ void tst_XmlPatterns::xsltSupport_data() const QSKIP("WinCE: This test uses unsupported WinCE functionality"); #endif + QString spath = QFINDTESTDATA("stylesheets/"); + QString qpath = QFINDTESTDATA("queries/"); + QTest::addColumn<int>("expectedExitCode"); QTest::addColumn<QByteArray>("expectedQueryOutput"); QTest::addColumn<QStringList>("arguments"); @@ -872,8 +877,8 @@ void tst_XmlPatterns::xsltSupport_data() const QTest::newRow("Pass in a stylesheet file which contains an XQuery query") << 2 << QByteArray() - << (QStringList() << QLatin1String(SRCDIR "stylesheets/queryAsStylesheet.xsl") - << QLatin1String(SRCDIR "queries/simpleDocument.xml")) + << (QStringList() << spath + QLatin1String("queryAsStylesheet.xsl") + << qpath + QLatin1String("simpleDocument.xml")) << QString() << QString(); @@ -890,7 +895,7 @@ void tst_XmlPatterns::xsltSupport_data() const << QByteArray() << (QStringList() << QLatin1String("-initial-template") << QLatin1String("name") - << QLatin1String(SRCDIR "queries/onePlusOne.xq")) + << qpath + QLatin1String("onePlusOne.xq")) << QString() << QString(); @@ -925,8 +930,8 @@ void tst_XmlPatterns::xsltSupport_data() const << (QStringList() << QLatin1String("-no-format") << QLatin1String("-initial-template") << QLatin1String("main") - << QLatin1String(SRCDIR "stylesheets/namedAndRootTemplate.xsl") - << QLatin1String(SRCDIR "stylesheets/documentElement.xml")) + << spath + QLatin1String("namedAndRootTemplate.xsl") + << spath + QLatin1String("documentElement.xml")) << QString() << QString(); @@ -936,8 +941,8 @@ void tst_XmlPatterns::xsltSupport_data() const << (QStringList() << QLatin1String("-no-format") << QLatin1String("-initial-template") << QLatin1String("no-template-by-this-name") - << QLatin1String(SRCDIR "stylesheets/namedAndRootTemplate.xsl") - << QLatin1String(SRCDIR "stylesheets/documentElement.xml")) + << spath + QLatin1String("namedAndRootTemplate.xsl") + << spath + QLatin1String("documentElement.xml")) << QString() << QString(); @@ -947,7 +952,7 @@ void tst_XmlPatterns::xsltSupport_data() const << (QStringList() << QLatin1String("-no-format") << QLatin1String("-initial-template") << QLatin1String("main") - << QLatin1String(SRCDIR "stylesheets/namedAndRootTemplate.xsl")) + << spath + QLatin1String("namedAndRootTemplate.xsl")) << QString() << QString(); @@ -957,7 +962,7 @@ void tst_XmlPatterns::xsltSupport_data() const << (QStringList() << QLatin1String("-no-format") << QLatin1String("-initial-template") << QLatin1String("{http://example.com/NS}main") - << QLatin1String(SRCDIR "stylesheets/namedAndRootTemplate.xsl")) + << spath + QLatin1String("namedAndRootTemplate.xsl")) << QString() << QString(); @@ -966,7 +971,7 @@ void tst_XmlPatterns::xsltSupport_data() const << QByteArray("defParam overridedDefaultedParam implicitlyRequiredValue\n") << (QStringList() << QLatin1String("-initial-template") << QLatin1String("main") - << QLatin1String(SRCDIR "stylesheets/useParameters.xsl") + << spath + QLatin1String("useParameters.xsl") << QLatin1String("-param") << QLatin1String("overridedDefaultedParam=overridedDefaultedParam") << QLatin1String("-param") @@ -977,24 +982,24 @@ void tst_XmlPatterns::xsltSupport_data() const QTest::newRow("Use a simplified stylesheet module") << 0 << QByteArray("<output>some text</output>\n") - << (QStringList() << QLatin1String(SRCDIR "stylesheets/simplifiedStylesheetModule.xsl") - << QLatin1String(SRCDIR "stylesheets/simplifiedStylesheetModule.xml")) + << (QStringList() << spath + QLatin1String("simplifiedStylesheetModule.xsl") + << spath + QLatin1String("simplifiedStylesheetModule.xml")) << QString() << QString(); QTest::newRow("Not well-formed stylesheet, causes crash in coloring code.") << 2 << QByteArray() - << (QStringList() << QLatin1String(SRCDIR "stylesheets/notWellformed.xsl") - << QLatin1String(SRCDIR "queries/simpleDocument.xml")) + << (QStringList() << spath + QLatin1String("notWellformed.xsl") + << qpath + QLatin1String("simpleDocument.xml")) << QString() << QString(); QTest::newRow("Not well-formed instance document, causes crash in coloring code.") << 2 << QByteArray() - << (QStringList() << QLatin1String(SRCDIR "stylesheets/bool070.xsl") - << QLatin1String(SRCDIR "stylesheets/bool070.xml")) + << (QStringList() << spath + QLatin1String("bool070.xsl") + << spath + QLatin1String("bool070.xml")) << QString() << QString(); diff --git a/tests/auto/xmlpatterns/xmlpatterns.pro b/tests/auto/xmlpatterns/xmlpatterns.pro index a775c2e447709727b8cc76c92e58ccaf0ef6c2cc..64aa7941c0bc22609254aa6111afaa07fe5d3eac 100644 --- a/tests/auto/xmlpatterns/xmlpatterns.pro +++ b/tests/auto/xmlpatterns/xmlpatterns.pro @@ -4,10 +4,4 @@ QT += network testlib SOURCES += tst_xmlpatterns.cpp \ ../qxmlquery/TestFundament.cpp -wince* { -DEFINES += SRCDIR=\\\"./\\\" -} else { -DEFINES += SRCDIR=\\\"$$PWD/\\\" -} - include (../xmlpatterns.pri) diff --git a/tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp b/tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp index f8a286aadaf2e9fdee76e4b78458681efd4c45e8..e994b9e1edcc14089128f6315bcf6cb9d10bbbec 100644 --- a/tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp +++ b/tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp @@ -127,6 +127,11 @@ void tst_XmlPatternsValidator::xsdSupport_data() const return; #endif + QString path = QFINDTESTDATA("files/"); + + /* Check one file for existence, to avoid a flood of failures. */ + QVERIFY(QFile::exists(path + QLatin1String("instance.xml"))); + QTest::addColumn<int>("expectedExitCode"); QTest::addColumn<QStringList>("arguments"); QTest::addColumn<QString>("cwd"); @@ -138,90 +143,90 @@ void tst_XmlPatternsValidator::xsdSupport_data() const QTest::newRow("A valid schema") << 0 - << QStringList(QLatin1String("files/valid_schema.xsd")) + << QStringList(path + QLatin1String("valid_schema.xsd")) << QString(); QTest::newRow("An invalid schema") << 1 - << QStringList(QLatin1String("files/invalid_schema.xsd")) + << QStringList(path + QLatin1String("invalid_schema.xsd")) << QString(); QTest::newRow("An instance and valid schema") << 0 - << (QStringList() << QLatin1String("files/instance.xml") - << QLatin1String("files/valid_schema.xsd")) + << (QStringList() << path + QLatin1String("instance.xml") + << path + QLatin1String("valid_schema.xsd")) << QString(); QTest::newRow("An instance and invalid schema") << 1 - << (QStringList() << QLatin1String("files/instance.xml") - << QLatin1String("files/invalid_schema.xsd")) + << (QStringList() << path + QLatin1String("instance.xml") + << path + QLatin1String("invalid_schema.xsd")) << QString(); QTest::newRow("An instance and not matching schema") << 1 - << (QStringList() << QLatin1String("files/instance.xml") - << QLatin1String("files/other_valid_schema.xsd")) + << (QStringList() << path + QLatin1String("instance.xml") + << path + QLatin1String("other_valid_schema.xsd")) << QString(); QTest::newRow("Two instance documents") << 1 - << (QStringList() << QLatin1String("files/instance.xml") - << QLatin1String("files/instance.xml")) + << (QStringList() << path + QLatin1String("instance.xml") + << path + QLatin1String("instance.xml")) << QString(); QTest::newRow("Three instance documents") << 2 - << (QStringList() << QLatin1String("files/instance.xml") - << QLatin1String("files/instance.xml") - << QLatin1String("files/instance.xml")) + << (QStringList() << path + QLatin1String("instance.xml") + << path + QLatin1String("instance.xml") + << path + QLatin1String("instance.xml")) << QString(); QTest::newRow("Two schema documents") << 1 - << (QStringList() << QLatin1String("files/valid_schema.xsd") - << QLatin1String("files/valid_schema.xsd")) + << (QStringList() << path + QLatin1String("valid_schema.xsd") + << path + QLatin1String("valid_schema.xsd")) << QString(); QTest::newRow("A schema aware valid instance document") << 0 - << (QStringList() << QLatin1String("files/sa_valid_instance.xml")) + << (QStringList() << path + QLatin1String("sa_valid_instance.xml")) << QString(); QTest::newRow("A schema aware invalid instance document") << 1 - << (QStringList() << QLatin1String("files/sa_invalid_instance.xml")) + << (QStringList() << path + QLatin1String("sa_invalid_instance.xml")) << QString(); QTest::newRow("A non-schema aware instance document") << 1 - << (QStringList() << QLatin1String("files/instance.xml")) + << (QStringList() << path + QLatin1String("instance.xml")) << QString(); QTest::newRow("QTBUG-8394 A schema with an indirectly included type") << 0 - << (QStringList() << QLatin1String("files/indirect-include-a.xsd")) + << (QStringList() << path + QLatin1String("indirect-include-a.xsd")) << QString(); QTest::newRow("QTBUG-8394 A schema with an indirectly imported type") << 0 - << (QStringList() << QLatin1String("files/indirect-import-a.xsd")) + << (QStringList() << path + QLatin1String("indirect-import-a.xsd")) << QString(); QTest::newRow("QTBUG-8394 A schema with an indirectly redefined type") << 0 - << (QStringList() << QLatin1String("files/indirect-redefine-a.xsd")) + << (QStringList() << path + QLatin1String("indirect-redefine-a.xsd")) << QString(); QTest::newRow("QTBUG-8920 A schema with a complex type that indirectly includes an anonymous type") << 0 - << (QStringList() << QLatin1String("files/complex-type-including-anonymous-type.xsd")) + << (QStringList() << path + QLatin1String("complex-type-including-anonymous-type.xsd")) << QString(); QTest::newRow("QTBUG-11559 A schema and instance with a dateTime containing microseconds") << 0 - << (QStringList() << QLatin1String("files/dateTime-with-microseconds.xml") - << QLatin1String("files/dateTime-with-microseconds.xsd")) + << (QStringList() << path + QLatin1String("dateTime-with-microseconds.xml") + << path + QLatin1String("dateTime-with-microseconds.xsd")) << QString(); } diff --git a/tests/auto/xmlpatternsxqts/tst_suitetest.cpp b/tests/auto/xmlpatternsxqts/tst_suitetest.cpp index 9756389bab96223077409ff22d347f39dabac593..f61546fce5d6c1120471ba0fabfe03ff2fbe4977 100644 --- a/tests/auto/xmlpatternsxqts/tst_suitetest.cpp +++ b/tests/auto/xmlpatternsxqts/tst_suitetest.cpp @@ -54,8 +54,8 @@ using namespace QPatternistSDK; tst_SuiteTest::tst_SuiteTest(const SuiteType suiteType, - const bool alwaysRun) : m_existingBaseline(inputFile(QLatin1String("Baseline.xml"))) - , m_candidateBaseline(inputFile(QLatin1String("CandidateBaseline.xml"))) + const bool alwaysRun) : m_existingBaseline(QFINDTESTDATA("Baseline.xml")) + , m_candidateBaseline(QDir::current().filePath("CandidateBaseline.xml")) , m_abortRun(!alwaysRun && !QFile::exists(QLatin1String("runTests"))) , m_suiteType(suiteType) { diff --git a/tests/auto/xmlpatternsxqts/tst_xmlpatternsxqts.cpp b/tests/auto/xmlpatternsxqts/tst_xmlpatternsxqts.cpp index b758a5e2047026d77e9bc80c228cad411ce2317a..71040dd606c3d3c2b1277327f7fdb66d853d7d95 100644 --- a/tests/auto/xmlpatternsxqts/tst_xmlpatternsxqts.cpp +++ b/tests/auto/xmlpatternsxqts/tst_xmlpatternsxqts.cpp @@ -67,7 +67,7 @@ void tst_XmlPatternsXQTS::catalogPath(QString &write) const if(dontRun()) QSKIP("This test takes too long time to run on the majority of platforms."); - write = QLatin1String("TESTSUITE/XQTSCatalog.xml"); + write = QFINDTESTDATA("TESTSUITE/XQTSCatalog.xml"); return; }