source: trunk/src/3rdparty/webkit/WebKit/qt/tests/util.h@ 561

Last change on this file since 561 was 561, checked in by Dmitry A. Kuminov, 15 years ago

trunk: Merged in qt 4.6.1 sources.

  • Property svn:eol-style set to native
File size: 1.8 KB
Line 
1/*
2 Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
18*/
19// Functions and macros that really need to be in QTestLib
20
21// Will try to wait for the condition while allowing event processing
22#define QTRY_VERIFY(__expr) \
23 do { \
24 const int __step = 50; \
25 const int __timeout = 5000; \
26 if (!(__expr)) { \
27 QTest::qWait(0); \
28 } \
29 for (int __i = 0; __i < __timeout && !(__expr); __i+=__step) { \
30 QTest::qWait(__step); \
31 } \
32 QVERIFY(__expr); \
33 } while(0)
34
35// Will try to wait for the condition while allowing event processing
36#define QTRY_COMPARE(__expr, __expected) \
37 do { \
38 const int __step = 50; \
39 const int __timeout = 5000; \
40 if ((__expr) != (__expected)) { \
41 QTest::qWait(0); \
42 } \
43 for (int __i = 0; __i < __timeout && ((__expr) != (__expected)); __i+=__step) { \
44 QTest::qWait(__step); \
45 } \
46 QCOMPARE(__expr, __expected); \
47 } while(0)
48
Note: See TracBrowser for help on using the repository browser.