aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlcomponent/data/componentUrlCanonicalization.2.qml
diff options
context:
space:
mode:
authorChris Adams <christopher.adams@nokia.com>2012-04-19 17:30:59 +1000
committerQt by Nokia <qt-info@nokia.com>2012-04-23 02:05:22 +0200
commit6d2ed5d0b645f5af383a123e869d061b235b4b85 (patch)
tree72034ba88aff417ece70cc3d57e73c50b4a900bb /tests/auto/qml/qqmlcomponent/data/componentUrlCanonicalization.2.qml
parentb86b3bb0f44cdbdb21413b967be67d37b7fefa64 (diff)
Add some component path canonicalization tests
Previously, no unit test existed to ensure that url canonicalization worked correctly, which could result in two import statements using relative paths to the same actual component triggering two separate types being generated. This commit adds a unit test with various relative-addressing and both static and dynamic imports, to enforce type-consistency. Change-Id: I7772e3c531069322d5fa44063cbf57a758ed3710 Reviewed-by: Matthew Vogt <matthew.vogt@nokia.com>
Diffstat (limited to 'tests/auto/qml/qqmlcomponent/data/componentUrlCanonicalization.2.qml')
-rw-r--r--tests/auto/qml/qqmlcomponent/data/componentUrlCanonicalization.2.qml24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlcomponent/data/componentUrlCanonicalization.2.qml b/tests/auto/qml/qqmlcomponent/data/componentUrlCanonicalization.2.qml
new file mode 100644
index 0000000000..2e2d2de400
--- /dev/null
+++ b/tests/auto/qml/qqmlcomponent/data/componentUrlCanonicalization.2.qml
@@ -0,0 +1,24 @@
+import QtQuick 2.0
+import "SpecificComponent"
+
+Item {
+ id: root
+ property SpecificComponent first
+ property SpecificComponent second
+
+ property bool success: false
+
+ Component.onCompleted: {
+ var c1 = Qt.createComponent("./SpecificComponent/SpecificComponent.qml");
+ var o1 = c1.createObject(root);
+ first = o1;
+
+ var c2 = Qt.createComponent("./OtherComponent/OtherComponent.qml");
+ var o2 = c2.createObject(root);
+ second = o2.sc;
+
+ var ft = first.toString().substr(0, first.toString().indexOf('('));
+ var st = second.toString().substr(0, second.toString().indexOf('('));
+ if (ft == st) success = true;
+ }
+}