summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-04-25 10:49:34 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-04-25 10:49:35 +0200
commit6fd340c1ae0af4ba54a7d686e0fd78d5de0f53e0 (patch)
tree6cb9c736c890bc9c7a8e5f9d722a356a9a5e38bb /tests
parent53bd6b8111eb0d7f23b3b0ca95bef4735f7a952c (diff)
parent138d5c82f11bdcd9c6594d1e539631b9560353ae (diff)
Merge remote-tracking branch 'origin/5.12' into 5.13
Diffstat (limited to 'tests')
-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 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
diff --git a/tests/auto/shared/util.pri b/tests/auto/shared/util.pri
index a05af4773d..b54897ac2c 100644
--- a/tests/auto/shared/util.pri
+++ b/tests/auto/shared/util.pri
@@ -3,4 +3,8 @@ INCLUDEPATH += $$PWD
HEADERS += $$PWD/util.h
SOURCES += $$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\\\"
+}