summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2012-02-06 16:09:18 +0100
committerQt by Nokia <qt-info@nokia.com>2012-02-10 15:22:11 +0100
commit8f8e3db6ae1328bb03e46dbbdea0d787b656bb97 (patch)
treeceff16060637003539a71eb52696646cf9f87066 /tests/auto
parent358c14821bf907025c1b3db6ff3f8e3bd3cdbb0f (diff)
Test posted events in tst_QEventDispatcher with various flags
Add QEventLoop::ProcessEventsFlags test data for tst_QEventDispatcher::sendPostedEvents() to test that posted events are sent when waiting for events and when not waiting. Change-Id: I99f9eb121d0b1ded725e19c5233922fc0a6b81e4 Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/corelib/kernel/qeventdispatcher/tst_qeventdispatcher.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/auto/corelib/kernel/qeventdispatcher/tst_qeventdispatcher.cpp b/tests/auto/corelib/kernel/qeventdispatcher/tst_qeventdispatcher.cpp
index d06912ee91..bc6d6bfadd 100644
--- a/tests/auto/corelib/kernel/qeventdispatcher/tst_qeventdispatcher.cpp
+++ b/tests/auto/corelib/kernel/qeventdispatcher/tst_qeventdispatcher.cpp
@@ -76,6 +76,7 @@ private slots:
void registerTimer();
/* void registerSocketNotifier(); */ // Not implemented here, see tst_QSocketNotifier instead
/* void registerEventNotifiier(); */ // Not implemented here, see tst_QWinEventNotifier instead
+ void sendPostedEvents_data();
void sendPostedEvents();
};
@@ -178,9 +179,20 @@ void tst_QEventDispatcher::registerTimer()
#undef FIND_TIMERS
}
+void tst_QEventDispatcher::sendPostedEvents_data()
+{
+ QTest::addColumn<int>("processEventsFlagsInt");
+
+ QTest::newRow("WaitForMoreEvents") << int(QEventLoop::WaitForMoreEvents);
+ QTest::newRow("AllEvents") << int(QEventLoop::AllEvents);
+}
+
// test that the eventDispatcher sends posted events correctly
void tst_QEventDispatcher::sendPostedEvents()
{
+ QFETCH(int, processEventsFlagsInt);
+ QEventLoop::ProcessEventsFlags processEventsFlags = QEventLoop::ProcessEventsFlags(processEventsFlagsInt);
+
QElapsedTimer elapsedTimer;
elapsedTimer.start();
while (!elapsedTimer.hasExpired(200)) {
@@ -191,7 +203,7 @@ void tst_QEventDispatcher::sendPostedEvents()
QCOMPARE(receivedEventType, -1);
// since there is a pending posted event, this should not actually block, it should send the posted event and return
- QVERIFY(eventDispatcher->processEvents(QEventLoop::WaitForMoreEvents));
+ QVERIFY(eventDispatcher->processEvents(processEventsFlags));
// event shouldn't be delivered as a result of posting
QCOMPARE(receivedEventType, int(QEvent::User));
}