Details
-
Bug
-
Resolution: Duplicate
-
P4: Low
-
None
-
6.9
-
None
Description
It should be possible to use 0 as a timeout to QTRY_*_WITH_TIMEOUT functions, just as it's possible to do so with qWait and e.g. QTimer::singleShot:
As a special case, a QTimer with a timeout of 0 will time out as soon as possible, though the ordering between zero timers and other sources of events is unspecified. [...]
To reproduce, cherry-pick https://codereview.qt-project.org/c/qt/qtbase/+/43330/11 and then run tst_queue timeoutTest, or the attached coreapptest. The test will pass:
09:29:15: Starting /home/mitch/dev/temp/coreapptest-qt_dev_debug-Debug/coreapptest... ********* Start testing of coreapptest ********* Config: Using QtTest library 6.9.0, Qt 6.9.0 (x86_64-little_endian-lp64 shared (dynamic) debug build; by GCC 11.4.0), ubuntu 22.04 PASS : coreapptest::initTestCase() QDEBUG : coreapptest::timeout() called tt.queuedInvoke() QDEBUG : coreapptest::timeout() before first wait QDEBUG : coreapptest::timeout() first wait QDEBUG : coreapptest::timeout() about to call processEvents QDEBUG : coreapptest::timeout() doStuff called; setting b to true QDEBUG : coreapptest::timeout() called processEvents QDEBUG : coreapptest::timeout() QTRY_TIMEOUT_DEBUG_IMPL is checking QTest::runningTest() true QTest::currentTestResolved() false (expr) true PASS : coreapptest::timeout() PASS : coreapptest::cleanupTestCase() Totals: 3 passed, 0 failed, 0 skipped, 0 blacklisted, 1ms ********* Finished testing of coreapptest ********* 09:29:15: /home/mitch/dev/temp/coreapptest-qt_dev_debug-Debug/coreapptest exited with code 0
The same test with QGuiApplication fails:
09:29:33: Starting /home/mitch/dev/temp/guiapptest-qt_dev_debug-Debug/guiapptest... ********* Start testing of guiapptest ********* Config: Using QtTest library 6.9.0, Qt 6.9.0 (x86_64-little_endian-lp64 shared (dynamic) debug build; by GCC 11.4.0), ubuntu 22.04 PASS : guiapptest::initTestCase() QDEBUG : guiapptest::timeout() called tt.queuedInvoke() QDEBUG : guiapptest::timeout() before first wait QDEBUG : guiapptest::timeout() first wait QDEBUG : guiapptest::timeout() about to call processEvents QDEBUG : guiapptest::timeout() called processEvents QDEBUG : guiapptest::timeout() QTRY_TIMEOUT_DEBUG_IMPL is checking QTest::runningTest() true QTest::currentTestResolved() false (expr) false QDEBUG : guiapptest::timeout() QTRY_TIMEOUT_DEBUG_IMPL is calling QTRY_LOOP_IMPL QDEBUG : guiapptest::timeout() before first wait QDEBUG : guiapptest::timeout() first wait QDEBUG : guiapptest::timeout() about to call processEvents QDEBUG : guiapptest::timeout() doStuff called; setting b to true QDEBUG : guiapptest::timeout() called processEvents FAIL! : guiapptest::timeout() QTestLib: This test case check ("(tt.b) == (true)") failed because the requested timeout (0 ms) was too short, 0 ms would have been sufficient this time. Loc: [/home/mitch/dev/temp/guiapptest/tst_guiapptest.cpp(65)] PASS : guiapptest::cleanupTestCase() Totals: 2 passed, 1 failed, 0 skipped, 0 blacklisted, 2ms ********* Finished testing of guiapptest ********* 09:29:34: /home/mitch/dev/temp/guiapptest-qt_dev_debug-Debug/guiapptest exited with code 1
The first call to processEvents should have processed the queued invocation, but it doesn't.
Attachments
Issue Links
- duplicates
-
QTBUG-88358 processEvents does not process all events with glib backend
-
- Open
-