blob: b8f97580505bcd6fb08e00023adf8a1aa2ad7d79 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef EVENTFILTER
#define EVENTFILTER
#include <QWidget>
#include <QList>
#include <QEvent>
#include <QBasicTimer>
class ExpectedEventList : public QObject
{
QList<QEvent *> eventList;
QBasicTimer timer;
int debug;
int eventCount;
void timerEvent(QTimerEvent *);
public:
ExpectedEventList(QObject *target);
~ExpectedEventList();
void append(QEvent *e);
bool waitForAllEvents(int timeoutPerEvent = 2000);
bool eventFilter(QObject *obj, QEvent *event);
private:
void compareMouseEvents(QEvent *event1, QEvent *event2);
void compareKeyEvents(QEvent *event1, QEvent *event2);
};
#endif
|