aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2019-04-23 09:33:25 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2019-04-23 09:34:29 +0200
commit580fa7dc88aae23053e44ffa335a15f6af112a20 (patch)
tree5bc915d7c2e252739122d9441bd0d7fa7175d0c2 /tests/auto/qml/qqmlimport/tst_qqmlimport.cpp
parent6767114285db9d0e16dc278d08f231e8561546b4 (diff)
parentc00283bb3bb966bf60c307ec8283bd98c12318bf (diff)
Merge remote-tracking branch 'origin/dev' into wip/scenegraphng
Diffstat (limited to 'tests/auto/qml/qqmlimport/tst_qqmlimport.cpp')
-rw-r--r--tests/auto/qml/qqmlimport/tst_qqmlimport.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp b/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp
index 70aaa9678e..a3cb68fdcb 100644
--- a/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp
+++ b/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp
@@ -28,6 +28,7 @@
#include <QtTest/QtTest>
#include <QQmlApplicationEngine>
+#include <QQmlAbstractUrlInterceptor>
#include <QtQuick/qquickview.h>
#include <QtQuick/qquickitem.h>
#include <private/qqmlimport_p.h>
@@ -43,6 +44,7 @@ private slots:
void uiFormatLoading();
void completeQmldirPaths_data();
void completeQmldirPaths();
+ void interceptQmldir();
void cleanup();
};
@@ -185,6 +187,32 @@ void tst_QQmlImport::completeQmldirPaths()
QCOMPARE(QQmlImports::completeQmldirPaths(uri, basePaths, majorVersion, minorVersion), expectedPaths);
}
+class QmldirUrlInterceptor : public QQmlAbstractUrlInterceptor {
+public:
+ QUrl intercept(const QUrl &url, DataType type) override
+ {
+ if (type != UrlString && !url.isEmpty() && url.isValid()) {
+ QString str = url.toString(QUrl::None);
+ return str.replace(QStringLiteral("$(INTERCEPT)"), QStringLiteral("intercepted"));
+ }
+ return url;
+ }
+};
+
+void tst_QQmlImport::interceptQmldir()
+{
+ QQmlEngine engine;
+ QmldirUrlInterceptor interceptor;
+ engine.setUrlInterceptor(&interceptor);
+
+ QQmlComponent component(&engine);
+ component.loadUrl(testFileUrl("interceptQmldir.qml"));
+ QVERIFY(component.isReady());
+ QScopedPointer<QObject> obj(component.create());
+ QVERIFY(!obj.isNull());
+}
+
+
QTEST_MAIN(tst_QQmlImport)
#include "tst_qqmlimport.moc"