diff options
author | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2018-05-03 20:06:56 +0200 |
---|---|---|
committer | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2018-05-10 14:03:27 +0000 |
commit | 0993a9e8307a8c7a4078dbda72db540cf5514d74 (patch) | |
tree | 8a1b8ff2931bf3e069d01ba39494501d3763b3e3 /tests/auto | |
parent | f02256cce12392a35d177511e39052985fc720ac (diff) |
tst_QHeaderView: replace custom waitFor() function
replace custom waitFor() function with QTest::qWaitFor() to avoid code
duplication.
Change-Id: I44ebcbfe4c6f6c6f787fb7dbaf958a245bc27fa1
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp index e7a98955cd..a15c1aafe7 100644 --- a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp +++ b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp @@ -2283,7 +2283,7 @@ void tst_QHeaderView::QTBUG6058_reset() QHeaderView view(Qt::Vertical); view.setModel(&proxy); view.show(); - QTest::qWait(20); + QVERIFY(QTest::qWaitForWindowExposed(&view)); proxy.setSourceModel(&model1); QApplication::processEvents(); @@ -3294,16 +3294,6 @@ void tst_QHeaderView::testMinMaxSectionSizeNotStretched() testMinMaxSectionSize(false); } -static void waitFor(const std::function<bool()> &func) -{ - for (int i = 0; i < 100; i++) - { - if (func()) - return; - QTest::qWait(10); - } -} - void tst_QHeaderView::testMinMaxSectionSize(bool stretchLastSection) { QStandardItemModel m(5, 5); @@ -3341,7 +3331,7 @@ void tst_QHeaderView::testMinMaxSectionSize(bool stretchLastSection) header.resizeSection(0, sectionSizeMax); QCOMPARE(header.sectionSize(0), sectionSizeMax); header.setMaximumSectionSize(defaultSectionSize); - waitFor([&header, defaultSectionSize]() { return header.sectionSize(0) == defaultSectionSize; }); + QVERIFY(QTest::qWaitFor([&header, defaultSectionSize]() { return header.sectionSize(0) == defaultSectionSize; })); QCOMPARE(header.sectionSize(0), defaultSectionSize); // change section size on min change @@ -3350,7 +3340,7 @@ void tst_QHeaderView::testMinMaxSectionSize(bool stretchLastSection) header.resizeSection(0, sectionSizeMin); QCOMPARE(header.sectionSize(0), sectionSizeMin); header.setMinimumSectionSize(defaultSectionSize); - waitFor([&header, defaultSectionSize]() { return header.sectionSize(0) == defaultSectionSize; }); + QVERIFY(QTest::qWaitFor([&header, defaultSectionSize]() { return header.sectionSize(0) == defaultSectionSize; })); QCOMPARE(header.sectionSize(0), defaultSectionSize); } |