diff options
Diffstat (limited to 'tests/auto/qlistview/tst_qlistview.cpp')
-rw-r--r-- | tests/auto/qlistview/tst_qlistview.cpp | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/tests/auto/qlistview/tst_qlistview.cpp b/tests/auto/qlistview/tst_qlistview.cpp index 2281fb7..2be1a03 100644 --- a/tests/auto/qlistview/tst_qlistview.cpp +++ b/tests/auto/qlistview/tst_qlistview.cpp @@ -424,6 +424,18 @@ void tst_QListView::hideRows() view.setRowHidden(0, false); QVERIFY(!view.isRowHidden(0)); + QStandardItemModel sim(0); + QStandardItem *root = new QStandardItem("Root row"); + for (int i=0;i<5;i++) + root->appendRow(new QStandardItem(QString("Row %1").arg(i))); + sim.appendRow(root); + view.setModel(&sim); + view.setRootIndex(root->index()); + QVERIFY(!view.isRowHidden(0)); + view.setRowHidden(0, true); + QVERIFY(view.isRowHidden(0)); + view.setRowHidden(0, false); + QVERIFY(!view.isRowHidden(0)); } @@ -1602,13 +1614,6 @@ void tst_QListView::task254449_draggingItemToNegativeCoordinates() list.setModel(&model); list.setViewMode(QListView::IconMode); list.show(); - QTest::qWait(200); //makes sure the layout is done - - const QPoint topLeft(-6, 0); - - - list.setPositionForIndex(topLeft, index); - class MyItemDelegate : public QStyledItemDelegate { public: @@ -1622,15 +1627,18 @@ void tst_QListView::task254449_draggingItemToNegativeCoordinates() mutable int numPaints; } delegate; - list.setItemDelegate(&delegate); + QTest::qWait(200); //makes sure the layout is done + + const QPoint topLeft(-6, 0); + list.setPositionForIndex(topLeft, index); + //we'll make sure the item is repainted delegate.numPaints = 0; - list.viewport()->repaint(); - - QCOMPARE(list.visualRect(index).topLeft(), topLeft); - QCOMPARE(delegate.numPaints, 1); + QApplication::processEvents(); + QCOMPARE(list.visualRect(index).topLeft(), topLeft); + QCOMPARE(delegate.numPaints, 1); } |