aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2014-03-11 13:12:38 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-11 18:31:21 +0100
commitaf7ba8a6194b83fe7380b8d4ae027e2f04e21f17 (patch)
tree2d8eb6e7af9c34405659dc87c9aa6a150ceaa9cb /tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
parent95444c589763e16fb1c2cf1e1bc892fa5cc41a3a (diff)
Fix incorrectly initialized property cache on group objects
When initializing bindings on group objects, we would accidentally set the property cache for the property type instead of preserving a possibly earlier initialized cache on the ddata of the QObject. Task-number: QTBUG-37390 Change-Id: I4d6a4ce6b3382f378f9a9ddfe11924860a15979d Reviewed-by: Sérgio Martins <sergio.martins@kdab.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp')
-rw-r--r--tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
index 3a52d586ea..c7a26c72db 100644
--- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
+++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
@@ -218,6 +218,8 @@ private slots:
void customParserBindingScopes();
void customParserEvaluateEnum();
+ void preservePropertyCacheOnGroupObjects();
+
private:
QQmlEngine engine;
QStringList defaultImportPathList;
@@ -3581,6 +3583,25 @@ void tst_qqmllanguage::customParserEvaluateEnum()
QVERIFY(!o.isNull());
}
+void tst_qqmllanguage::preservePropertyCacheOnGroupObjects()
+{
+ QQmlComponent component(&engine, testFile("preservePropertyCacheOnGroupObjects.qml"));
+ VERIFY_ERRORS(0);
+ QScopedPointer<QObject> o(component.create());
+ QVERIFY(!o.isNull());
+ QObject *subObject = qvariant_cast<QObject*>(o->property("subObject"));
+ QVERIFY(subObject);
+ QCOMPARE(subObject->property("value").toInt(), 42);
+
+ QQmlData *ddata = QQmlData::get(subObject);
+ QVERIFY(ddata);
+ QQmlPropertyCache *subCache = ddata->propertyCache;
+ QVERIFY(subCache);
+ QQmlPropertyData *pd = subCache->property(QStringLiteral("newProperty"), /*object*/0, /*context*/0);
+ QVERIFY(pd);
+ QCOMPARE(pd->propType, qMetaTypeId<int>());
+}
+
QTEST_MAIN(tst_qqmllanguage)
#include "tst_qqmllanguage.moc"