From 40495ce75cb36a5bc750e8ef2df4473534586a81 Mon Sep 17 00:00:00 2001 From: Andreas Buhr Date: Tue, 6 Oct 2020 15:07:06 +0200 Subject: Fix tst_qtimer::zeroTimer unit test The tst_qtimer::zeroTimer unit test was relying on QCoreApplication::processEvents processing all pending events. However, for the glib backend, this is not the case. For the glib backend, if there is an event of high priority pending, low priority events are not processed. This patch changes the test to use the overload with timeout of processEvents, which does process events until there are no more events or the timeout is reached. Fixes: QTBUG-84291 Change-Id: I429141507b8603b57a191efa21f154493d75cc9e Reviewed-by: Lars Knoll Reviewed-by: Qt CI Bot --- tests/auto/corelib/kernel/qtimer/BLACKLIST | 2 -- tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp | 4 +++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/auto/corelib/kernel/qtimer/BLACKLIST b/tests/auto/corelib/kernel/qtimer/BLACKLIST index 977b3a673a..e69de29bb2 100644 --- a/tests/auto/corelib/kernel/qtimer/BLACKLIST +++ b/tests/auto/corelib/kernel/qtimer/BLACKLIST @@ -1,2 +0,0 @@ -[zeroTimer] -ubuntu-20.04 diff --git a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp index 1db210e0bd..00686ab46e 100644 --- a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp +++ b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp @@ -94,11 +94,13 @@ void tst_QTimer::zeroTimer() { QTimer timer; timer.setInterval(0); + timer.setSingleShot(true); QSignalSpy timeoutSpy(&timer, &QTimer::timeout); timer.start(); - QCoreApplication::processEvents(); + // Pass timeout to work round glib issue, see QTBUG-84291. + QCoreApplication::processEvents(QEventLoop::AllEvents, INT_MAX); QCOMPARE(timeoutSpy.count(), 1); } -- cgit v1.2.3