mirror of https://github.com/qt/qtbase.git
tests/auto/widgets/kernel: Avoid unconditional qWait()s
Task-number: QTBUG-63992 Change-Id: Icb32b516002c3bb2841c8e7a29624e54cfcbbcac Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
This commit is contained in:
parent
c579f49e2a
commit
15ada2b917
|
@ -288,7 +288,6 @@ void tst_QApplication::alert()
|
|||
widget2.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&widget));
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&widget2));
|
||||
QTest::qWait(100);
|
||||
app.alert(&widget, -1);
|
||||
app.alert(&widget, 250);
|
||||
widget2.activateWindow();
|
||||
|
@ -1711,6 +1710,7 @@ void tst_QApplication::focusOut()
|
|||
le2->setStyleSheet("background: #fee");
|
||||
le2->move(100, 100);
|
||||
w.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&w));
|
||||
|
||||
QTest::qWait(2000);
|
||||
le2->setFocus();
|
||||
|
|
|
@ -226,15 +226,13 @@ void tst_QBoxLayout::setStyleShouldChangeSpacing()
|
|||
window.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&window));
|
||||
|
||||
int spacing = pb2->geometry().left() - pb1->geometry().right() - 1;
|
||||
QCOMPARE(spacing, 6);
|
||||
auto spacing = [&]() { return pb2->geometry().left() - pb1->geometry().right() - 1; };
|
||||
QCOMPARE(spacing(), 6);
|
||||
|
||||
QScopedPointer<CustomLayoutStyle> style2(new CustomLayoutStyle());
|
||||
style2->hspacing = 10;
|
||||
window.setStyle(style2.data());
|
||||
QTest::qWait(100);
|
||||
spacing = pb2->geometry().left() - pb1->geometry().right() - 1;
|
||||
QCOMPARE(spacing, 10);
|
||||
QTRY_COMPARE(spacing(), 10);
|
||||
}
|
||||
|
||||
void tst_QBoxLayout::taskQTBUG_7103_minMaxWidthNotRespected()
|
||||
|
|
|
@ -164,7 +164,7 @@ private slots:
|
|||
|
||||
void tst_QFormLayout::cleanup()
|
||||
{
|
||||
QVERIFY(QApplication::topLevelWidgets().isEmpty());
|
||||
QTRY_VERIFY(QApplication::topLevelWidgets().isEmpty());
|
||||
}
|
||||
|
||||
void tst_QFormLayout::rowCount()
|
||||
|
@ -1188,7 +1188,6 @@ void tst_QFormLayout::layoutAlone()
|
|||
w.setWindowTitle(QTest::currentTestFunction());
|
||||
w.show();
|
||||
layout.activate();
|
||||
QTest::qWait(500);
|
||||
}
|
||||
|
||||
void tst_QFormLayout::taskQTBUG_27420_takeAtShouldUnparentLayout()
|
||||
|
|
|
@ -1441,7 +1441,6 @@ void tst_QGridLayout::layoutSpacing()
|
|||
|
||||
QLayout *layout = widget->layout();
|
||||
QVERIFY(layout);
|
||||
//QTest::qWait(2000);
|
||||
for (int pi = 0; pi < expectedpositions.count(); ++pi) {
|
||||
QLayoutItem *item = layout->itemAt(pi);
|
||||
//qDebug() << item->widget()->pos();
|
||||
|
|
|
@ -604,7 +604,7 @@ void tst_QShortcut::disabledItems()
|
|||
{
|
||||
clearAllShortcuts();
|
||||
mainW->activateWindow();
|
||||
QTest::qWait(100);
|
||||
QVERIFY(QTest::qWaitForWindowActive(mainW));
|
||||
|
||||
/* Testing Disabled Shortcuts
|
||||
Qt::Key_M on slot1
|
||||
|
|
|
@ -103,7 +103,7 @@ void tst_QStackedLayout::init()
|
|||
// make sure the tests work with focus follows mouse
|
||||
QCursor::setPos(testWidget->geometry().center());
|
||||
testWidget->activateWindow();
|
||||
QTest::qWait(250);
|
||||
QVERIFY(QTest::qWaitForWindowActive(testWidget));
|
||||
}
|
||||
|
||||
void tst_QStackedLayout::cleanup()
|
||||
|
@ -251,24 +251,13 @@ void tst_QStackedLayout::removeWidget()
|
|||
testLayout->addWidget(w2);
|
||||
vbox->addLayout(testLayout);
|
||||
top->setFocus();
|
||||
QTest::qWait(100);
|
||||
top->activateWindow();
|
||||
QTest::qWait(100);
|
||||
int i =0;
|
||||
for (;;) {
|
||||
if (QApplication::focusWidget() == top)
|
||||
break;
|
||||
else if (i >= 5)
|
||||
QSKIP("Can't get focus");
|
||||
QTest::qWait(100);
|
||||
++i;
|
||||
}
|
||||
QCOMPARE(QApplication::focusWidget(), static_cast<QWidget *>(top));
|
||||
QTRY_COMPARE(QApplication::focusWidget(), top);
|
||||
|
||||
// focus should stay at the 'top' widget
|
||||
testLayout->removeWidget(w1);
|
||||
|
||||
QCOMPARE(QApplication::focusWidget(), static_cast<QWidget *>(top));
|
||||
QCOMPARE(QApplication::focusWidget(), top);
|
||||
}
|
||||
|
||||
class LineEdit : public QLineEdit
|
||||
|
|
|
@ -146,13 +146,7 @@ void tst_QWindowContainer::testExposeObscure()
|
|||
|
||||
container->hide();
|
||||
|
||||
QElapsedTimer timer;
|
||||
timer.start();
|
||||
while (window->numberOfObscures == 0 && timer.elapsed() < 5000) {
|
||||
QTest::qWait(10);
|
||||
}
|
||||
|
||||
QVERIFY(window->numberOfObscures > 0);
|
||||
QTRY_VERIFY(window->numberOfObscures > 0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -345,11 +339,9 @@ void tst_QWindowContainer::testDockWidget()
|
|||
QVERIFY(QTest::qWaitForWindowExposed(&mainWindow));
|
||||
QCOMPARE(window->parent(), mainWindow.window()->windowHandle());
|
||||
|
||||
QTest::qWait(1000);
|
||||
dock->setFloating(true);
|
||||
QTRY_VERIFY(window->parent() != mainWindow.window()->windowHandle());
|
||||
|
||||
QTest::qWait(1000);
|
||||
dock->setFloating(false);
|
||||
QTRY_COMPARE(window->parent(), mainWindow.window()->windowHandle());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue