tst_QGestureRecognizer::touchReplay give fix position

tst_QGestureRecognizer::panGesture() is flaky as sometimes
the gesture event is being sent outside of the parent. It
is being sent in the window frame instead of in the widget.

Fix position of the parent and verify that it is correct.

Fix flakiness on Opensuse 15

Pick-to: 6.9 6.8
Change-Id: I00eacb80a7e2e658345d3bc56cdef0c0024d1a1d
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
This commit is contained in:
Frédéric Lefebvre 2025-01-02 09:19:10 +01:00 committed by Frederic Lefebvre
parent 787d1db347
commit 3766b9cb3c

View File

@ -306,13 +306,16 @@ void tst_QGestureRecognizer::swipeGesture()
void tst_QGestureRecognizer::touchReplay()
{
const Qt::GestureType gestureType = Qt::TapGesture;
const QPoint pos = QGuiApplication::primaryScreen()->availableGeometry().topLeft();
QWidget parent;
TestWidget widget(GestureTypeVector(1, gestureType));
widget.setParent(&parent);
widget.setGeometry(0, 0, 100, 100);
parent.adjustSize();
parent.move(pos);
parent.show();
QVERIFY(QTest::qWaitForWindowActive(&parent));
QTRY_COMPARE(parent.pos(), pos);
QWindow* windowHandle = parent.window()->windowHandle();
const QPoint globalPos = QPoint(42, 16);