diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-12-03 15:21:58 +0100 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-12-03 21:46:24 +0100 |
commit | 96e321bc5cf3c1a6d52374a6f4070a438032b08d (patch) | |
tree | 62bf3e0ddc9d65660c3ef9b4a68e6e93cd68508d /tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | |
parent | 6eb35df60e061b9ce4e88f97a174216e2b1c617f (diff) |
QML engine: Fix binding setup
We set QProperty bindings up in the wrong way: Parent components would
overwrite their child component's binding. This patch reverses the
order, fixing the bug.
Task-number: QTBUG-87153
Pick-to: 6.0
Change-Id: I3e90d1d14a41a7c5c337745f1453484d360a3979
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp')
-rw-r--r-- | tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index d7cb85a75d..37e3a33442 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -382,6 +382,7 @@ private slots: void semicolonAfterProperty(); void hugeStack(); void bindingOnQProperty(); + void overwrittenBindingOnQProperty(); void aliasOfQProperty(); void bindingOnQPropertyContextProperty(); void bindingContainingQProperty(); @@ -9182,6 +9183,19 @@ void tst_qqmlecmascript::bindingOnQProperty() QVERIFY(qprop.hasBinding()); } +void tst_qqmlecmascript::overwrittenBindingOnQProperty() +{ + QQmlEngine engine; + QQmlComponent component(&engine, testFileUrl("QPropertyOverwrite.qml")); + QVERIFY2(component.isReady(), qPrintable(component.errorString())); + QScopedPointer<QObject> root(component.create()); + auto test = root->findChild<ClassWithQProperty *>("test"); + QVERIFY(test); + QCOMPARE(test->value.value(), 13.f); + root->setProperty("value", 14.f); + QCOMPARE(test->value.value(), 14.0); +} + void tst_qqmlecmascript::aliasOfQProperty() { QQmlEngine engine; QQmlComponent component(&engine, testFileUrl("aliasOfQProperty.qml")); |