diff options
author | Johan Klokkhammer Helsing <johan.helsing@qt.io> | 2019-11-04 14:21:51 +0100 |
---|---|---|
committer | Johan Klokkhammer Helsing <johan.helsing@qt.io> | 2019-11-29 11:27:55 +0100 |
commit | ce06115da6bf4c8d891ff0aa382dd2b1f5b4bf65 (patch) | |
tree | aa1be599f03c79c546763e84e1f46ab5ed4f4c7c /tests/auto/client | |
parent | 36974955d13578071387695adb13a47be33e4d32 (diff) | |
download | qtwayland-ce06115da6bf4c8d891ff0aa382dd2b1f5b4bf65.tar.gz |
Add client test for touch down and motion in same frame
Task-number: QTBUG-79744
Change-Id: Ibb8239b4f53a345105bee3cc7a0fb4b777cabf9b
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'tests/auto/client')
-rw-r--r-- | tests/auto/client/seatv5/tst_seatv5.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/auto/client/seatv5/tst_seatv5.cpp b/tests/auto/client/seatv5/tst_seatv5.cpp index 636f2608..e333082e 100644 --- a/tests/auto/client/seatv5/tst_seatv5.cpp +++ b/tests/auto/client/seatv5/tst_seatv5.cpp @@ -71,6 +71,7 @@ private slots: void singleTapFloat(); void multiTouch(); void multiTouchUpAndMotionFrame(); + void tapAndMoveInSameFrame(); }; void tst_seatv5::bindsToSeat() @@ -586,5 +587,37 @@ void tst_seatv5::multiTouchUpAndMotionFrame() QVERIFY(window.m_events.empty()); } +void tst_seatv5::tapAndMoveInSameFrame() +{ + TouchWindow window; + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + + exec([=] { + auto *t = touch(); + auto *c = client(); + + t->sendDown(xdgToplevel()->surface(), {32, 32}, 0); + t->sendMotion(c, {33, 33}, 0); + t->sendFrame(c); + + // Don't leave touch in a weird state + t->sendUp(c, 0); + t->sendFrame(c); + }); + + QTRY_VERIFY(!window.m_events.empty()); + { + auto e = window.m_events.takeFirst(); + QCOMPARE(e.type, QEvent::TouchBegin); + QCOMPARE(e.touchPoints.size(), 1); + QCOMPARE(e.touchPoints[0].state(), Qt::TouchPointState::TouchPointPressed); + // Position isn't that important, we just want to make sure we actually get the pressed event + } + + // Make sure we eventually release + QTRY_VERIFY(!window.m_events.empty()); + QTRY_COMPARE(window.m_events.last().touchPoints.first().state(), Qt::TouchPointState::TouchPointReleased); +} + QCOMPOSITOR_TEST_MAIN(tst_seatv5) #include "tst_seatv5.moc" |