aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2020-02-05 08:50:37 +0100
committerFabian Kosmale <fabian.kosmale@qt.io>2020-02-05 09:33:14 +0100
commit9dccec88e3394d9d2dc52812d9607f0bfa01a2d2 (patch)
tree4d3987ce5e93b7ae7ce39128faa5c0c6e81b46d2 /tests
parenta8bc011d459a4d080815a2675f2a0413c8bf09d2 (diff)
Inline components: fix name resolution
Inline components are an explicit component boundary, and therefore need some extra treatment. Change-Id: I03cc0d58f3565999f64675e8482ed3c3a325e8c0 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/qqmllanguage/data/SimpleItem.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/inlineComponentWithAlias.qml17
-rw-r--r--tests/auto/qml/qqmllanguage/data/inlineComponentWithId.qml14
-rw-r--r--tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp3
4 files changed, 39 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmllanguage/data/SimpleItem.qml b/tests/auto/qml/qqmllanguage/data/SimpleItem.qml
new file mode 100644
index 0000000000..c7bce2bc78
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/SimpleItem.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.15
+
+Item {
+ property int i: 42
+}
diff --git a/tests/auto/qml/qqmllanguage/data/inlineComponentWithAlias.qml b/tests/auto/qml/qqmllanguage/data/inlineComponentWithAlias.qml
new file mode 100644
index 0000000000..ab125e9323
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/inlineComponentWithAlias.qml
@@ -0,0 +1,17 @@
+import QtQuick 2.15
+
+Item {
+ id: root
+ component IC: SimpleItem {
+ width: i
+ Rectangle {
+ id: rect
+ color: "lime"
+ }
+ property alias color: rect.color
+ }
+ width: 200
+ IC {
+ objectName: "icInstance"
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/inlineComponentWithId.qml b/tests/auto/qml/qqmllanguage/data/inlineComponentWithId.qml
new file mode 100644
index 0000000000..c4093bad2f
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/inlineComponentWithId.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.15
+
+Item {
+ id: root
+ component IC: SimpleItem {
+ id: root
+ width: root.i
+ property color color: "red"
+ }
+ width: 200
+ IC {
+ objectName: "icInstance"
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
index b4ad9bd7b3..5966831183 100644
--- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
+++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
@@ -5547,6 +5547,9 @@ void tst_qqmllanguage::inlineComponent_data()
QTest::newRow("Non-toplevel IC is found") << testFileUrl("inlineComponentUser5.qml") << QColorConstants::Svg::red << 24;
QTest::newRow("Resolved in correct order") << testFileUrl("inlineComponentOrder.qml") << QColorConstants::Blue << 200;
+
+ QTest::newRow("ID resolves correctly") << testFileUrl("inlineComponentWithId.qml") << QColorConstants::Svg::red << 42;
+ QTest::newRow("Alias resolves correctly") << testFileUrl("inlineComponentWithAlias.qml") << QColorConstants::Svg::lime << 42;
}
void tst_qqmllanguage::inlineComponentReferenceCycle_data()