From 4771c0c950ddca12ebadf69f2baf312609ce18d7 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 22 Sep 2009 10:55:55 +0200 Subject: Make QDialog, and QTreeView test more robust --- tests/auto/qdialog/tst_qdialog.cpp | 8 ++++++-- tests/auto/qtreeview/tst_qtreeview.cpp | 8 ++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/tests/auto/qdialog/tst_qdialog.cpp b/tests/auto/qdialog/tst_qdialog.cpp index 5f2ccd3..dc6878d 100644 --- a/tests/auto/qdialog/tst_qdialog.cpp +++ b/tests/auto/qdialog/tst_qdialog.cpp @@ -194,7 +194,7 @@ void tst_QDialog::showExtension() QCOMPARE( testWidget->size(), dlgSize ); QPoint oldPosition = testWidget->pos(); - + #ifdef Q_WS_S60 const int htDiff = ext->size().height() - testWidget->size().height(); #endif @@ -202,7 +202,7 @@ void tst_QDialog::showExtension() ((DummyDialog*)testWidget)->showExtension( TRUE ); // while ( testWidget->size() == dlgSize ) // qApp->processEvents(); - + #ifdef Q_WS_S60 QPoint expectedPosition; if (!horizontal) { @@ -584,6 +584,7 @@ void tst_QDialog::reject() { TestRejectDialog dialog; dialog.show(); + QTest::qWaitForWindowShown(&dialog); QTest::qWait(100); QVERIFY(dialog.isVisible()); dialog.reject(); @@ -592,7 +593,9 @@ void tst_QDialog::reject() QCOMPARE(dialog.called, 1); dialog.show(); + QTest::qWaitForWindowShown(&dialog); QTest::qWait(100); + QVERIFY(dialog.isVisible()); QVERIFY(dialog.close()); QTest::qWait(100); @@ -601,6 +604,7 @@ void tst_QDialog::reject() dialog.cancelReject = true; dialog.show(); + QTest::qWaitForWindowShown(&dialog); QTest::qWait(100); QVERIFY(dialog.isVisible()); dialog.reject(); diff --git a/tests/auto/qtreeview/tst_qtreeview.cpp b/tests/auto/qtreeview/tst_qtreeview.cpp index bad36c1..112bcc8 100644 --- a/tests/auto/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/qtreeview/tst_qtreeview.cpp @@ -906,7 +906,7 @@ void tst_QTreeView::iconSize() view.show(); view.update(); - QTest::qWait(100); + QTest::qWaitForWindowShown(&view); QTRY_VERIFY(view.repainted); QCOMPARE(view.iconSize(), QSize()); @@ -3055,7 +3055,7 @@ void tst_QTreeView::task216717_updateChildren() bool refreshed; } tree; tree.show(); - QTest::qWait(100); + QTest::qWaitForWindowShown(&tree); tree.refreshed = false; QTreeWidgetItem *parent = new QTreeWidgetItem(QStringList() << "parent"); tree.addTopLevelItem(parent); @@ -3344,7 +3344,7 @@ void tst_QTreeView::task246536_scrollbarsNotWorking() QStandardItemModel model; tree.setModel(&model); tree.show(); - QTest::qWait(100); + QTest::qWaitForWindowShown(&tree); QList items; for(int i=0; i<100; ++i){ items << new QStandardItem(QString::fromLatin1("item %1").arg(i)); @@ -3399,7 +3399,7 @@ void tst_QTreeView::task239271_addRowsWithFirstColumnHidden() view.hideColumn(0); view.show(); - QTest::qWait(200); + QTest::qWaitForWindowShown(&view); delegate.paintedIndexes.clear(); QStandardItem sub1("sub1"), sub11("sub11"); root0.appendRow(QList() << &sub1 << &sub11); -- cgit v0.12