diff options
Diffstat (limited to 'tests/auto/client/seat/tst_seat.cpp')
-rw-r--r-- | tests/auto/client/seat/tst_seat.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/auto/client/seat/tst_seat.cpp b/tests/auto/client/seat/tst_seat.cpp index dd52789b4..0b1e1b2a2 100644 --- a/tests/auto/client/seat/tst_seat.cpp +++ b/tests/auto/client/seat/tst_seat.cpp @@ -50,6 +50,7 @@ private slots: void multiTouch(); void multiTouchUpAndMotionFrame(); void tapAndMoveInSameFrame(); + void cancelTouch(); }; void tst_seat::bindsToSeat() @@ -633,5 +634,34 @@ void tst_seat::tapAndMoveInSameFrame() QTRY_COMPARE(window.m_events.last().touchPoints.first().state(), QEventPoint::State::Released); } +void tst_seat::cancelTouch() +{ + TouchWindow window; + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + + exec([=] { + auto *t = touch(); + auto *c = client(); + t->sendDown(xdgToplevel()->surface(), {32, 32}, 1); + t->sendFrame(c); + t->sendCancel(c); + t->sendFrame(c); + }); + + QTRY_VERIFY(!window.m_events.empty()); + { + auto e = window.m_events.takeFirst(); + QCOMPARE(e.type, QEvent::TouchBegin); + QCOMPARE(e.touchPointStates, QEventPoint::State::Pressed); + QCOMPARE(e.touchPoints.length(), 1); + QCOMPARE(e.touchPoints.first().position(), QPointF(32-window.frameMargins().left(), 32-window.frameMargins().top())); + } + { + auto e = window.m_events.takeFirst(); + QCOMPARE(e.type, QEvent::TouchCancel); + QCOMPARE(e.touchPoints.length(), 0); + } +} + QCOMPOSITOR_TEST_MAIN(tst_seat) #include "tst_seat.moc" |