From 9ed25b413ff2e5055ec03fd6e1f8ba5dfcfc499a Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Wed, 4 Oct 2023 21:11:18 +0200 Subject: [PATCH] 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 --- tests/auto/widgets/itemviews/qlistview/BLACKLIST | 3 --- tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp | 7 +++++++ 2 files changed, 7 insertions(+), 3 deletions(-) delete mode 100644 tests/auto/widgets/itemviews/qlistview/BLACKLIST diff --git a/tests/auto/widgets/itemviews/qlistview/BLACKLIST b/tests/auto/widgets/itemviews/qlistview/BLACKLIST deleted file mode 100644 index ec1c3722bd2..00000000000 --- a/tests/auto/widgets/itemviews/qlistview/BLACKLIST +++ /dev/null @@ -1,3 +0,0 @@ -# QTBUG-94250 -[internalDragDropMove] -opensuse-leap diff --git a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp index 2b908d4d4f7..93e6080968d 100644 --- a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp +++ b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp @@ -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, [&]()