From d0f16c6c61fff8d5771f433690750d57dfa9c61c Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 10 Feb 2010 13:09:40 +1000 Subject: Fix repeater test. --- tests/auto/declarative/qmlgraphicsrepeater/data/objlist.qml | 2 +- .../qmlgraphicsrepeater/tst_qmlgraphicsrepeater.cpp | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/auto/declarative/qmlgraphicsrepeater/data/objlist.qml b/tests/auto/declarative/qmlgraphicsrepeater/data/objlist.qml index ecc6d02..e6d0acb 100644 --- a/tests/auto/declarative/qmlgraphicsrepeater/data/objlist.qml +++ b/tests/auto/declarative/qmlgraphicsrepeater/data/objlist.qml @@ -14,7 +14,7 @@ Rectangle { property int instantiated: 0 Component { Item{ - Component.onCompleted: {if(index!=modelData.idx) repeater.errors += 1; repeater.instantiated++} + Component.onCompleted: {if(index!=model.idx) repeater.errors += 1; repeater.instantiated++} } } } diff --git a/tests/auto/declarative/qmlgraphicsrepeater/tst_qmlgraphicsrepeater.cpp b/tests/auto/declarative/qmlgraphicsrepeater/tst_qmlgraphicsrepeater.cpp index e8019d7..4297901 100644 --- a/tests/auto/declarative/qmlgraphicsrepeater/tst_qmlgraphicsrepeater.cpp +++ b/tests/auto/declarative/qmlgraphicsrepeater/tst_qmlgraphicsrepeater.cpp @@ -61,7 +61,7 @@ private slots: private: QmlView *createView(const QString &filename); template - T *findItem(QObject *parent, const QString &id); + T *findItem(QmlGraphicsItem *parent, const QString &id); }; class TestObject : public QObject @@ -332,13 +332,16 @@ QmlView *tst_QmlGraphicsRepeater::createView(const QString &filename) } template -T *tst_QmlGraphicsRepeater::findItem(QObject *parent, const QString &objectName) +T *tst_QmlGraphicsRepeater::findItem(QmlGraphicsItem *parent, const QString &objectName) { const QMetaObject &mo = T::staticMetaObject; if (mo.cast(parent) && (objectName.isEmpty() || parent->objectName() == objectName)) return static_cast(parent); - for (int i = 0; i < parent->children().count(); ++i) { - QmlGraphicsItem *item = findItem(parent->children().at(i), objectName); + for (int i = 0; i < parent->childItems().count(); ++i) { + QmlGraphicsItem *child = qobject_cast(parent->childItems().at(i)); + if (!child) + continue; + QmlGraphicsItem *item = findItem(child, objectName); if (item) return static_cast(item); } -- cgit v0.12