summaryrefslogtreecommitdiffstats
path: root/tests/auto/qapplication
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qapplication')
-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: