diff options
author | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2011-12-21 16:54:05 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-12-22 10:50:32 +0100 |
commit | d8370adf6bed002f53692f36db8e47f3a8fb7555 (patch) | |
tree | 7984c400d6cf62a52cc422e6d32b63125846dbea /tests/auto/xmlpatternsdiagnosticsts | |
parent | bfac7b0e29198e537a57991b517080fe4ac5f23f (diff) | |
download | qtxmlpatterns-d8370adf6bed002f53692f36db8e47f3a8fb7555.tar.gz |
QtXmlPatterns-test: Use QFINDTESTDATA to locate test data.
Introduce QFINDTESTDATA and set the current directory
of the process to the test directory such that it works
indepently of the working directory of executable location.
Change-Id: I8105ba0fa7d9da7ff920d10f3a083433e2590e9f
Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Honglei Zhang <honglei.zhang@nokia.com>
Diffstat (limited to 'tests/auto/xmlpatternsdiagnosticsts')
-rw-r--r-- | tests/auto/xmlpatternsdiagnosticsts/tst_xmlpatternsdiagnosticsts.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/auto/xmlpatternsdiagnosticsts/tst_xmlpatternsdiagnosticsts.cpp b/tests/auto/xmlpatternsdiagnosticsts/tst_xmlpatternsdiagnosticsts.cpp index cd0bd11..fddf264 100644 --- a/tests/auto/xmlpatternsdiagnosticsts/tst_xmlpatternsdiagnosticsts.cpp +++ b/tests/auto/xmlpatternsdiagnosticsts/tst_xmlpatternsdiagnosticsts.cpp @@ -41,6 +41,8 @@ #include <QtTest/QtTest> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> #include "tst_suitetest.h" @@ -65,7 +67,13 @@ tst_XmlPatternsDiagnosticsTS::tst_XmlPatternsDiagnosticsTS() : tst_SuiteTest(tst void tst_XmlPatternsDiagnosticsTS::catalogPath(QString &write) const { - write = QLatin1String("TestSuite/DiagnosticsCatalog.xml"); + const char testSuite[] = "TestSuite"; + const QString testSuitePath = QFINDTESTDATA(testSuite); + if (!testSuitePath.isEmpty()) { + const QString testDirectory = QFileInfo(testSuitePath).absolutePath(); + QVERIFY2(QDir::setCurrent(testDirectory), qPrintable(QStringLiteral("Could not chdir to ") + testDirectory)); + write = QLatin1String(testSuite) + QStringLiteral("/DiagnosticsCatalog.xml"); + } } QTEST_MAIN(tst_XmlPatternsDiagnosticsTS) |