summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJoão Abecasis <joao@abecasis.name>2009-09-21 13:46:24 (GMT)
committerJoão Abecasis <joao@abecasis.name>2009-09-21 15:04:42 (GMT)
commit5c360b8c9c11464ce7421989c38002444bedbe3b (patch)
treea9387eccd078770083894742f187f1319f9e05b5 /tests
parent79ef57eeb4585122c91093d9638bcbd0f4c3568c (diff)
downloadQt-5c360b8c9c11464ce7421989c38002444bedbe3b.zip
Qt-5c360b8c9c11464ce7421989c38002444bedbe3b.tar.gz
Qt-5c360b8c9c11464ce7421989c38002444bedbe3b.tar.bz2
Removing needless qWaits and replacing others with QTRY_VERIFYs
For more dependable test results.
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qcombobox/tst_qcombobox.cpp51
1 files changed, 30 insertions, 21 deletions
diff --git a/tests/auto/qcombobox/tst_qcombobox.cpp b/tests/auto/qcombobox/tst_qcombobox.cpp
index da97c7d..1b1eb1f 100644
--- a/tests/auto/qcombobox/tst_qcombobox.cpp
+++ b/tests/auto/qcombobox/tst_qcombobox.cpp
@@ -880,11 +880,11 @@ void tst_QComboBox::hide()
{
testWidget->addItem("foo");
testWidget->showPopup();
- QTest::qWait(200); //allow combobox effect to complete
+ //allow combobox effect to complete
QTRY_VERIFY(testWidget->view());
QTRY_VERIFY(testWidget->view()->isVisible());
testWidget->hidePopup();
- QTest::qWait(200); //allow combobox effect to complete
+ //allow combobox effect to complete
QTRY_VERIFY(!testWidget->view()->isVisible());
testWidget->hide();
QVERIFY(!testWidget->isVisible());
@@ -1920,9 +1920,11 @@ void tst_QComboBox::itemListPosition()
combo.move(screen.width()-combo.sizeHint().width(), 0); //puts the combo to the top-right corner
combo.show();
- QTest::qWait(100); //wait because the window manager can move the window if there is a right panel
+ //wait because the window manager can move the window if there is a right panel
+ QTRY_VERIFY(combo.isVisible());
combo.showPopup();
- QTest::qWait(100);
+ QTRY_VERIFY(combo.view());
+ QTRY_VERIFY(combo.view()->isVisible());
#if defined(Q_WS_S60)
// Assuming that QtS60 style is used, here. But other ones would certainly also fail
@@ -1975,10 +1977,11 @@ void tst_QComboBox::task190351_layout()
list->addItem(QLatin1String("list") + QString::number(i));
listCombo.show();
- QTest::qWait(100);
+ QTRY_VERIFY(listCombo.isVisible());
listCombo.setCurrentIndex(70);
listCombo.showPopup();
- QTest::qWait(100);
+ QTRY_VERIFY(listCombo.view());
+ QTRY_VERIFY(listCombo.view()->isVisible());
#ifdef QT_BUILD_INTERNAL
QFrame *container = qFindChild<QComboBoxPrivateContainer *>(&listCombo);
@@ -2050,9 +2053,10 @@ void tst_QComboBox::task191329_size()
tableCombo.setModel(&model);
tableCombo.show();
- QTest::qWait(100);
+ QTRY_VERIFY(tableCombo.isVisible());
tableCombo.showPopup();
- QTest::qWait(100);
+ QTRY_VERIFY(tableCombo.view());
+ QTRY_VERIFY(tableCombo.view()->isVisible());
#ifdef QT_BUILD_INTERNAL
QFrame *container = qFindChild<QComboBoxPrivateContainer *>(&tableCombo);
@@ -2082,12 +2086,11 @@ void tst_QComboBox::task190205_setModelAdjustToContents()
box.addItems(initialContent);
box.show();
- QTest::qWait(100); //wait needed in order to get the combo initial size
+ //wait needed in order to get the combo initial size
+ QTRY_VERIFY(box.isVisible());
box.setModel(new QStringListModel(finalContent));
- QTest::qWait(500); //wait needed in order to resize the combo
-
QComboBox correctBox;
correctBox.addItems(finalContent);
correctBox.show();
@@ -2114,9 +2117,10 @@ void tst_QComboBox::task248169_popupWithMinimalSize()
comboBox.setGeometry(desktop.availableGeometry().width() - 200, 100, 200, 100);
comboBox.show();
- QTest::qWait(100);
+ QTRY_VERIFY(comboBox.isVisible());
comboBox.showPopup();
- QTest::qWait(100);
+ QTRY_VERIFY(comboBox.view());
+ QTRY_VERIFY(comboBox.view()->isVisible());
#ifdef QT_BUILD_INTERNAL
QFrame *container = qFindChild<QComboBoxPrivateContainer *>(&comboBox);
@@ -2133,7 +2137,7 @@ void tst_QComboBox::task247863_keyBoardSelection()
combo.addItem( QLatin1String("222"));
combo.show();
QApplication::setActiveWindow(&combo);
- QTest::qWait(100);
+ QTRY_COMPARE(QApplication::activeWindow(), &combo);
QSignalSpy spy(&combo, SIGNAL(activated(const QString &)));
qApp->setEffectEnabled(Qt::UI_AnimateCombo, false);
@@ -2154,7 +2158,7 @@ void tst_QComboBox::task220195_keyBoardSelection2()
combo.addItem( QLatin1String("foo3"));
combo.show();
QApplication::setActiveWindow(&combo);
- QTest::qWait(100);
+ QTRY_COMPARE(QApplication::activeWindow(), &combo);
combo.setCurrentIndex(-1);
QVERIFY(combo.currentText().isNull());
@@ -2234,9 +2238,11 @@ void tst_QComboBox::noScrollbar()
comboBox.addItems(initialContent);
comboBox.show();
comboBox.resize(200, comboBox.height());
- QTest::qWait(100);
+ QTRY_VERIFY(comboBox.isVisible());
comboBox.showPopup();
- QTest::qWait(100);
+ QTRY_VERIFY(comboBox.view());
+ QTRY_VERIFY(comboBox.view()->isVisible());
+
QVERIFY(!comboBox.view()->horizontalScrollBar()->isVisible());
QVERIFY(!comboBox.view()->verticalScrollBar()->isVisible());
}
@@ -2247,10 +2253,12 @@ void tst_QComboBox::noScrollbar()
comboBox.setModel(table->model());
comboBox.setView(table);
comboBox.show();
- QTest::qWait(100);
+ QTRY_VERIFY(comboBox.isVisible());
comboBox.resize(200, comboBox.height());
comboBox.showPopup();
- QTest::qWait(100);
+ QTRY_VERIFY(comboBox.view());
+ QTRY_VERIFY(comboBox.view()->isVisible());
+
QVERIFY(!comboBox.view()->horizontalScrollBar()->isVisible());
QVERIFY(!comboBox.view()->verticalScrollBar()->isVisible());
}
@@ -2367,9 +2375,10 @@ void tst_QComboBox::task260974_menuItemRectangleForComboBoxPopup()
comboBox.addItem("Item 1");
comboBox.show();
- QTest::qWait(100);
+ QTRY_VERIFY(comboBox.isVisible());
comboBox.showPopup();
- QTest::qWait(100);
+ QTRY_VERIFY(comboBox.view());
+ QTRY_VERIFY(comboBox.view()->isVisible());
QTRY_VERIFY(style.discoveredRect.width() <= comboBox.width());
}