summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Ehrlicher <ch.ehrlicher@gmx.de>2024-04-29 20:49:47 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2024-05-16 22:49:09 +0000
commit623e9b1fb44ea7dedf7037477f7005dcb0ea368b (patch)
tree6da0826bfae0691a5268e3c0642f7c4b1fdcd835
parent813d8d55887e4b838f95c0b37c474579373f231b (diff)
Tests/QWidget: fix hoverPosition test for openSUSE
On some xcb platforms the xcb_configure_notify_event_t is sent after the window is fully exposed which leads to a wrong position for QWidget::mapToGlobal(). In this case this results in a wrong position for QCursor::setPos() which lets the test fail. Fix it by waiting for a move event with a position != 0,0 before calling mapToParent/Global(). Pick-to: 6.5 6.2 Fixes: QTBUG-123998 Change-Id: Ic5e989c4497ccf3ed720a521f9d7e73632b4b1fc Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> (cherry picked from commit f6fdd91941de1cefb021b837ece77fec7363f23c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
index cb3331a034..924c485306 100644
--- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
@@ -11079,6 +11079,10 @@ void tst_QWidget::hoverPosition()
QVERIFY(QTest::qWaitForWindowExposed(&root));
const QPoint middle(50, 50);
+ // wait until we got the correct global pos
+ QPoint expectedGlobalPos = root.geometry().topLeft() + QPoint(100, 100) + middle;
+ if (!QTest::qWaitFor([&]{ return expectedGlobalPos == h.mapToGlobal(middle); }))
+ QSKIP("Can't move cursor");
QPoint curpos = h.mapToGlobal(middle);
QCursor::setPos(curpos);
if (!QTest::qWaitFor([curpos]{ return QCursor::pos() == curpos; }))