summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-02-10 03:09:40 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-02-10 03:09:40 (GMT)
commitd0f16c6c61fff8d5771f433690750d57dfa9c61c (patch)
tree25b1c514cc7e8294c1d9cc51621ae0fd9b6bcf96 /tests
parent64b0f5be361958fec2bb0eba48914773a7d525ad (diff)
downloadQt-d0f16c6c61fff8d5771f433690750d57dfa9c61c.zip
Qt-d0f16c6c61fff8d5771f433690750d57dfa9c61c.tar.gz
Qt-d0f16c6c61fff8d5771f433690750d57dfa9c61c.tar.bz2
Fix repeater test.
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qmlgraphicsrepeater/data/objlist.qml2
-rw-r--r--tests/auto/declarative/qmlgraphicsrepeater/tst_qmlgraphicsrepeater.cpp11
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<typename T>
- 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<typename T>
-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<T*>(parent);
- for (int i = 0; i < parent->children().count(); ++i) {
- QmlGraphicsItem *item = findItem<T>(parent->children().at(i), objectName);
+ for (int i = 0; i < parent->childItems().count(); ++i) {
+ QmlGraphicsItem *child = qobject_cast<QmlGraphicsItem*>(parent->childItems().at(i));
+ if (!child)
+ continue;
+ QmlGraphicsItem *item = findItem<T>(child, objectName);
if (item)
return static_cast<T*>(item);
}