diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-12-16 19:34:23 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2020-12-17 09:13:58 +0000 |
commit | c36eadc64a3db535246525b368634f08123655ef (patch) | |
tree | 2f8710704f31956132feb821385b442aa24549c4 /tests/auto | |
parent | cb96a2ca34089d739d67507de6e1326a0219c539 (diff) |
Windows/MinGW: Fix qqmltimer warnings flood
Replace the dubious function eventLoopWait() by
QThread::msleep() since it causes a warnings flood when using MinGW:
tst_qqmltimer::stopWhenEventPosted() QEventDispatcherWin32::wakeUp: Failed to post a message (Not enough quota is available to process this command.)
tst_qqmltimer::stopWhenEventPosted() QEventDispatcherWin32::wakeUp: Failed to post a message (Not enough quota is available to process this command.)
tst_qqmltimer::stopWhenEventPosted() QEventDispatcherWin32::wakeUp: Failed to post a message (Not enough quota is available to process this command.)
tst_qqmltimer::stopWhenEventPosted() QEventDispatcherWin32::wakeUp: Failed to post a message (Not enough quota is available to process this command.)
tst_qqmltimer::stopWhenEventPosted() QEventDispatcherWin32::wakeUp: Failed to post a message (Not enough quota is available to process this command.)
tst_qqmltimer::stopWhenEventPosted() QEventDispatcherWin32::wakeUp: Failed to post a message (Not enough quota is available to process this command.)
tst_qqmltimer::stopWhenEventPosted() QEventDispatcherWin32::wakeUp: Failed to post a message (Not enough quota is available to process this command.)
tst_qqmltimer::stopWhenEventPosted() QEventDispatcherWin32::wakeUp: Failed to post a message (Not enough quota is available to process this command.)
Change-Id: I161d1d025f79560b21aaaeb510e4956eba54bdea
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit d9a6c45a06f23cdd896e5360cc3cd3608fea4c3e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qml/qqmltimer/tst_qqmltimer.cpp | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/tests/auto/qml/qqmltimer/tst_qqmltimer.cpp b/tests/auto/qml/qqmltimer/tst_qqmltimer.cpp index 0168663cf2..a05b03ca64 100644 --- a/tests/auto/qml/qqmltimer/tst_qqmltimer.cpp +++ b/tests/auto/qml/qqmltimer/tst_qqmltimer.cpp @@ -45,23 +45,6 @@ void consistentWait(int ms) QTest::qWait(20); } -void eventLoopWait(int ms) -{ - // QTest::qWait() always calls sendPostedEvents before exiting, so we can't use it to stop - // between an event is posted and it is received; But we can use an event loop instead - - QPauseAnimation waitTimer(ms); - waitTimer.start(); - while (waitTimer.state() == QAbstractAnimation::Running) - { - QTimer timer; - QEventLoop eventLoop; - timer.start(0); - timer.connect(&timer, &QTimer::timeout, &eventLoop, &QEventLoop::quit); - eventLoop.exec(); - } -} - class tst_qqmltimer : public QObject { Q_OBJECT @@ -419,7 +402,9 @@ void tst_qqmltimer::stopWhenEventPosted() connect(timer, SIGNAL(triggered()), &helper, SLOT(timeout())); QCOMPARE(helper.count, 0); - eventLoopWait(200); + // Use QThread::msleep() as QTest::qWait() always calls sendPostedEvents before + // exiting, so we can't use it to stop between an event is posted and it is received. + QThread::msleep(200); QCOMPARE(helper.count, 0); QVERIFY(timer->isRunning()); timer->stop(); @@ -441,7 +426,9 @@ void tst_qqmltimer::restartWhenEventPosted() connect(timer, SIGNAL(triggered()), &helper, SLOT(timeout())); QCOMPARE(helper.count, 0); - eventLoopWait(200); + // Use QThread::msleep() as QTest::qWait() always calls sendPostedEvents before + // exiting, so we can't use it to stop between an event is posted and it is received. + QThread::msleep(200); QCOMPARE(helper.count, 0); timer->restart(); |