diff options
author | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-07-21 10:55:17 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-07-22 19:32:39 +0000 |
commit | 5f5db1c38b288441d02a68f1a095850b42585e04 (patch) | |
tree | 98d6b9522ef3d9a7d11ea6940cac6119737d258b /src/testlib/qtestcase.h | |
parent | c05f2d04f2ac359f486d2be4f0814e0f5b1d0b8f (diff) |
QTestLib: Add macros QTRY_VERIFY2_WITH_TIMEOUT(), QTRY_VERIFY2().
Add QTRY_VERIFY2_WITH_TIMEOUT() similar to QTRY_VERIFY_WITH_TIMEOUT()
except that QTRY_VERIFY2() is used below the loop and QTRY_VERIFY2()
based on it.
Add tests to cmptest.
[ChangeLog][QtTest] Added macros QTRY_VERIFY2_WITH_TIMEOUT(), QTRY_VERIFY2()
making it possible to output a message after the timeout has expired.
Change-Id: I587e24f3aeb73542dbf3ccb936a16f2e0806555f
Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'src/testlib/qtestcase.h')
-rw-r--r-- | src/testlib/qtestcase.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/testlib/qtestcase.h b/src/testlib/qtestcase.h index 9f3c461cf0..7d2fd2e701 100644 --- a/src/testlib/qtestcase.h +++ b/src/testlib/qtestcase.h @@ -158,6 +158,15 @@ do { \ #define QTRY_VERIFY(__expr) QTRY_VERIFY_WITH_TIMEOUT((__expr), 5000) +// 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);\ + QVERIFY2(__expr, __messageExpression); \ +} while (0) + +#define QTRY_VERIFY2(__expr, __messageExpression) QTRY_VERIFY2_WITH_TIMEOUT((__expr), (__messageExpression), 5000) + // Will try to wait for the comparison to become successful while allowing event processing #define QTRY_COMPARE_WITH_TIMEOUT(__expr, __expected, __timeout) \ do { \ |