Fix race condition in the processEvents test
This test verifies processEvents(WaitForMoreEvents) behavior by first processing all pending events (in a loop) and then verifying that a following processEvents call actually waits. But there is no guarantee that the OS won’t introduce more events after the first loop has completed. This does indeed seem to happen on recent versions of macOS. Change the test to not require that the processEvents call blocked and de-blacklist. Task-number: QTBUG-61131 Change-Id: Ic8fa74a6085165442791264f6f137a2fa6083138 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
parent
0e9ea94511
commit
4585889467
@ -216,12 +216,11 @@ void tst_QEventLoop::processEvents()
|
|||||||
awakeSpy.clear();
|
awakeSpy.clear();
|
||||||
QVERIFY(eventLoop.processEvents(QEventLoop::WaitForMoreEvents));
|
QVERIFY(eventLoop.processEvents(QEventLoop::WaitForMoreEvents));
|
||||||
|
|
||||||
// Verify that the eventloop has blocked and woken up. Some eventloops
|
|
||||||
// may block and wake up multiple times.
|
|
||||||
QVERIFY(aboutToBlockSpy.count() > 0);
|
|
||||||
QVERIFY(awakeSpy.count() > 0);
|
|
||||||
// We should get one awake for each aboutToBlock, plus one awake when
|
// We should get one awake for each aboutToBlock, plus one awake when
|
||||||
// processEvents is entered.
|
// processEvents is entered. There is no guarantee that that the
|
||||||
|
// processEvents call actually blocked, since the OS may introduce
|
||||||
|
// native events at any time.
|
||||||
|
QVERIFY(awakeSpy.count() > 0);
|
||||||
QVERIFY(awakeSpy.count() >= aboutToBlockSpy.count());
|
QVERIFY(awakeSpy.count() >= aboutToBlockSpy.count());
|
||||||
|
|
||||||
killTimer(timerId);
|
killTimer(timerId);
|
||||||
|
@ -1,4 +1,2 @@
|
|||||||
[processEvents]
|
|
||||||
osx-10.12
|
|
||||||
[testQuitLock]
|
[testQuitLock]
|
||||||
osx-10.12
|
osx-10.12
|
||||||
|
Loading…
Reference in New Issue
Block a user