summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBenjamin Poulain <benjamin.poulain@nokia.com>2009-09-22 16:34:10 (GMT)
committerBenjamin Poulain <benjamin.poulain@nokia.com>2009-09-22 16:38:15 (GMT)
commit074c697177ea699e55970f7678b558f335984782 (patch)
tree40cf4c1a5c55f4bb117a1c2edffc9ac98c98318e /tests
parenta2a4e1c9fa5b3ffb151029735eb89e3708572928 (diff)
downloadQt-074c697177ea699e55970f7678b558f335984782.zip
Qt-074c697177ea699e55970f7678b558f335984782.tar.gz
Qt-074c697177ea699e55970f7678b558f335984782.tar.bz2
Add a test for the first ::processEvents() on QApplication
The test of ea0c0dfa64f5c614bfd728f323d9b6731ee4898c is not valid for the change introduced in that commit. QCoreApplication does not use the event loop of Cocoa. This is the same test in QApplication.
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qapplication/tst_qapplication.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/auto/qapplication/tst_qapplication.cpp b/tests/auto/qapplication/tst_qapplication.cpp
index 2ba5239..c53fca8 100644
--- a/tests/auto/qapplication/tst_qapplication.cpp
+++ b/tests/auto/qapplication/tst_qapplication.cpp
@@ -84,6 +84,7 @@ public slots:
void init();
void cleanup();
private slots:
+ void sendEventsOnProcessEvents(); // this must be the first test
void getSetCheck();
void staticSetup();
@@ -137,6 +138,32 @@ private slots:
void touchEventPropagation();
};
+class EventSpy : public QObject
+{
+ Q_OBJECT
+
+public:
+ QList<int> recordedEvents;
+ bool eventFilter(QObject *, QEvent *event)
+ {
+ recordedEvents.append(event->type());
+ return false;
+ }
+};
+
+void tst_QApplication::sendEventsOnProcessEvents()
+{
+ int argc = 0;
+ QApplication app(argc, 0);
+
+ EventSpy spy;
+ app.installEventFilter(&spy);
+
+ QCoreApplication::postEvent(&app, new QEvent(QEvent::Type(QEvent::User + 1)));
+ QCoreApplication::processEvents();
+ QVERIFY(spy.recordedEvents.contains(QEvent::User + 1));
+}
+
class MyInputContext : public QInputContext
{
public: