From 1f3d0ae63b2501460fc1c75f22b579b29147a80d Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Tue, 16 Jul 2013 15:28:11 +0200 Subject: Fix regression from Qt 4 for deep group properties Setting a property like someObject.font.family would cause an out-of-bounds assertion in QList, called from QQmlCompiler::genValueTypeProperty. This appears to be a regression from commit 5e970b84663f5398eb51d4575856d1a3c44df953, which replaced one -1 to QMetaType::QVariant too many times. It appears the use of -1 is rather deliberate here and not to indicate the use of a QVariant property. The attached test verifies this as well as the successful setting of the property at the end. Task-number: QTBUG-31576 Change-Id: I237ea08847e1db31481a311ea8ec23a5ccc702d8 Reviewed-by: Matthew Vogt Reviewed-by: Andrew den Exter --- .../qdeclarativelanguage/tst_qdeclarativelanguage.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp') diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index 1574aa4a..8052f5fc 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -162,6 +162,8 @@ private slots: void compatibilitySemicolon(); + void deepProperty(); + private: QDeclarativeEngine engine; void testType(const QString& qml, const QString& type, const QString& error); @@ -2059,6 +2061,16 @@ void tst_qdeclarativelanguage::implicitImportsLast() QCOMPARE(QString(object2->metaObject()->className()), QLatin1String("QDeclarativeRectangle")); } +void tst_qdeclarativelanguage::deepProperty() +{ + QDeclarativeComponent component(&engine, testFileUrl("deepProperty.qml")); + VERIFY_ERRORS(0); + QObject *o = component.create(); + QVERIFY(o != 0); + QFont font = qvariant_cast(qvariant_cast(o->property("someObject"))->property("font")); + QCOMPARE(font.family(), QStringLiteral("test")); +} + QTEST_MAIN(tst_qdeclarativelanguage) #include "tst_qdeclarativelanguage.moc" -- cgit v1.2.3