summaryrefslogtreecommitdiffstats
path: root/tests/auto/shared/util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/shared/util.cpp')
-rw-r--r--tests/auto/shared/util.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/auto/shared/util.cpp b/tests/auto/shared/util.cpp
index 189398f0c2..96876428f6 100644
--- a/tests/auto/shared/util.cpp
+++ b/tests/auto/shared/util.cpp
@@ -40,7 +40,9 @@ QQmlDataTest::QQmlDataTest() :
m_dataDirectory(QTest::qFindTestData("data", QT_QMLTEST_DATADIR, 0)),
#endif
- m_dataDirectoryUrl(QUrl::fromLocalFile(m_dataDirectory + QLatin1Char('/')))
+ m_dataDirectoryUrl(m_dataDirectory.startsWith(QLatin1Char(':'))
+ ? QUrl(QLatin1String("qrc") + m_dataDirectory)
+ : QUrl::fromLocalFile(m_dataDirectory + QLatin1Char('/')))
{
m_instance = this;
}
@@ -54,7 +56,8 @@ void QQmlDataTest::initTestCase()
{
QVERIFY2(!m_dataDirectory.isEmpty(), "'data' directory not found");
m_directory = QFileInfo(m_dataDirectory).absolutePath();
- QVERIFY2(QDir::setCurrent(m_directory), qPrintable(QLatin1String("Could not chdir to ") + m_directory));
+ if (m_dataDirectoryUrl.scheme() != QLatin1String("qrc"))
+ QVERIFY2(QDir::setCurrent(m_directory), qPrintable(QLatin1String("Could not chdir to ") + m_directory));
}
QString QQmlDataTest::testFile(const QString &fileName) const