summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/kernel/qeventdispatcher/tst_qeventdispatcher.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib/kernel/qeventdispatcher/tst_qeventdispatcher.cpp')
-rw-r--r--tests/auto/corelib/kernel/qeventdispatcher/tst_qeventdispatcher.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/auto/corelib/kernel/qeventdispatcher/tst_qeventdispatcher.cpp b/tests/auto/corelib/kernel/qeventdispatcher/tst_qeventdispatcher.cpp
index 07bd73f0d7..d06912ee91 100644
--- a/tests/auto/corelib/kernel/qeventdispatcher/tst_qeventdispatcher.cpp
+++ b/tests/auto/corelib/kernel/qeventdispatcher/tst_qeventdispatcher.cpp
@@ -39,7 +39,11 @@
**
****************************************************************************/
-#include <QtCore/QCoreApplication>
+#ifdef QT_GUI_LIB
+# include <QtGui/QGuiApplication>
+#else
+# include <QtCore/QCoreApplication>
+#endif
#include <QtTest/QtTest>
enum {
@@ -68,6 +72,7 @@ public:
{ }
private slots:
+ void initTestCase();
void registerTimer();
/* void registerSocketNotifier(); */ // Not implemented here, see tst_QSocketNotifier instead
/* void registerEventNotifiier(); */ // Not implemented here, see tst_QWinEventNotifier instead
@@ -88,6 +93,16 @@ bool tst_QEventDispatcher::event(QEvent *e)
return QObject::event(e);
}
+// drain the system event queue after the test starts to avoid destabilizing the test functions
+void tst_QEventDispatcher::initTestCase()
+{
+ QElapsedTimer elapsedTimer;
+ elapsedTimer.start();
+ while (!elapsedTimer.hasExpired(CoarseTimerInterval) && eventDispatcher->processEvents(QEventLoop::AllEvents)) {
+ ;
+ }
+}
+
// test that the eventDispatcher's timer implementation is complete and working
void tst_QEventDispatcher::registerTimer()
{