aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlcomponent
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2023-05-05 12:21:08 +0200
committerUlf Hermann <ulf.hermann@qt.io>2023-05-06 08:21:16 +0200
commitef6e9f6b75848dfdacdd98cf9e7530f651b3dfca (patch)
treebba9e3010246aa84c5ec7a41fd0ed72ac3a6bcc4 /tests/auto/qml/qqmlcomponent
parent567130e2d06a37b8615db7858050dfa0579ced93 (diff)
QQmlComponent: Remove pending bindings when setting properties
Pick-to: 6.2 6.5 Fixes: QTBUG-99363 Change-Id: I2c731ec0b8c5947192accdeb5ef52903d9c7cd90 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmlcomponent')
-rw-r--r--tests/auto/qml/qqmlcomponent/data/removeBinding.qml21
-rw-r--r--tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp11
2 files changed, 32 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlcomponent/data/removeBinding.qml b/tests/auto/qml/qqmlcomponent/data/removeBinding.qml
new file mode 100644
index 0000000000..08126a1db2
--- /dev/null
+++ b/tests/auto/qml/qqmlcomponent/data/removeBinding.qml
@@ -0,0 +1,21 @@
+import QtQml 2.15
+
+QtObject {
+ id: root
+ objectName: "400"
+
+ property Component c: Component {
+ id: customItem
+ QtObject {
+ objectName: root.objectName
+ }
+ }
+
+ property string result: {
+ const properties = {
+ "objectName": "42",
+ }
+ const item = customItem.createObject(root, properties)
+ return item.objectName;
+ }
+}
diff --git a/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp b/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp
index d76768c5d7..d6a53b9950 100644
--- a/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp
+++ b/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp
@@ -145,6 +145,7 @@ private slots:
void loadFromModuleFailures();
void loadFromModuleRequired();
void loadFromQrc();
+ void removeBinding();
private:
QQmlEngine engine;
@@ -1439,6 +1440,16 @@ void tst_qqmlcomponent::loadFromQrc()
QVERIFY(p->compilationUnit->aotCompiledFunctions);
}
+void tst_qqmlcomponent::removeBinding()
+{
+ QQmlEngine e;
+ QQmlComponent c(&e, testFileUrl("removeBinding.qml"));
+ QVERIFY2(c.isReady(), qPrintable(c.errorString()));
+ QScopedPointer<QObject> o(c.create());
+ QVERIFY(!o.isNull());
+ QCOMPARE(o->property("result"), QStringLiteral("42"));
+}
+
QTEST_MAIN(tst_qqmlcomponent)
#include "tst_qqmlcomponent.moc"