diff options
author | Kari Oikarinen <kari.oikarinen@qt.io> | 2018-04-05 15:57:35 +0300 |
---|---|---|
committer | Kari Oikarinen <kari.oikarinen@qt.io> | 2018-04-25 05:47:01 +0000 |
commit | 73031ebb998b687b0997bae7beeef37571c2b360 (patch) | |
tree | 0186b808a2001bac687476a515bb16b75a2db527 /tests/auto/widgets/styles | |
parent | 8ac0e6592bdf0f846586cfe9f15c2c4bf80f01e7 (diff) |
tests/auto/widgets/{effects,styles}: Avoid unconditional qWait()s
Task-number: QTBUG-63992
Change-Id: I1af537bae705d4627880c5ae50669b1ef72562f2
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'tests/auto/widgets/styles')
-rw-r--r-- | tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp index 7953077152..28a099de83 100644 --- a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp +++ b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp @@ -1136,7 +1136,7 @@ void tst_QStyleSheetStyle::minmaxSizes() centerOnScreen(&tabWidget); tabWidget.show(); - QTest::qWait(50); + QVERIFY(QTest::qWaitForWindowActive(&tabWidget)); //i allow 4px additional border from the native style (hence the -2, <=2) QVERIFY(qAbs(page2->maximumSize().width() - 500 - 2) <= 2); QVERIFY(qAbs(page2->minimumSize().width() - 250 - 2) <= 2); @@ -1165,7 +1165,7 @@ void tst_QStyleSheetStyle::task206238_twice() w.setStyleSheet("background: red;"); centerOnScreen(&w); w.show(); - QTest::qWait(20); + QVERIFY(QTest::qWaitForWindowActive(&w)); QCOMPARE(BACKGROUND(w) , red); QCOMPARE(BACKGROUND(*tw), red); w.setStyleSheet("background: red;"); @@ -1366,8 +1366,7 @@ void tst_QStyleSheetStyle::proxyStyle() layout->addWidget(pb5); w->show(); - - QTest::qWait(100); + QVERIFY(QTest::qWaitForWindowActive(w)); // Test for QTBUG-7198 - style sheet overrides custom element size QStyleOptionViewItem opt; @@ -1557,9 +1556,9 @@ void tst_QStyleSheetStyle::embeddedFonts() box.addItems(QStringList() << "First" << "Second" << "Third"); box.setStyleSheet("QComboBox { font-size: 32px; }"); box.show(); + QVERIFY(QTest::qWaitForWindowActive(&box)); embedded = box.findChild<QLineEdit *>(); QVERIFY(embedded); - QTest::qWait(20); QCOMPARE(box.font().pixelSize(), 32); QCOMPARE(embedded->font().pixelSize(), 32); } @@ -1652,7 +1651,7 @@ void tst_QStyleSheetStyle::task188195_baseBackground() tree.setStyleSheet( "QTreeView:disabled { background-color:#ab1251; }" ); tree.move(QGuiApplication::primaryScreen()->availableGeometry().topLeft() + QPoint(20, 100)); tree.show(); - QTest::qWait(20); + QVERIFY(QTest::qWaitForWindowActive(&tree)); QImage image(tree.width(), tree.height(), QImage::Format_ARGB32); tree.render(&image); @@ -1673,7 +1672,7 @@ void tst_QStyleSheetStyle::task188195_baseBackground() table.setStyleSheet( "QTableView {background-color: #ff0000}" ); table.move(QGuiApplication::primaryScreen()->availableGeometry().topLeft() + QPoint(300, 100)); table.show(); - QTest::qWait(20); + QVERIFY(QTest::qWaitForWindowActive(&table)); image = QImage(table.width(), table.height(), QImage::Format_ARGB32); table.render(&image); QVERIFY(testForColors(image, Qt::red, true)); |