Tests/QListView: fix internalDragDropMove 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() which makes the test fail.
Fix it by waiting for a move event with a position != 0,0 before
starting the drag'n'drop operation.

Fixes: QTBUG-94250
Change-Id: If91a15815205ba9dcea36248d9de03ed0a7e5822
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
This commit is contained in:
Christian Ehrlicher 2023-10-04 21:11:18 +02:00
parent 9187348505
commit 9ed25b413f
2 changed files with 7 additions and 3 deletions

View File

@ -1,3 +0,0 @@
# QTBUG-94250
[internalDragDropMove]
opensuse-leap

View File

@ -68,8 +68,14 @@ public:
{
return QListView::visualRegionForSelection(selectionModel()->selection());
}
void moveEvent(QMoveEvent *e) override
{
QListView::moveEvent(e);
m_gotValidResizeEvent = !e->pos().isNull();
}
friend class tst_QListView;
bool m_gotValidResizeEvent = false;
};
class tst_QListView : public QObject
@ -2995,6 +3001,7 @@ void tst_QListView::internalDragDropMove()
// The test relies on the global position of mouse events; make sure
// the window is properly mapped on X11.
QVERIFY(QTest::qWaitForWindowActive(&list));
QVERIFY(QTest::qWaitFor([&]() { return list.m_gotValidResizeEvent; }));
// execute as soon as the eventloop is running again
// which is the case inside list.startDrag()
QTimer::singleShot(0, [&]()