From 115232074a4becd5cf03974ac351331de1217f7d Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Thu, 8 Oct 2009 16:51:38 +1000 Subject: Remove spurious errors. Others seem real. --- tests/auto/declarative/listview/data/listview.qml | 2 +- tests/auto/declarative/listview/tst_listview.cpp | 20 +++++++++++++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/tests/auto/declarative/listview/data/listview.qml b/tests/auto/declarative/listview/data/listview.qml index 1a241eb..5083329 100644 --- a/tests/auto/declarative/listview/data/listview.qml +++ b/tests/auto/declarative/listview/data/listview.qml @@ -7,7 +7,7 @@ Rectangle { resources: [ Component { id: Delegate - Item { + Rectangle { id: wrapper objectName: "wrapper" height: 20 diff --git a/tests/auto/declarative/listview/tst_listview.cpp b/tests/auto/declarative/listview/tst_listview.cpp index 19d324d..2a5fa1c 100644 --- a/tests/auto/declarative/listview/tst_listview.cpp +++ b/tests/auto/declarative/listview/tst_listview.cpp @@ -33,7 +33,7 @@ private: template void removed(); QmlView *createView(const QString &filename); template - T *findItem(QFxItem *parent, const QString &id, int index=0); + T *findItem(QFxItem *parent, const QString &id, int index=-1); }; class TestModel : public QListModelInterface @@ -188,7 +188,7 @@ void tst_QFxListView::items() QFxItem *viewport = listview->viewport(); QVERIFY(viewport != 0); - QCOMPARE(viewport->childItems().count(), model.count()); // assumes all are visible + QCOMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item for (int i = 0; i < model.count(); ++i) { QFxText *name = findItem(viewport, "textName", i); @@ -262,7 +262,7 @@ void tst_QFxListView::inserted() // let transitions settle. QTest::qWait(1000); - QCOMPARE(viewport->childItems().count(), model.count()); // assumes all are visible + QCOMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item QFxText *name = findItem(viewport, "textName", 1); QVERIFY(name != 0); @@ -282,7 +282,7 @@ void tst_QFxListView::inserted() // let transitions settle. QTest::qWait(1000); - QCOMPARE(viewport->childItems().count(), model.count()); // assumes all are visible + QCOMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item name = findItem(viewport, "textName", 0); QVERIFY(name != 0); @@ -338,6 +338,8 @@ void tst_QFxListView::removed() // Confirm items positioned correctly for (int i = 0; i < model.count() && i < viewport->childItems().count(); ++i) { QFxItem *item = findItem(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); QVERIFY(item->y() == i*20); } @@ -357,6 +359,8 @@ void tst_QFxListView::removed() // Confirm items positioned correctly for (int i = 0; i < model.count() && i < viewport->childItems().count(); ++i) { QFxItem *item = findItem(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); QCOMPARE(item->y(),i*20.0 + 20.0); } @@ -368,6 +372,8 @@ void tst_QFxListView::removed() // Confirm items positioned correctly for (int i = 0; i < model.count() && i < viewport->childItems().count(); ++i) { QFxItem *item = findItem(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); QCOMPARE(item->y(),i*20.0+20.0); } @@ -382,6 +388,8 @@ void tst_QFxListView::removed() // Confirm items positioned correctly for (int i = 2; i < 18; ++i) { QFxItem *item = findItem(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); QCOMPARE(item->y(),40+i*20.0); } @@ -392,6 +400,8 @@ void tst_QFxListView::removed() // Confirm items positioned correctly for (int i = 0; i < model.count() && i < viewport->childItems().count(); ++i) { QFxItem *item = findItem(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); QCOMPARE(item->y(),40+i*20.0); } @@ -452,7 +462,7 @@ QmlView *tst_QFxListView::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 -- cgit v0.12