diff options
author | Johan Klokkhammer Helsing <johan.helsing@qt.io> | 2018-02-21 10:29:24 +0100 |
---|---|---|
committer | Johan Helsing <johan.helsing@qt.io> | 2018-02-21 10:36:28 +0000 |
commit | 3dd9c91b6ebd7f9eccecad90ac57681f6bf6c5d6 (patch) | |
tree | 875da679118dbe39ee33e843a46ada9eda609029 | |
parent | 1ebb4e0d64bf27dfc6c38b9770ae744fad87fb82 (diff) | |
download | qtwayland-3dd9c91b6ebd7f9eccecad90ac57681f6bf6c5d6.tar.gz |
Fix flakiness in tst_WaylandClient::events
The test was flaky because we have a workaround for a bug in Weston where
Weston fails to send the last wl_touch.frame event (QTBUG-36602). We've worked
around it by letting our client handle the wl_touch.up event before the frame
event if it's the last up event.
This caused a race condition in our tests, though (which include the frame
event). Because Q_TRY_COMPARE(window.touchEventCount, 1) would pass and the
window was sometimes destroyed before the frame event had been sent by the
compositor thread.
Work around it by moving the touch testing before the pointer testing, so the
surface is still alive when the compositor tries to send the frame event. That
way the test will not be flaky, and will continue to work when we eventually
remove the workaround in QWaylandInputDevice.
Task-number: QTBUG-66537
Change-Id: I5673445682810e75343c6df2d1b2a4f1c1b21bcb
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
-rw-r--r-- | tests/auto/client/client/tst_client.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/tests/auto/client/client/tst_client.cpp b/tests/auto/client/client/tst_client.cpp index 0e086c7a..981b8f12 100644 --- a/tests/auto/client/client/tst_client.cpp +++ b/tests/auto/client/client/tst_client.cpp @@ -314,6 +314,17 @@ void tst_WaylandClient::events() QTRY_COMPARE(window.keyReleaseEventCount, 1); QCOMPARE(window.keyCode, keyCode); + const int touchId = 0; + compositor->sendTouchDown(surface, window.frameOffset() + QPoint(10, 10), touchId); + // Note: wl_touch.frame should not be the last event in a test until QTBUG-66563 is fixed. + // See also: QTBUG-66537 + compositor->sendTouchFrame(surface); + QTRY_COMPARE(window.touchEventCount, 1); + + compositor->sendTouchUp(surface, touchId); + compositor->sendTouchFrame(surface); + QTRY_COMPARE(window.touchEventCount, 2); + QPoint mousePressPos(16, 16); QCOMPARE(window.mousePressEventCount, 0); compositor->sendMousePress(surface, window.frameOffset() + mousePressPos); @@ -323,15 +334,6 @@ void tst_WaylandClient::events() QCOMPARE(window.mouseReleaseEventCount, 0); compositor->sendMouseRelease(surface); QTRY_COMPARE(window.mouseReleaseEventCount, 1); - - const int touchId = 0; - compositor->sendTouchDown(surface, window.frameOffset() + 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() |