Stabilize tst_QColumnView::dynamicModelChanges().

Use QTest::qWaitForWindowExposed() and QTRY_COMPARE() instead of
hardcoded timeout.

Task-number: QTBUG-35308
Change-Id: I27eee9932dd3b6087db4ad13b1a4fb184a487f57
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
This commit is contained in:
Friedemann Kleint 2013-12-03 09:01:50 +01:00 committed by The Qt Project
parent 5361513ec8
commit d1f9f2125e

View File

@ -1043,13 +1043,14 @@ void tst_QColumnView::dynamicModelChanges()
ColumnView view;
view.setModel(&model);
view.setItemDelegate(&delegate);
centerOnScreen(&view);
view.show();
QStandardItem *item = new QStandardItem(QLatin1String("item"));
model.appendRow(item);
QTest::qWait(200); //let the time for painting to occur
QCOMPARE(delegate.paintedIndexes.count(), 1);
QVERIFY(QTest::qWaitForWindowExposed(&view)); //let the time for painting to occur
QTRY_COMPARE(delegate.paintedIndexes.count(), 1);
QCOMPARE(*delegate.paintedIndexes.begin(), model.index(0,0));