aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmllanguage
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@theqtcompany.com>2015-04-22 13:39:06 +0200
committerSimon Hausmann <simon.hausmann@theqtcompany.com>2015-04-23 08:27:43 +0000
commit3fdec636980c23b14cfc6aa74bc48bbb960ba0b4 (patch)
tree8e7dad673bfbd8e38fe6974088eb914ac18da8b1 /tests/auto/qml/qqmllanguage
parent346abd22118c81e8434ff5a2a7694bd81fe17be1 (diff)
Fix regression with nested objects served by custom parsers
The following piece of code used to work and broke with Qt 5.3: ListModel { property var conn: Connection { ... } } When validating the properties of the ListModel we would not validate the Connection sub-object here, which meant the custom parser for the connection object was never called. We need to extend the logic for sub-object validation to recursive into sub-objects when this is either an attached property (Component.onComplete on a list model for example) or the object is assigned to an _existing_ property, i.e. a property not deal with by the custom parser. In this case that's a custom declared property. Change-Id: Ic99f746f08771460cc6424a9e8a839c78a7eafd9 Task-number: QTBUG-45735 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'tests/auto/qml/qqmllanguage')
-rw-r--r--tests/auto/qml/qqmllanguage/data/nestedCustomParsers.qml8
-rw-r--r--tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp15
2 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmllanguage/data/nestedCustomParsers.qml b/tests/auto/qml/qqmllanguage/data/nestedCustomParsers.qml
new file mode 100644
index 0000000000..77b93e8594
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/nestedCustomParsers.qml
@@ -0,0 +1,8 @@
+import Test 1.0
+import QtQml 2.0
+SimpleObjectWithCustomParser {
+ customProperty: 42
+ property var nested: SimpleObjectWithCustomParser {
+ customNestedProperty: 42
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
index 922abd9761..0405b2905b 100644
--- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
+++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
@@ -229,6 +229,7 @@ private slots:
void customParserEvaluateEnum();
void customParserProperties();
void customParserWithExtendedObject();
+ void nestedCustomParsers();
void preservePropertyCacheOnGroupObjects();
void propertyCacheInSync();
@@ -3930,6 +3931,20 @@ void tst_qqmllanguage::customParserWithExtendedObject()
QCOMPARE(returnValue.toInt(), 1584);
}
+void tst_qqmllanguage::nestedCustomParsers()
+{
+ QQmlComponent component(&engine, testFile("nestedCustomParsers.qml"));
+ VERIFY_ERRORS(0);
+ QScopedPointer<QObject> o(component.create());
+ QVERIFY(!o.isNull());
+ SimpleObjectWithCustomParser *testObject = qobject_cast<SimpleObjectWithCustomParser*>(o.data());
+ QVERIFY(testObject);
+ QCOMPARE(testObject->customBindingsCount(), 1);
+ SimpleObjectWithCustomParser *nestedObject = qobject_cast<SimpleObjectWithCustomParser*>(testObject->property("nested").value<QObject*>());
+ QVERIFY(nestedObject);
+ QCOMPARE(nestedObject->customBindingsCount(), 1);
+}
+
void tst_qqmllanguage::preservePropertyCacheOnGroupObjects()
{
QQmlComponent component(&engine, testFile("preservePropertyCacheOnGroupObjects.qml"));