Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.12
-
None
Description
The following code will pass, but only after 10 seconds:
QTRY_COMPARE(-51.99999999999994, -52)
The implementation:
// Will try to wait for the comparison to become successful while allowing event processing #define QTRY_COMPARE_WITH_TIMEOUT(expr, expected, timeout) \ do { \ QTRY_IMPL(((expr) == (expected)), timeout);\ QCOMPARE((expr), expected); \ } while (false) #define QTRY_COMPARE(expr, expected) QTRY_COMPARE_WITH_TIMEOUT((expr), expected, 5000)
The QTRY_IMPL call uses operator == for comparison, which fails. That macro repeats the loop twice to see if a longer wait would have made the test pass. The default timeout is 5 seconds, so the end result is that the test waits a whole 10 seconds before passing when doing the QCOMPARE (which uses qFuzzyCompare()).