From 05dfd8a0bdf8b8ab3c3347e546e18346ee81dffe Mon Sep 17 00:00:00 2001 From: Axel Spoerl Date: Sun, 10 Nov 2024 18:25:11 +0100 Subject: [PATCH] tst_Gestures::conflictingGesturesInGraphicsView(): use dynamic size The test function assigns a hard coded rectangle to gestures and uses the default size of a graphics view at the same time. The leads to flakiness, where the gestures can't be delivered when their size is out of bounds of the view's geometry. Assign size size dynamically, according to the view's geometry. Task-number: QTBUG-130811 Pick-to: 6.5 Change-Id: If75f59d15f84e610b4ec987daa2a06ce62539228 Reviewed-by: Frederic Lefebvre Reviewed-by: Volker Hilsheimer (cherry picked from commit 6995709992344ac608f2b2a19b2c3883019bfaeb) Reviewed-by: Qt Cherry-pick Bot --- tests/auto/other/gestures/tst_gestures.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/auto/other/gestures/tst_gestures.cpp b/tests/auto/other/gestures/tst_gestures.cpp index a4132683217..4a3d1e0ac2b 100644 --- a/tests/auto/other/gestures/tst_gestures.cpp +++ b/tests/auto/other/gestures/tst_gestures.cpp @@ -2286,22 +2286,23 @@ void tst_Gestures::conflictingGesturesInGraphicsView() GraphicsView view(&scene); view.setWindowFlags(Qt::X11BypassWindowManagerHint); + view.show(); + QVERIFY(QTest::qWaitForWindowExposed(&view)); + view.ensureVisible(scene.sceneRect()); + const QRectF gestureRect(0, 0, view.width() * 0.9, view.height() * 0.9); + GestureItem *item1 = new GestureItem("item1"); item1->grabGesture(CustomGesture::GestureType); - item1->size = QRectF(0, 0, 100, 100); + item1->size = gestureRect; item1->setZValue(2); scene.addItem(item1); GestureItem *item2 = new GestureItem("item2"); item2->grabGesture(CustomGesture::GestureType); - item2->size = QRectF(0, 0, 100, 100); + item2->size = gestureRect; item2->setZValue(5); scene.addItem(item2); - view.show(); - QVERIFY(QTest::qWaitForWindowExposed(&view)); - view.ensureVisible(scene.sceneRect()); - static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; CustomEvent event;