aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/shared
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/shared')
-rw-r--r--tests/auto/shared/util.cpp7
-rw-r--r--tests/auto/shared/util.pri6
2 files changed, 10 insertions, 3 deletions
diff --git a/tests/auto/shared/util.cpp b/tests/auto/shared/util.cpp
index e9e58993..2f6b7f54 100644
--- a/tests/auto/shared/util.cpp
+++ b/tests/auto/shared/util.cpp
@@ -53,7 +53,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;
}
@@ -67,7 +69,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
diff --git a/tests/auto/shared/util.pri b/tests/auto/shared/util.pri
index 16f37f8a..99607a66 100644
--- a/tests/auto/shared/util.pri
+++ b/tests/auto/shared/util.pri
@@ -6,5 +6,9 @@ HEADERS += $$PWD/visualtestutil.h \
SOURCES += $$PWD/visualtestutil.cpp \
$$PWD/util.cpp
-DEFINES += QT_QMLTEST_DATADIR=\\\"$${_PRO_FILE_PWD_}/data\\\"
+android|ios {
+ DEFINES += QT_QMLTEST_DATADIR=\\\":/data\\\"
+} else {
+ DEFINES += QT_QMLTEST_DATADIR=\\\"$${_PRO_FILE_PWD_}/data\\\"
+}
DEFINES += QQC2_IMPORT_PATH=\\\"$$QQC2_SOURCE_TREE/src/imports\\\"