diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index c579e0f11f3..451fa5b761f 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -109,7 +109,7 @@ QT_BEGIN_NAMESPACE Example: \snippet doc/src/snippets/code/src_qtestlib_qtestcase.cpp 0 - \sa QCOMPARE() + \sa QCOMPARE(), QTRY_VERIFY() */ /*! \macro QVERIFY2(condition, message) @@ -159,7 +159,43 @@ QT_BEGIN_NAMESPACE Example: \snippet doc/src/snippets/code/src_qtestlib_qtestcase.cpp 2 - \sa QVERIFY(), QTest::toString() + \sa QVERIFY(), QTRY_COMPARE(), QTest::toString() +*/ + +/*! \macro QTRY_VERIFY(condition) + + \relates QTest + + The QTRY_VERIFY() macro is similar to QVERIFY(), but checks the \a condition + repeatedly, until either the condition becomes true or a maximum timeout is + reached. Between each evaluation, events will be processed. If the timeout + is reached, a failure is recorded in the test log and the test won't be + executed further. + + The timeout is fixed at five seconds. + + \note This macro can only be used in a test function that is invoked + by the test framework. + + \sa QVERIFY(), QCOMPARE(), QTRY_COMPARE() +*/ + +/*! \macro QTRY_COMPARE(actual, expected) + + \relates QTest + + The QTRY_COMPARE() macro is similar to QCOMPARE(), but performs the comparison + of the \a actual and \a expected values repeatedly, until either the two values + are equal or a maximum timeout is reached. Between each comparison, events + will be processed. If the timeout is reached, a failure is recorded in the + test log and the test won't be executed further. + + The timeout is fixed at five seconds. + + \note This macro can only be used in a test function that is invoked + by the test framework. + + \sa QCOMPARE(), QVERIFY(), QTRY_VERIFY() */ /*! \macro QFETCH(type, name) diff --git a/src/testlib/qtestcase.h b/src/testlib/qtestcase.h index b3ac5f0c4fd..642be0bc96e 100644 --- a/src/testlib/qtestcase.h +++ b/src/testlib/qtestcase.h @@ -82,6 +82,34 @@ do {\ return;\ } while (0) +// Will try to wait for the expression to become true while allowing event processing +#define QTRY_VERIFY(__expr) \ +do { \ + const int __step = 50; \ + const int __timeout = 5000; \ + if (!(__expr)) { \ + QTest::qWait(0); \ + } \ + for (int __i = 0; __i < __timeout && !(__expr); __i+=__step) { \ + QTest::qWait(__step); \ + } \ + QVERIFY(__expr); \ +} while (0) + +// Will try to wait for the comparison to become successful while allowing event processing +#define QTRY_COMPARE(__expr, __expected) \ +do { \ + const int __step = 50; \ + const int __timeout = 5000; \ + if ((__expr) != (__expected)) { \ + QTest::qWait(0); \ + } \ + for (int __i = 0; __i < __timeout && ((__expr) != (__expected)); __i+=__step) { \ + QTest::qWait(__step); \ + } \ + QCOMPARE(__expr, __expected); \ +} while (0) + #define QSKIP(statement, mode) \ do {\ QTest::qSkip(statement, QTest::mode, __FILE__, __LINE__);\ diff --git a/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp b/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp index e5feab4aa6f..519eab08c08 100644 --- a/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp +++ b/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp @@ -40,12 +40,9 @@ ****************************************************************************/ #include -#include "../../../../shared/util.h" - #include #include #include -#include "../../../../shared/util.h" //TESTED_CLASS=QPropertyAnimation //TESTED_FILES= diff --git a/tests/auto/corelib/animation/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp b/tests/auto/corelib/animation/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp index 00c038b948b..42438a6827d 100644 --- a/tests/auto/corelib/animation/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp +++ b/tests/auto/corelib/animation/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp @@ -40,8 +40,6 @@ ****************************************************************************/ #include -#include "../../../../shared/util.h" - #include #include diff --git a/tests/auto/corelib/concurrent/qfuturewatcher/tst_qfuturewatcher.cpp b/tests/auto/corelib/concurrent/qfuturewatcher/tst_qfuturewatcher.cpp index 615a4c507f3..c7e35e2b751 100644 --- a/tests/auto/corelib/concurrent/qfuturewatcher/tst_qfuturewatcher.cpp +++ b/tests/auto/corelib/concurrent/qfuturewatcher/tst_qfuturewatcher.cpp @@ -46,7 +46,6 @@ #include #include #include -#include "../../../../shared/util.h" #include using namespace QtConcurrent; diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp index 571f633c4b5..5d3e268d965 100644 --- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp +++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp @@ -51,7 +51,6 @@ #include #include #include -#include "../../../../shared/util.h" #include #if defined(Q_OS_WIN) && defined(Q_CC_GNU) diff --git a/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp b/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp index 2e1f914497c..83c67d695c9 100644 --- a/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp +++ b/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp @@ -54,8 +54,6 @@ #include #include -#include "../../../../shared/util.h" - //TESTED_CLASS= //TESTED_FILES= diff --git a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp index d069cf162e5..4af2a492d7f 100644 --- a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp +++ b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp @@ -50,9 +50,6 @@ #include #endif -#include "../../../../shared/util.h" - - //TESTED_CLASS= //TESTED_FILES= diff --git a/tests/auto/gestures/tst_gestures.cpp b/tests/auto/gestures/tst_gestures.cpp index e86a9f7fad3..63345fbe88f 100644 --- a/tests/auto/gestures/tst_gestures.cpp +++ b/tests/auto/gestures/tst_gestures.cpp @@ -42,7 +42,6 @@ #include #include -#include "../../shared/util.h" #include #include diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp index 17a39822137..70674aa29a9 100644 --- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp +++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp @@ -41,8 +41,6 @@ #include -#include "../../../../shared/util.h" - #include #include #include diff --git a/tests/auto/network/access/qabstractnetworkcache/tst_qabstractnetworkcache.cpp b/tests/auto/network/access/qabstractnetworkcache/tst_qabstractnetworkcache.cpp index 1491d64c587..d507c93cf59 100644 --- a/tests/auto/network/access/qabstractnetworkcache/tst_qabstractnetworkcache.cpp +++ b/tests/auto/network/access/qabstractnetworkcache/tst_qabstractnetworkcache.cpp @@ -42,7 +42,6 @@ #include #include -#include "../../../../shared/util.h" #include "../../../network-settings.h" #ifndef QT_NO_BEARERMANAGEMENT diff --git a/tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp b/tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp index 030eae60a01..750721beabe 100644 --- a/tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp +++ b/tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp @@ -43,8 +43,6 @@ #include #include #include -#include "../../../../shared/util.h" - #define EXAMPLE_URL "http://user:pass@www.example.com/#foo" //cached objects are organized into these many subdirs #define NUM_SUBDIRECTORIES 16 diff --git a/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp b/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp index 49de1716cd4..3e0437f3c84 100644 --- a/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp +++ b/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp @@ -95,7 +95,6 @@ #endif #include "../../../network-settings.h" -#include "../../../../shared/util.h" //TESTED_CLASS= //TESTED_FILES= diff --git a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp index 131fc71ff5c..a9d3bebd08a 100644 --- a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp +++ b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp @@ -45,7 +45,6 @@ #include #include #include -#include "../../../../shared/util.h" //TESTED_CLASS=QLocalServer, QLocalSocket //TESTED_FILES=network/socket/qlocalserver.cpp network/socket/qlocalsocket.cpp diff --git a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp index 61069609173..95ab7194055 100644 --- a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp +++ b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp @@ -93,7 +93,6 @@ #include "private/qhostinfo_p.h" #include "../../../network-settings.h" -#include "../../../../shared/util.h" Q_DECLARE_METATYPE(QAbstractSocket::SocketError) Q_DECLARE_METATYPE(QAbstractSocket::SocketState) diff --git a/tests/auto/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/qabstractitemview/tst_qabstractitemview.cpp index 2c87198c9e8..b9c652f1d3b 100644 --- a/tests/auto/qabstractitemview/tst_qabstractitemview.cpp +++ b/tests/auto/qabstractitemview/tst_qabstractitemview.cpp @@ -58,7 +58,6 @@ #include #include #include -#include "../../shared/util.h" //TESTED_CLASS= //TESTED_FILES= diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp index 7d6650608ca..9e24c87e191 100644 --- a/tests/auto/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp @@ -41,7 +41,6 @@ #include -#include "../../shared/util.h" #include #include #include diff --git a/tests/auto/qbuttongroup/tst_qbuttongroup.cpp b/tests/auto/qbuttongroup/tst_qbuttongroup.cpp index 87173ae72ce..f9f6ec0a540 100644 --- a/tests/auto/qbuttongroup/tst_qbuttongroup.cpp +++ b/tests/auto/qbuttongroup/tst_qbuttongroup.cpp @@ -57,8 +57,6 @@ #include #endif -#include "../../shared/util.h" - class SpecialRadioButton: public QRadioButton { public: diff --git a/tests/auto/qcolordialog/tst_qcolordialog.cpp b/tests/auto/qcolordialog/tst_qcolordialog.cpp index 98430fe6c71..3ae1e63a8ed 100644 --- a/tests/auto/qcolordialog/tst_qcolordialog.cpp +++ b/tests/auto/qcolordialog/tst_qcolordialog.cpp @@ -44,8 +44,6 @@ #include #include -#include "../../shared/util.h" - //TESTED_CLASS= //TESTED_FILES= diff --git a/tests/auto/qcolumnview/tst_qcolumnview.cpp b/tests/auto/qcolumnview/tst_qcolumnview.cpp index 8d820eaefaa..364f9175112 100644 --- a/tests/auto/qcolumnview/tst_qcolumnview.cpp +++ b/tests/auto/qcolumnview/tst_qcolumnview.cpp @@ -52,7 +52,6 @@ #include #include #include -#include "../../shared/util.h" //TESTED_CLASS= //TESTED_FILES= diff --git a/tests/auto/qcombobox/tst_qcombobox.cpp b/tests/auto/qcombobox/tst_qcombobox.cpp index 042240164a3..cb4468f6f4e 100644 --- a/tests/auto/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/qcombobox/tst_qcombobox.cpp @@ -76,7 +76,6 @@ #include #endif #include -#include "../../shared/util.h" #include #ifndef QT_NO_STYLE_WINDOWS #include diff --git a/tests/auto/qcompleter/tst_qcompleter.cpp b/tests/auto/qcompleter/tst_qcompleter.cpp index a9725c41922..b0720b87764 100644 --- a/tests/auto/qcompleter/tst_qcompleter.cpp +++ b/tests/auto/qcompleter/tst_qcompleter.cpp @@ -47,7 +47,6 @@ #include #include -#include "../../shared/util.h" #include "../../shared/filesystem.h" //TESTED_CLASS= diff --git a/tests/auto/qdialog/tst_qdialog.cpp b/tests/auto/qdialog/tst_qdialog.cpp index 5672ce5e68c..0f4acdcc9e8 100644 --- a/tests/auto/qdialog/tst_qdialog.cpp +++ b/tests/auto/qdialog/tst_qdialog.cpp @@ -50,8 +50,6 @@ #include #include -#include "../../shared/util.h" - Q_DECLARE_METATYPE(QSize) diff --git a/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp b/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp index 967787715b4..15f38e33346 100644 --- a/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp +++ b/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp @@ -53,8 +53,6 @@ #include #include -#include "../../shared/util.h" - //TESTED_CLASS= //TESTED_FILES=gui/widgets/qspinbox.h gui/widgets/qspinbox.cpp gui/widgets/qabstractspinbox.cpp gui/widgets/qabstractspinbox_p.h gui/widgets/qabstractspinbox.h diff --git a/tests/auto/qfiledialog/tst_qfiledialog.cpp b/tests/auto/qfiledialog/tst_qfiledialog.cpp index f76f4c922e0..2a14ecbc282 100644 --- a/tests/auto/qfiledialog/tst_qfiledialog.cpp +++ b/tests/auto/qfiledialog/tst_qfiledialog.cpp @@ -60,7 +60,6 @@ #include #include #include -#include "../../shared/util.h" #if defined QT_BUILD_INTERNAL #include "../../../src/widgets/dialogs/qsidebar_p.h" #include "../../../src/widgets/dialogs/qfilesystemmodel_p.h" diff --git a/tests/auto/qfiledialog2/tst_qfiledialog2.cpp b/tests/auto/qfiledialog2/tst_qfiledialog2.cpp index 0edc028ce6c..dad1e903f9c 100644 --- a/tests/auto/qfiledialog2/tst_qfiledialog2.cpp +++ b/tests/auto/qfiledialog2/tst_qfiledialog2.cpp @@ -60,7 +60,6 @@ #include #include #include -#include "../../shared/util.h" #include "../../../src/widgets/dialogs/qsidebar_p.h" #include "../../../src/widgets/dialogs/qfilesystemmodel_p.h" #include "../../../src/widgets/dialogs/qfiledialog_p.h" diff --git a/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp index 5e353d57350..26fa58e6498 100644 --- a/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp +++ b/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp @@ -48,7 +48,6 @@ #include #include #include -#include "../../shared/util.h" #include #include #include diff --git a/tests/auto/qfocusevent/tst_qfocusevent.cpp b/tests/auto/qfocusevent/tst_qfocusevent.cpp index 9a1d312c9f5..931059b2118 100644 --- a/tests/auto/qfocusevent/tst_qfocusevent.cpp +++ b/tests/auto/qfocusevent/tst_qfocusevent.cpp @@ -50,8 +50,6 @@ #include #include -#include "../../shared/util.h" - QT_FORWARD_DECLARE_CLASS(QWidget) //TESTED_CLASS= diff --git a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp index f69b66534a0..e72dd456678 100644 --- a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp +++ b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp @@ -49,7 +49,6 @@ #include #include -#include "../../shared/util.h" #include #include "../platformquirks.h" diff --git a/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp b/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp index a5dcf738e72..4f39f991c69 100644 --- a/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp +++ b/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp @@ -48,8 +48,6 @@ #include -#include "../../shared/util.h" - //TESTED_CLASS= //TESTED_FILES= diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index a9ba80b1f51..64824b2048e 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -67,8 +67,6 @@ #include #include -#include "../../shared/util.h" - //TESTED_CLASS= //TESTED_FILES= diff --git a/tests/auto/qgraphicslayout/tst_qgraphicslayout.cpp b/tests/auto/qgraphicslayout/tst_qgraphicslayout.cpp index 4f618c27a64..3eac04e4e56 100644 --- a/tests/auto/qgraphicslayout/tst_qgraphicslayout.cpp +++ b/tests/auto/qgraphicslayout/tst_qgraphicslayout.cpp @@ -45,8 +45,6 @@ #include #include -#include "../../shared/util.h" - //TESTED_CLASS=QGraphicsLayout //TESTED_FILES= diff --git a/tests/auto/qgraphicsobject/tst_qgraphicsobject.cpp b/tests/auto/qgraphicsobject/tst_qgraphicsobject.cpp index f77d38f1ab4..85e36b74b28 100644 --- a/tests/auto/qgraphicsobject/tst_qgraphicsobject.cpp +++ b/tests/auto/qgraphicsobject/tst_qgraphicsobject.cpp @@ -47,7 +47,6 @@ #include #include #include -#include "../../shared/util.h" class tst_QGraphicsObject : public QObject { Q_OBJECT diff --git a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp index 8dcb4ebf68e..78c545e25ac 100644 --- a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp +++ b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp @@ -43,7 +43,6 @@ #include #include #include -#include "../../shared/util.h" #include #include // qSmartMin functions... #if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC) diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp index 809837dbfd0..0a345730393 100644 --- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp @@ -50,7 +50,6 @@ #include #include #include -#include "../../shared/util.h" #include "../gui/painting/qpathclipper/pathcompare.h" #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) diff --git a/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp b/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp index 61a107da05e..75077012673 100644 --- a/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp +++ b/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp @@ -45,8 +45,6 @@ #include #include #include -#include "../../shared/util.h" - //TESTED_CLASS= //TESTED_FILES= diff --git a/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp b/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp index 1a116b7f302..7d5a9578ad3 100644 --- a/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp +++ b/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp @@ -43,7 +43,6 @@ #include #include #include -#include "../../shared/util.h" class tst_QGraphicsTransform : public QObject { Q_OBJECT diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp index 0a0dfc216f6..444e15a7883 100644 --- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp @@ -71,7 +71,6 @@ #include #include #include -#include "../../shared/util.h" #include "../platformquirks.h" //TESTED_CLASS= diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp index feae6f7372f..e3eb05ca1a8 100644 --- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp +++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp @@ -52,7 +52,6 @@ #include #include #include -#include "../../shared/util.h" #include "../platformquirks.h" diff --git a/tests/auto/qgridlayout/tst_qgridlayout.cpp b/tests/auto/qgridlayout/tst_qgridlayout.cpp index 486522bc902..3b352644f32 100644 --- a/tests/auto/qgridlayout/tst_qgridlayout.cpp +++ b/tests/auto/qgridlayout/tst_qgridlayout.cpp @@ -54,7 +54,6 @@ #include #include -#include "../../shared/util.h" #include "../platformquirks.h" //TESTED_CLASS= diff --git a/tests/auto/qgroupbox/tst_qgroupbox.cpp b/tests/auto/qgroupbox/tst_qgroupbox.cpp index f1388bc2b66..8568ef01d17 100644 --- a/tests/auto/qgroupbox/tst_qgroupbox.cpp +++ b/tests/auto/qgroupbox/tst_qgroupbox.cpp @@ -49,8 +49,6 @@ #include "qgroupbox.h" -#include "../../shared/util.h" - //TESTED_CLASS= //TESTED_FILES= diff --git a/tests/auto/qidentityproxymodel/tst_qidentityproxymodel.cpp b/tests/auto/qidentityproxymodel/tst_qidentityproxymodel.cpp index ae36d9e5d73..6d73cbe2e10 100644 --- a/tests/auto/qidentityproxymodel/tst_qidentityproxymodel.cpp +++ b/tests/auto/qidentityproxymodel/tst_qidentityproxymodel.cpp @@ -41,8 +41,6 @@ #include -#include "../../shared/util.h" - #include #include #include diff --git a/tests/auto/qinputcontext/tst_qinputcontext.cpp b/tests/auto/qinputcontext/tst_qinputcontext.cpp index 942160edac5..9b6452851e8 100644 --- a/tests/auto/qinputcontext/tst_qinputcontext.cpp +++ b/tests/auto/qinputcontext/tst_qinputcontext.cpp @@ -40,8 +40,6 @@ ****************************************************************************/ #include -#include "../../shared/util.h" - #include #include #include diff --git a/tests/auto/qitemdelegate/tst_qitemdelegate.cpp b/tests/auto/qitemdelegate/tst_qitemdelegate.cpp index 2a9b45dd55a..e419a7f0979 100644 --- a/tests/auto/qitemdelegate/tst_qitemdelegate.cpp +++ b/tests/auto/qitemdelegate/tst_qitemdelegate.cpp @@ -63,8 +63,6 @@ #include #include -#include "../../shared/util.h" - Q_DECLARE_METATYPE(QAbstractItemDelegate::EndEditHint) //TESTED_CLASS= diff --git a/tests/auto/qlabel/tst_qlabel.cpp b/tests/auto/qlabel/tst_qlabel.cpp index 495eb94c1fc..8f689d24540 100644 --- a/tests/auto/qlabel/tst_qlabel.cpp +++ b/tests/auto/qlabel/tst_qlabel.cpp @@ -56,8 +56,6 @@ //TESTED_CLASS= //TESTED_FILES= -#include "../../shared/util.h" - class Widget : public QWidget { public: diff --git a/tests/auto/qlineedit/tst_qlineedit.cpp b/tests/auto/qlineedit/tst_qlineedit.cpp index 5cae5b8aee7..6081b504de8 100644 --- a/tests/auto/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/qlineedit/tst_qlineedit.cpp @@ -41,8 +41,6 @@ #include -#include "../../shared/util.h" - #include "qlineedit.h" #include "qapplication.h" #include "qstringlist.h" diff --git a/tests/auto/qlistview/tst_qlistview.cpp b/tests/auto/qlistview/tst_qlistview.cpp index 152a12f9239..b58a306f945 100644 --- a/tests/auto/qlistview/tst_qlistview.cpp +++ b/tests/auto/qlistview/tst_qlistview.cpp @@ -60,8 +60,6 @@ # include #endif // Q_OS_WIN -#include "../../shared/util.h" - //TESTED_CLASS= //TESTED_FILES= diff --git a/tests/auto/qmdiarea/tst_qmdiarea.cpp b/tests/auto/qmdiarea/tst_qmdiarea.cpp index c75236224b5..bbc3d27e270 100644 --- a/tests/auto/qmdiarea/tst_qmdiarea.cpp +++ b/tests/auto/qmdiarea/tst_qmdiarea.cpp @@ -62,7 +62,6 @@ #endif #include -#include "../../shared/util.h" #include "../platformquirks.h" static const Qt::WindowFlags DefaultWindowFlags diff --git a/tests/auto/qmdisubwindow/tst_qmdisubwindow.cpp b/tests/auto/qmdisubwindow/tst_qmdisubwindow.cpp index 93b81ec0338..f7593336e15 100644 --- a/tests/auto/qmdisubwindow/tst_qmdisubwindow.cpp +++ b/tests/auto/qmdisubwindow/tst_qmdisubwindow.cpp @@ -63,9 +63,6 @@ #include #endif -#include "../../shared/util.h" - - QT_BEGIN_NAMESPACE #if defined(Q_WS_X11) extern void qt_x11_wait_for_window_manager(QWidget *w); diff --git a/tests/auto/qmenu/tst_qmenu.cpp b/tests/auto/qmenu/tst_qmenu.cpp index d3eb5f260a3..41c24a9992a 100644 --- a/tests/auto/qmenu/tst_qmenu.cpp +++ b/tests/auto/qmenu/tst_qmenu.cpp @@ -56,8 +56,6 @@ #include #include -#include "../../shared/util.h" - //TESTED_CLASS= //TESTED_FILES= diff --git a/tests/auto/qmenubar/tst_qmenubar.cpp b/tests/auto/qmenubar/tst_qmenubar.cpp index 7ccb225941f..dc3b81920d8 100644 --- a/tests/auto/qmenubar/tst_qmenubar.cpp +++ b/tests/auto/qmenubar/tst_qmenubar.cpp @@ -56,8 +56,6 @@ #include -#include "../../shared/util.h" - QT_FORWARD_DECLARE_CLASS(QMainWindow) #include diff --git a/tests/auto/qmessagebox/tst_qmessagebox.cpp b/tests/auto/qmessagebox/tst_qmessagebox.cpp index ac33efc5640..a07d7cf7a96 100644 --- a/tests/auto/qmessagebox/tst_qmessagebox.cpp +++ b/tests/auto/qmessagebox/tst_qmessagebox.cpp @@ -55,8 +55,6 @@ #include #endif -#include "../../shared/util.h" - //TESTED_CLASS= //TESTED_FILES= diff --git a/tests/auto/qprogressbar/tst_qprogressbar.cpp b/tests/auto/qprogressbar/tst_qprogressbar.cpp index 04b7ce744e7..55285b42ffa 100644 --- a/tests/auto/qprogressbar/tst_qprogressbar.cpp +++ b/tests/auto/qprogressbar/tst_qprogressbar.cpp @@ -48,8 +48,6 @@ #include #include -#include "../../shared/util.h" - //TESTED_CLASS= //TESTED_FILES= diff --git a/tests/auto/qpushbutton/tst_qpushbutton.cpp b/tests/auto/qpushbutton/tst_qpushbutton.cpp index 7742f6b5679..fffe1c26e45 100644 --- a/tests/auto/qpushbutton/tst_qpushbutton.cpp +++ b/tests/auto/qpushbutton/tst_qpushbutton.cpp @@ -54,8 +54,6 @@ #include #include -#include "../../shared/util.h" - Q_DECLARE_METATYPE(QPushButton*) //TESTED_CLASS= diff --git a/tests/auto/qscreen/tst_qscreen.cpp b/tests/auto/qscreen/tst_qscreen.cpp index 98ca031116c..1d00032b56e 100644 --- a/tests/auto/qscreen/tst_qscreen.cpp +++ b/tests/auto/qscreen/tst_qscreen.cpp @@ -43,8 +43,6 @@ #include -#include "../../shared/util.h" - class tst_QScreen: public QObject { Q_OBJECT diff --git a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp index b8a9b6252b5..96f7249e3ce 100644 --- a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp +++ b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp @@ -41,8 +41,6 @@ #include -#include "../../shared/util.h" - #include "dynamictreemodel.h" #include "modeltest.h" diff --git a/tests/auto/qspinbox/tst_qspinbox.cpp b/tests/auto/qspinbox/tst_qspinbox.cpp index a142e2dfe9d..608dcd67053 100644 --- a/tests/auto/qspinbox/tst_qspinbox.cpp +++ b/tests/auto/qspinbox/tst_qspinbox.cpp @@ -67,7 +67,6 @@ #include #include #include -#include "../../shared/util.h" //TESTED_CLASS= //TESTED_FILES= diff --git a/tests/auto/qsplitter/tst_qsplitter.cpp b/tests/auto/qsplitter/tst_qsplitter.cpp index 08d757e5c11..a5967e836dd 100644 --- a/tests/auto/qsplitter/tst_qsplitter.cpp +++ b/tests/auto/qsplitter/tst_qsplitter.cpp @@ -55,7 +55,6 @@ #include #include #include // for file error messages -#include "../../shared/util.h" //TESTED_CLASS= //TESTED_FILES= diff --git a/tests/auto/qstackedlayout/tst_qstackedlayout.cpp b/tests/auto/qstackedlayout/tst_qstackedlayout.cpp index dc28bcd09f2..de734877d7c 100644 --- a/tests/auto/qstackedlayout/tst_qstackedlayout.cpp +++ b/tests/auto/qstackedlayout/tst_qstackedlayout.cpp @@ -47,8 +47,6 @@ #include #include -#include "../../shared/util.h" - //TESTED_CLASS= //TESTED_FILES=gui/kernel/qlayout.cpp gui/kernel/qlayout.h diff --git a/tests/auto/qstatusbar/tst_qstatusbar.cpp b/tests/auto/qstatusbar/tst_qstatusbar.cpp index a8df61dd4b1..a4a232951ac 100644 --- a/tests/auto/qstatusbar/tst_qstatusbar.cpp +++ b/tests/auto/qstatusbar/tst_qstatusbar.cpp @@ -48,8 +48,6 @@ #include #include -#include "../../shared/util.h" - //TESTED_CLASS= //TESTED_FILES= diff --git a/tests/auto/qtabbar/tst_qtabbar.cpp b/tests/auto/qtabbar/tst_qtabbar.cpp index 79b0bda0edf..a1a8f3b0aa1 100644 --- a/tests/auto/qtabbar/tst_qtabbar.cpp +++ b/tests/auto/qtabbar/tst_qtabbar.cpp @@ -46,7 +46,6 @@ #include #include -#include "../../shared/util.h" class tst_QTabBar : public QObject { diff --git a/tests/auto/qtableview/tst_qtableview.cpp b/tests/auto/qtableview/tst_qtableview.cpp index 1130ae7d023..2242490a442 100644 --- a/tests/auto/qtableview/tst_qtableview.cpp +++ b/tests/auto/qtableview/tst_qtableview.cpp @@ -44,7 +44,6 @@ #include #include #include -#include "../../shared/util.h" #include "private/qapplication_p.h" //TESTED_CLASS= diff --git a/tests/auto/qtablewidget/tst_qtablewidget.cpp b/tests/auto/qtablewidget/tst_qtablewidget.cpp index 0b66f4df337..6c32caadbbf 100644 --- a/tests/auto/qtablewidget/tst_qtablewidget.cpp +++ b/tests/auto/qtablewidget/tst_qtablewidget.cpp @@ -41,7 +41,6 @@ #include -#include "../../shared/util.h" #include #include #include diff --git a/tests/auto/qtextbrowser/tst_qtextbrowser.cpp b/tests/auto/qtextbrowser/tst_qtextbrowser.cpp index 659105b14c4..a1592e5e2ba 100644 --- a/tests/auto/qtextbrowser/tst_qtextbrowser.cpp +++ b/tests/auto/qtextbrowser/tst_qtextbrowser.cpp @@ -49,8 +49,6 @@ #include #include -#include "../../shared/util.h" - //TESTED_CLASS= //TESTED_FILES= diff --git a/tests/auto/qtoolbar/tst_qtoolbar.cpp b/tests/auto/qtoolbar/tst_qtoolbar.cpp index 5eac3f09158..d15e753b2d4 100644 --- a/tests/auto/qtoolbar/tst_qtoolbar.cpp +++ b/tests/auto/qtoolbar/tst_qtoolbar.cpp @@ -57,8 +57,6 @@ #include #include -#include "../../shared/util.h" - //TESTED_FILES= QT_FORWARD_DECLARE_CLASS(QAction) diff --git a/tests/auto/qtooltip/tst_qtooltip.cpp b/tests/auto/qtooltip/tst_qtooltip.cpp index d663bf4d45c..3ff31ead625 100644 --- a/tests/auto/qtooltip/tst_qtooltip.cpp +++ b/tests/auto/qtooltip/tst_qtooltip.cpp @@ -42,7 +42,6 @@ #include #include -#include "../../shared/util.h" //TESTED_CLASS= //TESTED_FILES= diff --git a/tests/auto/qtreeview/tst_qtreeview.cpp b/tests/auto/qtreeview/tst_qtreeview.cpp index e80837fd0ee..d6cdf00218a 100644 --- a/tests/auto/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/qtreeview/tst_qtreeview.cpp @@ -39,14 +39,10 @@ ** ****************************************************************************/ - - #include - #include #include #include -#include "../../shared/util.h" //TESTED_CLASS= //TESTED_FILES= diff --git a/tests/auto/qtreewidget/tst_qtreewidget.cpp b/tests/auto/qtreewidget/tst_qtreewidget.cpp index dc878c48181..5e1faf97c41 100644 --- a/tests/auto/qtreewidget/tst_qtreewidget.cpp +++ b/tests/auto/qtreewidget/tst_qtreewidget.cpp @@ -51,9 +51,6 @@ #include #include -#include "../../shared/util.h" - - //TESTED_CLASS= //TESTED_FILES= diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 3629bf14b0e..ded0c5e061a 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -73,8 +73,6 @@ #include #include -#include "../../shared/util.h" - #ifdef Q_WS_QWS # include #endif diff --git a/tests/auto/qwidget_window/tst_qwidget_window.cpp b/tests/auto/qwidget_window/tst_qwidget_window.cpp index 60ae6c33346..eb8b555bd60 100644 --- a/tests/auto/qwidget_window/tst_qwidget_window.cpp +++ b/tests/auto/qwidget_window/tst_qwidget_window.cpp @@ -52,9 +52,6 @@ #include #endif // Q_WS_X11 -#include "../../shared/util.h" - - class tst_QWidget_window : public QWidget { Q_OBJECT diff --git a/tests/auto/qwidgetaction/tst_qwidgetaction.cpp b/tests/auto/qwidgetaction/tst_qwidgetaction.cpp index 46b7e38fa06..5f51f6d3165 100644 --- a/tests/auto/qwidgetaction/tst_qwidgetaction.cpp +++ b/tests/auto/qwidgetaction/tst_qwidgetaction.cpp @@ -51,8 +51,6 @@ #include #include -#include "../../shared/util.h" - //TESTED_CLASS= //TESTED_FILES= diff --git a/tests/auto/qwindow/tst_qwindow.cpp b/tests/auto/qwindow/tst_qwindow.cpp index 478bcbe78c2..4171f0f797d 100644 --- a/tests/auto/qwindow/tst_qwindow.cpp +++ b/tests/auto/qwindow/tst_qwindow.cpp @@ -43,8 +43,6 @@ #include -#include "../../shared/util.h" - class tst_QWindow: public QObject { Q_OBJECT diff --git a/tests/auto/qwindowsurface/tst_qwindowsurface.cpp b/tests/auto/qwindowsurface/tst_qwindowsurface.cpp index b60adfcdfd5..ecb6419a97e 100644 --- a/tests/auto/qwindowsurface/tst_qwindowsurface.cpp +++ b/tests/auto/qwindowsurface/tst_qwindowsurface.cpp @@ -46,7 +46,6 @@ #include #include #include -#include "../../shared/util.h" #if QT_VERSION < 0x050000 #include diff --git a/tests/shared/util.h b/tests/shared/util.h deleted file mode 100644 index ac78f2dfece..00000000000 --- a/tests/shared/util.h +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -// Functions and macros that really need to be in QTestLib - -// Will try to wait for the condition while allowing event processing -#define QTRY_VERIFY(__expr) \ - do { \ - const int __step = 50; \ - const int __timeout = 5000; \ - if (!(__expr)) { \ - QTest::qWait(0); \ - } \ - for (int __i = 0; __i < __timeout && !(__expr); __i+=__step) { \ - QTest::qWait(__step); \ - } \ - QVERIFY(__expr); \ - } while(0) - -// Will try to wait for the condition while allowing event processing -#define QTRY_COMPARE(__expr, __expected) \ - do { \ - const int __step = 50; \ - const int __timeout = 5000; \ - if ((__expr) != (__expected)) { \ - QTest::qWait(0); \ - } \ - for (int __i = 0; __i < __timeout && ((__expr) != (__expected)); __i+=__step) { \ - QTest::qWait(__step); \ - } \ - QCOMPARE(__expr, __expected); \ - } while(0) -