2
* Copyright (C) 2014 Canonical, Ltd.
4
* This program is free software: you can redistribute it and/or modify it under
5
* the terms of the GNU Lesser General Public License version 3, as published by
6
* the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful, but WITHOUT
9
* ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
10
* SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
* Lesser General Public License for more details.
13
* You should have received a copy of the GNU Lesser General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
18
#ifndef MOCK_QTWINDOWSYSTEM_H
19
#define MOCK_QTWINDOWSYSTEM_H
21
#include <qteventfeeder.h>
23
class MockQtWindowSystem : public QtEventFeeder::QtWindowSystemInterface {
25
MOCK_METHOD0(hasTargetWindow, bool());
26
MOCK_METHOD0(targetWindowGeometry, QRect());
27
MOCK_METHOD1(registerTouchDevice, void(QTouchDevice* device));
28
MOCK_METHOD10(handleExtendedKeyEvent, void(ulong timestamp, QEvent::Type type, int key,
29
Qt::KeyboardModifiers modifiers,
30
quint32 nativeScanCode, quint32 nativeVirtualKey,
31
quint32 nativeModifiers,
32
const QString& text, bool autorep,
34
MOCK_METHOD4(handleTouchEvent, void(ulong timestamp, QTouchDevice *device,
35
const QList<struct QWindowSystemInterface::TouchPoint> &points,
36
Qt::KeyboardModifiers mods));
42
MATCHER(IsPressed, std::string(negation ? "isn't" : "is") + " pressed")
44
return arg.state == Qt::TouchPointPressed;
47
MATCHER(IsReleased, std::string(negation ? "isn't" : "is") + " released")
49
return arg.state == Qt::TouchPointReleased;
52
MATCHER(StateIsMoved, "state " + std::string(negation ? "isn't" : "is") + " 'moved'")
54
return arg.state == Qt::TouchPointMoved;
57
MATCHER_P(HasId, expectedId, "id " + std::string(negation ? "isn't " : "is ") + PrintToString(expectedId))
59
return arg.id == expectedId;
62
} // namespace testing
65
#endif // MOCK_QTWINDOWSYSTEM_H