diff options
Diffstat (limited to 'tests/auto/qml/qqmllanguage')
4 files changed, 37 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmllanguage/data/GroupPropertyBase.qml b/tests/auto/qml/qqmllanguage/data/GroupPropertyBase.qml new file mode 100644 index 0000000000..a2534359be --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/GroupPropertyBase.qml @@ -0,0 +1,6 @@ +import QtQml 2.0 +QtObject { + property GroupType subObject: GroupType { + property int newProperty: 100; + } +} diff --git a/tests/auto/qml/qqmllanguage/data/GroupType.qml b/tests/auto/qml/qqmllanguage/data/GroupType.qml new file mode 100644 index 0000000000..d1219deea6 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/GroupType.qml @@ -0,0 +1,4 @@ +import QtQml 2.0 +QtObject { + property int value: 10 +} diff --git a/tests/auto/qml/qqmllanguage/data/preservePropertyCacheOnGroupObjects.qml b/tests/auto/qml/qqmllanguage/data/preservePropertyCacheOnGroupObjects.qml new file mode 100644 index 0000000000..031cf3b1f8 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/preservePropertyCacheOnGroupObjects.qml @@ -0,0 +1,6 @@ +import QtQml 2.0 +GroupPropertyBase { + subObject { + value: 42 + } +} 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" |