aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMaximilian Goldstein <max.goldstein@qt.io>2021-05-11 16:31:57 +0200
committerMaximilian Goldstein <max.goldstein@qt.io>2021-05-12 11:02:48 +0200
commit1b0fc3af8f999f740d1a976a6be2bdea212ad586 (patch)
treed822df84f09034ded70cffb41a63f09a9097be99 /tests
parent7e8e21c87cc44f3ba4a2a597994d7cfd11c1ac5d (diff)
qqmlirbuilder: Fix deep inline component script bindings
Previously when having an inline component inside any component that was not the root component, we hit an assert when using a script bindings. This was due to us not generating script bindings for any more deeply nested components. Now they work regardless of component depth. Change-Id: I700cf918f955aa99076006d53fb20358ff06e75f Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/qqmllanguage/data/deepInlineComponentScriptBinding.qml12
-rw-r--r--tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp12
2 files changed, 24 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmllanguage/data/deepInlineComponentScriptBinding.qml b/tests/auto/qml/qqmllanguage/data/deepInlineComponentScriptBinding.qml
new file mode 100644
index 0000000000..b5ccf5045d
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/deepInlineComponentScriptBinding.qml
@@ -0,0 +1,12 @@
+import QtQuick
+
+Item {
+ // Inline component must be two components deep to hit an assert
+ QtObject {
+ id: oneDown
+ component OneDepth : QtObject {
+ // Triggered by any script binding
+ objectName: "hel" + "lo"
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
index 8988039259..7b95a5069a 100644
--- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
+++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
@@ -359,6 +359,7 @@ private slots:
void hangOnWarning();
void listEnumConversion();
+ void deepInlineComponentScriptBinding();
private:
QQmlEngine engine;
@@ -6326,6 +6327,17 @@ QtObject {
QCOMPARE(o->property("resultEnumListType").metaType(), QMetaType(QMetaType::Int));
}
+void tst_qqmllanguage::deepInlineComponentScriptBinding()
+{
+ QQmlEngine e;
+ QQmlComponent c(&engine);
+ c.loadUrl(testFileUrl("deepInlineComponentScriptBinding.qml"));
+ QVERIFY2(c.isReady(), qPrintable(c.errorString()));
+
+ QScopedPointer<QObject> o(c.create());
+ QVERIFY(!o.isNull());
+}
+
QTEST_MAIN(tst_qqmllanguage)
#include "tst_qqmllanguage.moc"