tst_QGraphicsWidget: Test the cursor

Skip initStyleOption() if the cursor cannot be moved.

Fixes: QTBUG-129545
Change-Id: I6a42314515ab3e32b79c8c123eb8769b8c2c8ecb
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
This commit is contained in:
Audun Sutterud 2024-10-07 11:06:25 +02:00
parent 2c2d36fae1
commit c377f4e9b7
2 changed files with 4 additions and 3 deletions

View File

@ -1,5 +1,4 @@
[initStyleOption]
macos
android
b2qt
# QTBUG-100930

View File

@ -1085,8 +1085,10 @@ void tst_QGraphicsWidget::initStyleOption()
}
QFETCH(bool, underMouse);
if (underMouse) {
QCursor::setPos(view.viewport()->mapToGlobal(view.mapFromScene(widget->mapToScene(widget->boundingRect().center()))));
QTest::qWait(100);
const auto pos = view.viewport()->mapToGlobal(view.mapFromScene(widget->mapToScene(widget->boundingRect().center())));
QCursor::setPos(pos);
if (!QTest::qWaitFor([pos]{ return QCursor::pos() == pos; }))
QSKIP("Cannot move cursor");
}
QFETCH(QPalette, palette);