diff options
author | Kai Koehne <kai.koehne@nokia.com> | 2011-02-15 13:00:27 (GMT) |
---|---|---|
committer | Kai Koehne <kai.koehne@nokia.com> | 2011-02-16 08:17:02 (GMT) |
commit | 35a36e91606eaf8374a2273cbb0101e0e614321e (patch) | |
tree | 326a85d5a3586980bb11cf415052d0c7e4fb33ca /tests | |
parent | 6c3868572d8f109884a1b3fb806331fda3ef84d4 (diff) | |
download | Qt-35a36e91606eaf8374a2273cbb0101e0e614321e.zip Qt-35a36e91606eaf8374a2273cbb0101e0e614321e.tar.gz Qt-35a36e91606eaf8374a2273cbb0101e0e614321e.tar.bz2 |
QDeclarativeDebug: Fix crash when serializing list of QObjects
Task-number: QTBUG-17444
Reviewed-by: Aaron Kennedy
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp b/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp index 917b8d8..d01463e 100644 --- a/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp +++ b/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp @@ -166,8 +166,8 @@ void tst_QDeclarativeDebug::recursiveObjectTest(QObject *o, const QDeclarativeDe { const QMetaObject *meta = o->metaObject(); - QDeclarativeType *type = QDeclarativeMetaType::qmlType(o->metaObject()); - QString className = type ? type->qmlTypeName() : QString(); + QDeclarativeType *type = QDeclarativeMetaType::qmlType(meta); + QString className = type ? QString(type->qmlTypeName()) : QString(meta->className()); className = className.mid(className.lastIndexOf(QLatin1Char('/'))+1); QCOMPARE(oref.debugId(), QDeclarativeDebugService::idForObject(o)); @@ -292,12 +292,21 @@ void tst_QDeclarativeDebug::initTestCase() QList<QByteArray> qml; qml << "import QtQuick 1.0\n" "Item {" + "id: root\n" "width: 10; height: 20; scale: blueRect.scale;" "Rectangle { id: blueRect; width: 500; height: 600; color: \"blue\"; }" "Text { color: blueRect.color; }" "MouseArea {" "onEntered: { console.log('hello') }" "}" + "property variant varObj\n" + "property variant varObjList: []\n" + "Component.onCompleted: {\n" + "varObj = blueRect;\n" + "var list = varObjList;\n" + "list[0] = blueRect;\n" + "varObjList = list;\n" + "}\n" "}"; // add second component to test multiple root contexts @@ -741,7 +750,6 @@ void tst_QDeclarativeDebug::queryObject() QCOMPARE(findProperty(rect.properties(), "color").value(), qVariantFromValue(QColor("blue"))); QCOMPARE(findProperty(text.properties(), "color").value(), qVariantFromValue(QColor("blue"))); - } else { foreach(const QDeclarativeDebugObjectReference &child, obj.children()) QCOMPARE(child.properties().count(), 0); @@ -798,6 +806,8 @@ void tst_QDeclarativeDebug::queryExpressionResult_data() QTest::newRow("width + 50") << "width + 50" << qVariantFromValue(60); QTest::newRow("blueRect.width") << "blueRect.width" << qVariantFromValue(500); QTest::newRow("bad expr") << "aeaef" << qVariantFromValue(QString("<undefined>")); + QTest::newRow("QObject*") << "varObj" << qVariantFromValue(QString("<unnamed object>")); + QTest::newRow("list of QObject*") << "varObjList" << qVariantFromValue(QString("<unknown value>")); } void tst_QDeclarativeDebug::tst_QDeclarativeDebugFileReference() |