From 074c697177ea699e55970f7678b558f335984782 Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Tue, 22 Sep 2009 18:34:10 +0200 Subject: 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. --- tests/auto/qapplication/tst_qapplication.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) 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 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: -- cgit v0.12