summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2019-08-26 14:55:16 +0200
committerJohan Klokkhammer Helsing <johan.helsing@qt.io>2019-09-20 16:09:48 +0200
commitd8c19df22a1ff6ee40373a96fa12183acfc1b452 (patch)
tree46aa62586394844f079512a371d7dd675030cb21
parent694c96254b79cbe1c45ee6bafedf9649ee88abbc (diff)
Client: Test that wl_touch.up events don't split touch framesv5.14.0-alpha1
We have a workaround for Weston not sending wl_touch.frame events after the last wl_touch.up event. It calls Touch::touch_frame to generate a fake event. The problem, however, is that it used to erroneously do this on wl_touch.up events even when it was not for the last touch point. This in turn, lead to extra frame events being inserted in the middle of a touch sequence, effectively splitting up one touch frame into multiple. Accumulated touch state would be handled prematurely, preventing wl_touch.cancel from working correctly for instance. This tests that we've stopped doing that. Change-Id: Ic545bbb18c23b827e5fa07a642a374094d720dae Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
-rw-r--r--tests/auto/client/seatv5/tst_seatv5.cpp50
1 files changed, 50 insertions, 0 deletions
diff --git a/tests/auto/client/seatv5/tst_seatv5.cpp b/tests/auto/client/seatv5/tst_seatv5.cpp
index bf3c4f99d..636f26081 100644
--- a/tests/auto/client/seatv5/tst_seatv5.cpp
+++ b/tests/auto/client/seatv5/tst_seatv5.cpp
@@ -70,6 +70,7 @@ private slots:
void singleTap();
void singleTapFloat();
void multiTouch();
+ void multiTouchUpAndMotionFrame();
};
void tst_seatv5::bindsToSeat()
@@ -536,5 +537,54 @@ void tst_seatv5::multiTouch()
}
}
+void tst_seatv5::multiTouchUpAndMotionFrame()
+{
+ TouchWindow window;
+ QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial);
+
+ exec([=] {
+ auto *t = touch();
+ auto *c = client();
+
+ t->sendDown(xdgToplevel()->surface(), {32, 32}, 0);
+ t->sendDown(xdgToplevel()->surface(), {48, 48}, 1);
+ t->sendFrame(c);
+
+ // Sending an up event after a frame event, before any motion or down events used to
+ // unnecessarily trigger a workaround for a bug in an old version of Weston. The workaround
+ // would prematurely insert a fake frame event splitting the touch event up into two events.
+ // However, this should only be needed on the up event for the very last touch point. So in
+ // this test we verify that it doesn't unncecessarily break up the events.
+ t->sendUp(c, 0);
+ t->sendMotion(c, {49, 48}, 1);
+ t->sendFrame(c);
+
+ t->sendUp(c, 1);
+ t->sendFrame(c);
+ });
+
+ QTRY_VERIFY(!window.m_events.empty());
+ {
+ auto e = window.m_events.takeFirst();
+ QCOMPARE(e.type, QEvent::TouchBegin);
+ QCOMPARE(e.touchPoints[0].state(), Qt::TouchPointState::TouchPointPressed);
+ QCOMPARE(e.touchPoints[1].state(), Qt::TouchPointState::TouchPointPressed);
+ }
+ {
+ auto e = window.m_events.takeFirst();
+ QCOMPARE(e.type, QEvent::TouchUpdate);
+ QCOMPARE(e.touchPoints.length(), 2);
+ QCOMPARE(e.touchPoints[0].state(), Qt::TouchPointState::TouchPointReleased);
+ QCOMPARE(e.touchPoints[1].state(), Qt::TouchPointState::TouchPointMoved);
+ }
+ {
+ auto e = window.m_events.takeFirst();
+ QCOMPARE(e.type, QEvent::TouchEnd);
+ QCOMPARE(e.touchPoints.length(), 1);
+ QCOMPARE(e.touchPoints[0].state(), Qt::TouchPointState::TouchPointReleased);
+ }
+ QVERIFY(window.m_events.empty());
+}
+
QCOMPOSITOR_TEST_MAIN(tst_seatv5)
#include "tst_seatv5.moc"