diff options
author | Tor Arne Vestbø <tor.arne.vestbo@digia.com> | 2013-07-17 22:25:11 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-08-12 14:27:50 +0200 |
commit | 126c1b4b410c1d7eaf8ed5ae26594f39e29f5296 (patch) | |
tree | 8be884d1b73cc27c4b02c9134d6a3fefc3a7a6ba /tests/auto | |
parent | efc43ae83dd74d6b1cac4d74e7c5767e9a25ff4f (diff) |
Don't assume Q_OS_UNIX means we support QEventLoop::X11ExcludeTimers
A QCoreApplication may run a different event dispatcher, such as the
QEventDispatcherBlackberry, and QGuiApplications will have the GUI
dispatcher provided by the QPA plugin, such as QCocoaEventDispatcher.
Neither support X11ExcludeTimers.
Change-Id: Id5ea1c7dd74a127e13fa4d2eaa9a1bd2715a9dbb
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/corelib/kernel/qeventloop/qeventloop.pro | 2 | ||||
-rw-r--r-- | tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp | 20 |
2 files changed, 19 insertions, 3 deletions
diff --git a/tests/auto/corelib/kernel/qeventloop/qeventloop.pro b/tests/auto/corelib/kernel/qeventloop/qeventloop.pro index c510052298..50329e239d 100644 --- a/tests/auto/corelib/kernel/qeventloop/qeventloop.pro +++ b/tests/auto/corelib/kernel/qeventloop/qeventloop.pro @@ -6,3 +6,5 @@ SOURCES = tst_qeventloop.cpp win32:!wince*:LIBS += -luser32 DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 + +contains(QT_CONFIG, glib): DEFINES += HAVE_GLIB diff --git a/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp b/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp index c696c6e21a..baa32e2ed5 100644 --- a/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp +++ b/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp @@ -46,6 +46,12 @@ #include <qcoreevent.h> #include <qeventloop.h> #include <private/qeventloop_p.h> +#if defined(Q_OS_UNIX) + #include <private/qeventdispatcher_unix_p.h> + #if defined(HAVE_GLIB) + #include <private/qeventdispatcher_glib_p.h> + #endif +#endif #include <qmutex.h> #include <qthread.h> #include <qtimer.h> @@ -491,11 +497,19 @@ void tst_QEventLoop::processEventsExcludeTimers() QCOMPARE(timerReceiver.gotTimerEvent, timerId); timerReceiver.gotTimerEvent = -1; - // normal process events will send timers + // but not if we exclude timers eventLoop.processEvents(QEventLoop::X11ExcludeTimers); -#if !defined(Q_OS_UNIX) - QEXPECT_FAIL("", "X11ExcludeTimers only works on UN*X", Continue); + + QAbstractEventDispatcher *eventDispatcher = QCoreApplication::eventDispatcher(); +#if defined(Q_OS_UNIX) + if (!qobject_cast<QEventDispatcherUNIX *>(eventDispatcher) + #if defined(HAVE_GLIB) + && !qobject_cast<QEventDispatcherGlib *>(eventDispatcher) + #endif + ) #endif + QEXPECT_FAIL("", "X11ExcludeTimers only supported in the UNIX/Glib dispatchers", Continue); + QCOMPARE(timerReceiver.gotTimerEvent, -1); timerReceiver.gotTimerEvent = -1; |