summaryrefslogtreecommitdiffstats
path: root/src/testlib/qtestcase.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/testlib/qtestcase.h')
-rw-r--r--src/testlib/qtestcase.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/testlib/qtestcase.h b/src/testlib/qtestcase.h
index 3103cdc41c..ad941d2ba3 100644
--- a/src/testlib/qtestcase.h
+++ b/src/testlib/qtestcase.h
@@ -163,10 +163,11 @@ inline void useVerifyThrowsException() {}
&& !(expr); qt_test_i += step) { \
QTest::qWait(step); \
}
+// Ends in a for-block, so doesn't want a following semicolon.
#define QTRY_TIMEOUT_DEBUG_IMPL(expr, timeoutValue, step) \
if (!QTest::currentTestFailed() && !(expr)) { \
- QTRY_LOOP_IMPL((expr), 2 * (timeoutValue), step); \
+ QTRY_LOOP_IMPL((expr), 2 * (timeoutValue), step) \
if (expr) { \
QFAIL(qPrintable(QTest::Internal::formatTryTimeoutDebugMessage(\
u8"" #expr, timeoutValue, timeoutValue + qt_test_i))); \
@@ -176,13 +177,14 @@ inline void useVerifyThrowsException() {}
#define QTRY_IMPL(expr, timeout)\
const int qt_test_step = timeout < 350 ? timeout / 7 + 1 : 50; \
const int qt_test_timeoutValue = timeout; \
- { QTRY_LOOP_IMPL((expr), qt_test_timeoutValue, qt_test_step); } \
+ { QTRY_LOOP_IMPL((expr), qt_test_timeoutValue, qt_test_step) } \
QTRY_TIMEOUT_DEBUG_IMPL((expr), qt_test_timeoutValue, qt_test_step)
+// Ends with an if-block, so doesn't want a following semicolon.
// Will try to wait for the expression to become true while allowing event processing
#define QTRY_VERIFY_WITH_TIMEOUT(expr, timeout) \
do { \
- QTRY_IMPL((expr), timeout);\
+ QTRY_IMPL((expr), timeout) \
QVERIFY(expr); \
} while (false)
@@ -191,7 +193,7 @@ do { \
// Will try to wait for the expression to become true while allowing event processing
#define QTRY_VERIFY2_WITH_TIMEOUT(expr, messageExpression, timeout) \
do { \
- QTRY_IMPL((expr), timeout);\
+ QTRY_IMPL((expr), timeout) \
QVERIFY2(expr, messageExpression); \
} while (false)
@@ -200,7 +202,7 @@ do { \
// 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);\
+ QTRY_IMPL(((expr) == (expected)), timeout) \
QCOMPARE((expr), expected); \
} while (false)
@@ -208,7 +210,7 @@ do { \
#define QTRY_COMPARE_OP_WITH_TIMEOUT_IMPL(left, right, op, opId, timeout) \
do { \
- QTRY_IMPL(((left) op (right)), timeout); \
+ QTRY_IMPL(((left) op (right)), timeout) \
QCOMPARE_OP_IMPL(left, right, op, opId); \
} while (false)