summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2018-02-21 10:29:24 +0100
committerJohan Helsing <johan.helsing@qt.io>2018-02-21 11:59:03 +0000
commit01deb0260a9f3ef683dc6120e62243ed18fcb1aa (patch)
treeb12d3b3bcffb2046425607692e21a953510d4394
parent79cde9fba8452afba049f4fd611dfe9cf8f1be12 (diff)
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> (cherry picked from commit 3dd9c91b6ebd7f9eccecad90ac57681f6bf6c5d6)
-rw-r--r--tests/auto/client/client/tst_client.cpp20
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 aed601d8a..2124205bf 100644
--- a/tests/auto/client/client/tst_client.cpp
+++ b/tests/auto/client/client/tst_client.cpp
@@ -225,6 +225,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);
@@ -234,15 +245,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()