diff options
author | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2012-01-10 10:13:55 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-01-10 19:54:03 +0100 |
commit | dc5ea809634560e836d2847f42f66beb43db7924 (patch) | |
tree | 5a80b2e483451e19da23af36f706c95bc102416c /src/testlib/qtestcase.h | |
parent | 00d4b151123b5df415db9cd49d4683ac485cf1e7 (diff) |
Tests: Remove duplicate QTRY_VERIFY/QTRY_COMPARE macros in bearer.
Introduce QTRY_VERIFY_WITH_TIMEOUT and QTRY_COMPARE_WITH_TIMEOUT
to be able to specify a timeout value.
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
Change-Id: Iaeaa4938eb14f2c431537055f626510cba183ce3
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Diffstat (limited to 'src/testlib/qtestcase.h')
-rw-r--r-- | src/testlib/qtestcase.h | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/testlib/qtestcase.h b/src/testlib/qtestcase.h index d6409f0441..4537e76920 100644 --- a/src/testlib/qtestcase.h +++ b/src/testlib/qtestcase.h @@ -86,33 +86,37 @@ do {\ } while (0) // Will try to wait for the expression to become true while allowing event processing -#define QTRY_VERIFY(__expr) \ +#define QTRY_VERIFY_WITH_TIMEOUT(__expr, __timeout) \ do { \ const int __step = 50; \ - const int __timeout = 5000; \ + const int __timeoutValue = __timeout; \ if (!(__expr)) { \ QTest::qWait(0); \ } \ - for (int __i = 0; __i < __timeout && !(__expr); __i+=__step) { \ + for (int __i = 0; __i < __timeoutValue && !(__expr); __i+=__step) { \ QTest::qWait(__step); \ } \ QVERIFY(__expr); \ } while (0) +#define QTRY_VERIFY(__expr) QTRY_VERIFY_WITH_TIMEOUT(__expr, 5000) + // Will try to wait for the comparison to become successful while allowing event processing -#define QTRY_COMPARE(__expr, __expected) \ + +#define QTRY_COMPARE_WITH_TIMEOUT(__expr, __expected, __timeout) \ do { \ const int __step = 50; \ - const int __timeout = 5000; \ + const int __timeoutValue = __timeout; \ if ((__expr) != (__expected)) { \ QTest::qWait(0); \ } \ - for (int __i = 0; __i < __timeout && ((__expr) != (__expected)); __i+=__step) { \ + for (int __i = 0; __i < __timeoutValue && ((__expr) != (__expected)); __i+=__step) { \ QTest::qWait(__step); \ } \ QCOMPARE(__expr, __expected); \ } while (0) +#define QTRY_COMPARE(__expr, __expected) QTRY_COMPARE_WITH_TIMEOUT(__expr, __expected, 5000) #ifdef Q_CC_MSVC #define QSKIP(statement) \ |