aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2018-02-22 16:04:08 +0100
committerSimon Hausmann <simon.hausmann@qt.io>2018-03-08 07:52:30 +0000
commit50f700aa8f68fff1e0153d19227b5a0bebbb6e51 (patch)
tree935854080f9588bd17372877d2b788b0fecbd3d0 /tests
parent5e0c3a798ab0d70be45a107661fc5f0a17322a2a (diff)
Fix group property bindings for aliases that point to id objects
When declaring bindings within a group property and that group property itself is a locally declared alias, then by the time we try to determine property caches for the group property we will fail as the aliases haven't been resolved yet. To fix this we can keep track of such group property declarations (encapsulated in the QQmlInstantiatingBindingContext that has all we need) and after we've resolved the aliases (added them to the property caches), we can go back and fill in the entries in the propertyCaches array for the group properties. Task-number: QTBUG-51043 Change-Id: I5613513db3977934bcc51a3df530de47d57326f9 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Michael Brasser <michael.brasser@live.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/qqmllanguage/data/alias.15.qml12
-rw-r--r--tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp14
2 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmllanguage/data/alias.15.qml b/tests/auto/qml/qqmllanguage/data/alias.15.qml
new file mode 100644
index 0000000000..5f3de9c83e
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/alias.15.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.6
+
+Item {
+ id: root
+
+ property alias symbol: symbol
+ symbol.y: 1
+
+ Item {
+ id: symbol
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
index 952e4a22a1..5bb2b69565 100644
--- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
+++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
@@ -1892,6 +1892,20 @@ void tst_qqmllanguage::aliasProperties()
QVERIFY(subObject->property("success").toBool());
}
+
+ // Property bindings on group properties that are actually aliases (QTBUG-51043)
+ {
+ QQmlComponent component(&engine, testFileUrl("alias.15.qml"));
+ VERIFY_ERRORS(0);
+
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(!object.isNull());
+
+ QPointer<QObject> subItem = qvariant_cast<QObject*>(object->property("symbol"));
+ QVERIFY(!subItem.isNull());
+
+ QCOMPARE(subItem->property("y").toInt(), 1);
+ }
}
// QTBUG-13374 Test that alias properties and signals can coexist