aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp')
-rw-r--r--tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp b/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp
index 10181aa9b8..eebb558bce 100644
--- a/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp
+++ b/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp
@@ -111,6 +111,7 @@ private slots:
void qmlCreateParentReference();
void async();
void asyncHierarchy();
+ void componentUrlCanonicalization();
private:
QQmlEngine engine;
@@ -314,6 +315,42 @@ void tst_qqmlcomponent::asyncHierarchy()
delete root;
}
+void tst_qqmlcomponent::componentUrlCanonicalization()
+{
+ // ensure that url canonicalization succeeds so that type information
+ // is not generated multiple times for the same component.
+ {
+ // load components via import
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("componentUrlCanonicalization.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QVERIFY(object->property("success").toBool());
+ delete object;
+ }
+
+ {
+ // load one of the components dynamically, which would trigger
+ // import of the other if it were not already loaded.
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("componentUrlCanonicalization.2.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QVERIFY(object->property("success").toBool());
+ delete object;
+ }
+
+ {
+ // load components with more deeply nested imports
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("componentUrlCanonicalization.3.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QVERIFY(object->property("success").toBool());
+ delete object;
+ }
+}
+
QTEST_MAIN(tst_qqmlcomponent)
#include "tst_qqmlcomponent.moc"