aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMaximilian Goldstein <max.goldstein@qt.io>2021-05-18 12:36:56 +0200
committerMaximilian Goldstein <max.goldstein@qt.io>2021-05-19 11:46:37 +0200
commitd6c98f192922b3ceab5eb65e651a7f0588b482e9 (patch)
treed531768a969b941c8974f49ee9c3ffa3b7a39fd2 /tests
parent3168111285601de30a24455282ed6450cd1a5799 (diff)
qmllint: Fix inline components getting overwritten by components
Previously there was a bug where components contained within inline components overwrote them instead of getting nested. This change fixes this bug. Change-Id: Iabed59da6b8609b48b38b6f06b063baf23f39d27 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/qmllint/data/inlineComponentWithComponents.qml11
-rw-r--r--tests/auto/qml/qmllint/tst_qmllint.cpp1
2 files changed, 12 insertions, 0 deletions
diff --git a/tests/auto/qml/qmllint/data/inlineComponentWithComponents.qml b/tests/auto/qml/qmllint/data/inlineComponentWithComponents.qml
new file mode 100644
index 0000000000..431d3ee076
--- /dev/null
+++ b/tests/auto/qml/qmllint/data/inlineComponentWithComponents.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+
+Item {
+ component IC : Text {
+ text: "Hello world!"
+ MouseArea {} // Previously this would overwrite the IC
+ }
+
+ property IC ic: IC {}
+ property string icText: ic.text // Check that we can access a property not contained in the component that would overwrite
+}
diff --git a/tests/auto/qml/qmllint/tst_qmllint.cpp b/tests/auto/qml/qmllint/tst_qmllint.cpp
index 330ca0b8f1..ea689d4f5a 100644
--- a/tests/auto/qml/qmllint/tst_qmllint.cpp
+++ b/tests/auto/qml/qmllint/tst_qmllint.cpp
@@ -752,6 +752,7 @@ void TestQmllint::cleanQmlCode_data()
QTest::newRow("Accessible") << QStringLiteral("accessible.qml");
QTest::newRow("qjsroot") << QStringLiteral("qjsroot.qml");
QTest::newRow("InlineComponent") << QStringLiteral("inlineComponent.qml");
+ QTest::newRow("InlineComponentWithComponents") << QStringLiteral("inlineComponentWithComponents.qml");
}
void TestQmllint::cleanQmlCode()