diff options
author | Ahmad Samir <a.samirh78@gmail.com> | 2023-02-15 13:08:30 +0200 |
---|---|---|
committer | Ahmad Samir <a.samirh78@gmail.com> | 2023-03-03 21:36:48 +0200 |
commit | 2a495c25961d73353339e165d4a4edbce91d7d2c (patch) | |
tree | 773be6d50a9867f7684ee360156a25222d5e0a0b /tests/auto/corelib/thread | |
parent | 855a6cb6767a7759f00f52acf501fabb38bc1243 (diff) |
QTestEventLoop: add enterLoop(std::chrono::milliseconds) overload
Task-number: QTBUG-110059
Change-Id: Ibf1d76afd313e390103be4a22e44af7fb41ace1b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/thread')
-rw-r--r-- | tests/auto/corelib/thread/qfuture/tst_qfuture.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/tests/auto/corelib/thread/qfuture/tst_qfuture.cpp b/tests/auto/corelib/thread/qfuture/tst_qfuture.cpp index deba56d3b1..08684c45f1 100644 --- a/tests/auto/corelib/thread/qfuture/tst_qfuture.cpp +++ b/tests/auto/corelib/thread/qfuture/tst_qfuture.cpp @@ -30,6 +30,9 @@ # undef interface #endif +using namespace std::chrono_literals; +static constexpr auto DefaultWaitTime = 2s; + using namespace Qt::StringLiterals; class SenderObject : public QObject @@ -3487,7 +3490,7 @@ void tst_QFuture::runAndTake() auto gotcha = QtConcurrent::run(rabbit); watcha.setFuture(gotcha); - loop.enterLoopMSecs(500); + loop.enterLoop(500ms); if (loop.timeout()) QSKIP("Failed to run the task, nothing to test"); @@ -3558,7 +3561,7 @@ void tst_QFuture::resultsReadyAt() // Run event loop, QCoreApplication::postEvent is in use // in QFutureInterface: - eventProcessor.enterLoopMSecs(2000); + eventProcessor.enterLoop(DefaultWaitTime); QVERIFY(!eventProcessor.timeout()); if (QTest::currentTestFailed()) // Failed in our lambda observing 'ready at' return; @@ -3933,7 +3936,7 @@ void tst_QFuture::rejectResultOverwrite() }); // Run event loop, QCoreApplication::postEvent is in use // in QFutureInterface: - eventProcessor.enterLoopMSecs(2000); + eventProcessor.enterLoop(DefaultWaitTime); QVERIFY(!eventProcessor.timeout()); QCOMPARE(resultCounter.size(), 1); f.resume(); @@ -3972,7 +3975,7 @@ void tst_QFuture::rejectResultOverwrite() QTimer::singleShot(50, [&f]() { f.suspend(); // should exit the loop }); - eventProcessor.enterLoopMSecs(2000); + eventProcessor.enterLoop(DefaultWaitTime); QVERIFY(!eventProcessor.timeout()); QCOMPARE(resultCounter.size(), 1); f.resume(); @@ -4011,7 +4014,7 @@ void tst_QFuture::rejectPendingResultOverwrite() }); // Run event loop, QCoreApplication::postEvent is in use // in QFutureInterface: - eventProcessor.enterLoopMSecs(2000); + eventProcessor.enterLoop(DefaultWaitTime); QVERIFY(!eventProcessor.timeout()); QCOMPARE(resultCounter.size(), 1); f.resume(); @@ -4055,7 +4058,7 @@ void tst_QFuture::rejectPendingResultOverwrite() QTimer::singleShot(50, [&f]() { f.suspend(); // should exit the loop }); - eventProcessor.enterLoopMSecs(2000); + eventProcessor.enterLoop(DefaultWaitTime); QVERIFY(!eventProcessor.timeout()); QCOMPARE(resultCounter.size(), 1); f.resume(); |