40
43
qFatal("Item '%s' found with unexpected type", qPrintable(objectName));
41
44
qFatal("No item '%s' found", qPrintable(objectName));
47
static void registerTouchDevice();
49
inline static void touchPress(int touchId, QWindow *window, const QPoint &point)
52
QTest::touchEvent(window, m_touchDevice).press(touchId, point, window);
54
inline static void touchRelease(int touchId, QWindow *window, const QPoint &point)
57
QTest::touchEvent(window, m_touchDevice).release(touchId, point, window);
59
inline static void touchClick(int touchId, QWindow *window, const QPoint &point)
62
touchPress(touchId, window, point);
64
touchRelease(touchId, window, point);
66
inline static void touchLongPress(int touchId, QWindow *window, const QPoint &point)
69
touchPress(touchId, window, point);
72
inline static void touchDoubleClick(int touchId, QWindow *window, const QPoint &point)
75
touchClick(touchId, window, point);
77
touchClick(touchId, window, point);
79
inline static void touchMove(int touchId, QWindow *window, const QPoint &point)
82
QTest::touchEvent(window, m_touchDevice).move(touchId, point, window);
84
inline static void touchDrag(int touchId, QWindow *window, const QPoint &from, const QPoint &delta, int steps = 5)
86
touchPress(touchId, window, from);
88
QTest::touchEvent(window, m_touchDevice).move(touchId, from, window);
89
qreal stepDx = delta.x() / steps;
90
qreal stepDy = delta.y() / steps;
91
if (!delta.isNull()) {
92
for (int i = 0; i < steps; i++) {
94
QTest::touchEvent(window, m_touchDevice).move(touchId, from + QPoint(i * stepDx, i * stepDy), window);
98
touchRelease(touchId, window, from + QPoint(stepDx, stepDy));
44
103
QSignalSpy* m_spy;
104
static QTouchDevice *m_touchDevice;
106
static inline bool checkTouchDevice(const char *func)
108
if (!m_touchDevice) {
109
qWarning() << QString("No touch device registered. Register one using registerTouchDevice() before using %1").arg(func);
47
116
#endif // UBUNTU_TEST_UBUNTUTESTCASE_H