summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2009-08-19 04:22:45 (GMT)
committerAlan Alpert <alan.alpert@nokia.com>2009-08-19 04:22:45 (GMT)
commitb763dee21dc82fa2abb2f9f038a0253e4e8ed848 (patch)
tree1494bb35fec768d499786286d735e5d601a69cd4 /tests
parente19fa69859c1abe8da0623c502d012cff214e1c4 (diff)
downloadQt-b763dee21dc82fa2abb2f9f038a0253e4e8ed848.zip
Qt-b763dee21dc82fa2abb2f9f038a0253e4e8ed848.tar.gz
Qt-b763dee21dc82fa2abb2f9f038a0253e4e8ed848.tar.bz2
Update autotests
Not so much that they pass (or even run) of course. Just making the id change that was needed in the layouts test to all the other copy and pasted findItem functions.
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/anchors/tst_anchors.cpp6
-rw-r--r--tests/auto/declarative/layouts/tst_layouts.cpp17
-rw-r--r--tests/auto/declarative/listview/tst_listview.cpp6
-rw-r--r--tests/auto/declarative/pathview/data/pathview.qml2
-rw-r--r--tests/auto/declarative/pathview/tst_pathview.cpp18
-rw-r--r--tests/auto/declarative/repeater/tst_repeater.cpp6
6 files changed, 29 insertions, 26 deletions
diff --git a/tests/auto/declarative/anchors/tst_anchors.cpp b/tests/auto/declarative/anchors/tst_anchors.cpp
index 4830169..98ede65 100644
--- a/tests/auto/declarative/anchors/tst_anchors.cpp
+++ b/tests/auto/declarative/anchors/tst_anchors.cpp
@@ -25,15 +25,15 @@ private slots:
Find an item with the specified id.
*/
template<typename T>
-T *tst_anchors::findItem(QFxItem *parent, const QString &id)
+T *tst_anchors::findItem(QFxItem *parent, const QString &objectName)
{
const QMetaObject &mo = T::staticMetaObject;
for (int i = 0; i < parent->QSimpleCanvasItem::children().count(); ++i) {
QFxItem *item = qobject_cast<QFxItem*>(parent->QSimpleCanvasItem::children().at(i));
- if (mo.cast(item) && (id.isEmpty() || item->id() == id)) {
+ if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) {
return static_cast<T*>(item);
}
- item = findItem<T>(item, id);
+ item = findItem<T>(item, objectName);
if (item)
return static_cast<T*>(item);
}
diff --git a/tests/auto/declarative/layouts/tst_layouts.cpp b/tests/auto/declarative/layouts/tst_layouts.cpp
index 466a7de..cd4678e 100644
--- a/tests/auto/declarative/layouts/tst_layouts.cpp
+++ b/tests/auto/declarative/layouts/tst_layouts.cpp
@@ -21,7 +21,7 @@ private slots:
private:
QFxView *createView(const QString &filename);
template<typename T>
- T *findItem(QFxItem *parent, const QString &id, int index=0);
+ T *findItem(QFxItem *parent, const QString &id, int index=-1);
};
tst_QFxLayouts::tst_QFxLayouts()
@@ -197,16 +197,19 @@ QFxView *tst_QFxLayouts::createView(const QString &filename)
}
/*
- Find an item with the specified id. If index is supplied then the
+ Find an item with the specified objectName. If index is supplied then the
item must also evaluate the {index} expression equal to index
*/
template<typename T>
-T *tst_QFxLayouts::findItem(QFxItem *parent, const QString &id, int index)
+T *tst_QFxLayouts::findItem(QFxItem *parent, const QString &objectName, int index)
{
const QMetaObject &mo = T::staticMetaObject;
- for (int i = 0; i < parent->children()->count(); ++i) {
- QFxItem *item = parent->children()->at(i);
- if (mo.cast(item) && (id.isEmpty() || item->id() == id)) {
+ for (int i = 0; i < parent->QGraphicsObject::children().count(); ++i) {
+ QFxItem *item = qobject_cast<QFxItem*>(parent->QGraphicsObject::children().at(i));
+ if(!item)
+ continue;
+ //qDebug() << item << item->objectName();
+ if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) {
if (index != -1) {
QmlExpression e(qmlContext(item), "index", item);
e.setTrackChange(false);
@@ -216,7 +219,7 @@ T *tst_QFxLayouts::findItem(QFxItem *parent, const QString &id, int index)
return static_cast<T*>(item);
}
}
- item = findItem<T>(item, id, index);
+ item = findItem<T>(item, objectName, index);
if (item)
return static_cast<T*>(item);
}
diff --git a/tests/auto/declarative/listview/tst_listview.cpp b/tests/auto/declarative/listview/tst_listview.cpp
index 8cf0a85..8bf9c8a 100644
--- a/tests/auto/declarative/listview/tst_listview.cpp
+++ b/tests/auto/declarative/listview/tst_listview.cpp
@@ -456,14 +456,14 @@ QFxView *tst_QFxListView::createView(const QString &filename)
item must also evaluate the {index} expression equal to index
*/
template<typename T>
-T *tst_QFxListView::findItem(QFxItem *parent, const QString &id, int index)
+T *tst_QFxListView::findItem(QFxItem *parent, const QString &objectName, int index)
{
const QMetaObject &mo = T::staticMetaObject;
qDebug() << parent->children()->count() << "children";
for (int i = 0; i < parent->children()->count(); ++i) {
QFxItem *item = parent->children()->at(i);
qDebug() << "try" << item;
- if (mo.cast(item) && (id.isEmpty() || item->id() == id)) {
+ if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) {
if (index != -1) {
QmlExpression e(qmlContext(item), "index", item);
e.setTrackChange(false);
@@ -473,7 +473,7 @@ T *tst_QFxListView::findItem(QFxItem *parent, const QString &id, int index)
return static_cast<T*>(item);
}
}
- item = findItem<T>(item, id, index);
+ item = findItem<T>(item, objectName, index);
if (item)
return static_cast<T*>(item);
}
diff --git a/tests/auto/declarative/pathview/data/pathview.qml b/tests/auto/declarative/pathview/data/pathview.qml
index 5bf2085..7040e4c 100644
--- a/tests/auto/declarative/pathview/data/pathview.qml
+++ b/tests/auto/declarative/pathview/data/pathview.qml
@@ -12,7 +12,7 @@ Rect {
height: 20
width: 60
color: "white"
- pen.color: "black"
+ border.color: "black"
Text {
text: index
}
diff --git a/tests/auto/declarative/pathview/tst_pathview.cpp b/tests/auto/declarative/pathview/tst_pathview.cpp
index 92890ba..9cae961 100644
--- a/tests/auto/declarative/pathview/tst_pathview.cpp
+++ b/tests/auto/declarative/pathview/tst_pathview.cpp
@@ -101,7 +101,7 @@ tst_QFxPathView::tst_QFxPathView()
void tst_QFxPathView::items()
{
- QFxView *canvas = createView(SRCDIR "/data/pathview.xml");
+ QFxView *canvas = createView(SRCDIR "/data/pathview.qml");
TestModel model;
model.addItem("Fred", "12345");
@@ -133,7 +133,7 @@ void tst_QFxPathView::items()
void tst_QFxPathView::pathMoved()
{
- QFxView *canvas = createView(SRCDIR "/data/pathview.xml");
+ QFxView *canvas = createView(SRCDIR "/data/pathview.qml");
TestModel model;
model.addItem("Ben", "12345");
@@ -176,7 +176,7 @@ void tst_QFxPathView::pathMoved()
void tst_QFxPathView::limitedItems()
{
- QFxView *canvas = createView(SRCDIR "/data/pathview.xml");
+ QFxView *canvas = createView(SRCDIR "/data/pathview.qml");
TestModel model;
for(int i=0; i<100; i++)
@@ -220,23 +220,23 @@ QFxView *tst_QFxPathView::createView(const QString &filename)
QFile file(filename);
file.open(QFile::ReadOnly);
- QString xml = file.readAll();
- canvas->setQml(xml, filename);
+ QString qml = file.readAll();
+ canvas->setQml(qml, filename);
return canvas;
}
/*
- Find an item with the specified id. If index is supplied then the
+ Find an item with the specified objectName. If index is supplied then the
item must also evaluate the {index} expression equal to index
*/
template<typename T>
-T *tst_QFxPathView::findItem(QFxItem *parent, const QString &id, int index)
+T *tst_QFxPathView::findItem(QFxItem *parent, const QString &objectName, int index)
{
const QMetaObject &mo = T::staticMetaObject;
for (int i = 0; i < parent->children()->count(); ++i) {
QFxItem *item = parent->children()->at(i);
- if (mo.cast(item) && (id.isEmpty() || item->id() == id)) {
+ if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) {
if (index != -1) {
QmlExpression e(qmlContext(item), "index", item);
e.setTrackChange(false);
@@ -246,7 +246,7 @@ T *tst_QFxPathView::findItem(QFxItem *parent, const QString &id, int index)
return static_cast<T*>(item);
}
}
- item = findItem<T>(item, id, index);
+ item = findItem<T>(item, objectName, index);
if (item)
return static_cast<T*>(item);
}
diff --git a/tests/auto/declarative/repeater/tst_repeater.cpp b/tests/auto/declarative/repeater/tst_repeater.cpp
index 0d3ec98..0e7c187 100644
--- a/tests/auto/declarative/repeater/tst_repeater.cpp
+++ b/tests/auto/declarative/repeater/tst_repeater.cpp
@@ -72,13 +72,13 @@ QFxView *tst_QFxRepeater::createView(const QString &filename)
}
template<typename T>
-T *tst_QFxRepeater::findItem(QFxItem *parent, const QString &id)
+T *tst_QFxRepeater::findItem(QFxItem *parent, const QString &objectName)
{
const QMetaObject &mo = T::staticMetaObject;
- if (mo.cast(parent) && (id.isEmpty() || parent->id() == id))
+ if (mo.cast(parent) && (objectName.isEmpty() || parent->objectName() == objectName))
return static_cast<T*>(parent);
for (int i = 0; i < parent->children()->count(); ++i) {
- QFxItem *item = findItem<T>(parent->children()->at(i), id);
+ QFxItem *item = findItem<T>(parent->children()->at(i), objectName);
if (item)
return static_cast<T*>(item);
}