summaryrefslogtreecommitdiffstats
path: root/tests/auto/client/tst_client.cpp
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2016-07-29 15:54:08 +0200
committerJohan Helsing <johan.helsing@qt.io>2016-08-01 12:26:15 +0000
commit972d1150ee794eac3920df3e0fc611315ad8daf4 (patch)
tree4764b77251852fee748b97caa8eac2ad267bb86e /tests/auto/client/tst_client.cpp
parentd8b4bef3ddff327598027c8f94a61e3d0b61a2dd (diff)
Also test touch in client events test
Following the same pattern as for mouse and keyboard, also test touch events. Change-Id: Ie84aa0ffe0b0f4f66e9f40207c63d94e32f6dbaf Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'tests/auto/client/tst_client.cpp')
-rw-r--r--tests/auto/client/tst_client.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/client/tst_client.cpp b/tests/auto/client/tst_client.cpp
index dd35b681c..3fde258d1 100644
--- a/tests/auto/client/tst_client.cpp
+++ b/tests/auto/client/tst_client.cpp
@@ -51,6 +51,7 @@ public:
, keyReleaseEventCount(0)
, mousePressEventCount(0)
, mouseReleaseEventCount(0)
+ , touchEventCount(0)
, keyCode(0)
{
setSurfaceType(QSurface::RasterSurface);
@@ -91,12 +92,18 @@ public:
++mouseReleaseEventCount;
}
+ void touchEvent(QTouchEvent *event) Q_DECL_OVERRIDE
+ {
+ ++touchEventCount;
+ }
+
int focusInEventCount;
int focusOutEventCount;
int keyPressEventCount;
int keyReleaseEventCount;
int mousePressEventCount;
int mouseReleaseEventCount;
+ int touchEventCount;
uint keyCode;
QPoint mousePressPos;
@@ -197,6 +204,15 @@ void tst_WaylandClient::events()
QCOMPARE(window.mouseReleaseEventCount, 0);
compositor->sendMouseRelease(surface);
QTRY_COMPARE(window.mouseReleaseEventCount, 1);
+
+ const int touchId = 0;
+ compositor->sendTouchDown(surface, QPoint(10, 10), touchId);
+ compositor->sendTouchFrame(surface);
+ QTRY_COMPARE(window.touchEventCount, 1);
+
+ compositor->sendTouchUp(surface, touchId);
+ compositor->sendTouchFrame(surface);
+ QTRY_COMPARE(window.touchEventCount, 2);
}
void tst_WaylandClient::backingStore()