diff options
author | Jan Arve Sæther <jan-arve.saether@qt.io> | 2019-07-03 17:25:55 +0200 |
---|---|---|
committer | Jan Arve Sæther <jan-arve.saether@qt.io> | 2019-07-19 11:11:02 +0200 |
commit | 982a397a520b5746dc8682b58bfe81270f75868f (patch) | |
tree | 924521b6ba4faca058d538fa62307fcff7a44e0b /tests/auto | |
parent | 2519e4b73876102b46e72b795c96f1ea73c3d523 (diff) |
Fix qqmlengine autotest for android
Most of the fixes are due to the fact that qml files are embedded as
resources
Change-Id: Ief615fea608a839a4e0a09459cf60f500cbe8c72
Task-number: QTBUG-73512
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qml/qqmlengine/qqmlengine.pro | 2 | ||||
-rw-r--r-- | tests/auto/qml/qqmlengine/tst_qqmlengine.cpp | 14 |
2 files changed, 11 insertions, 5 deletions
diff --git a/tests/auto/qml/qqmlengine/qqmlengine.pro b/tests/auto/qml/qqmlengine/qqmlengine.pro index d2eb92bfd5..8946201ea0 100644 --- a/tests/auto/qml/qqmlengine/qqmlengine.pro +++ b/tests/auto/qml/qqmlengine/qqmlengine.pro @@ -4,6 +4,8 @@ macx:CONFIG -= app_bundle include (../../shared/util.pri) +TESTDATA = data/* + SOURCES += tst_qqmlengine.cpp QT += core-private gui-private qml-private network testlib diff --git a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp index 66d50cfe39..77ebff313e 100644 --- a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp +++ b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp @@ -428,7 +428,7 @@ void tst_qqmlengine::trimComponentCache() engine.setIncubationController(&componentCache); QQmlComponent component(&engine, testFileUrl(file)); - QVERIFY(component.isReady()); + QVERIFY2(component.isReady(), qPrintable(component.errorString())); QScopedPointer<QObject> object(component.create()); QVERIFY(object != nullptr); QCOMPARE(object->property("success").toBool(), true); @@ -742,13 +742,17 @@ public: CustomSelector(const QUrl &base):m_base(base){} virtual QUrl intercept(const QUrl &url, QQmlAbstractUrlInterceptor::DataType d) { - if (url.scheme() != QStringLiteral("file")) + if ((url.scheme() != QStringLiteral("file") && url.scheme() != QStringLiteral("qrc")) + || url.path().contains("QtQml")) return url; if (!m_interceptionPoints.contains(d)) return url; - if (url.path().endsWith("Test.2/qmldir"))//Special case - return QUrl::fromLocalFile(m_base.path() + "interception/module/intercepted/qmldir"); + if (url.path().endsWith("Test.2/qmldir")) {//Special case + QUrl url = m_base; + url.setPath(m_base.path() + "interception/module/intercepted/qmldir"); + return url; + } // Special case: with 5.10 we always add the implicit import, so we need to explicitly handle this case now if (url.path().endsWith("intercepted/qmldir")) return url; @@ -836,7 +840,7 @@ void tst_qqmlengine::urlInterceptor() QFETCH(QString, expectedAbsoluteUrl); QQmlEngine e; - e.addImportPath(testFileUrl("interception/imports").toLocalFile()); + e.addImportPath(testFileUrl("interception/imports").url()); CustomSelector cs(testFileUrl("")); cs.m_interceptionPoints = interceptionPoint; e.setUrlInterceptor(&cs); |