summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/graphicsview
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2022-09-14 11:14:09 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2022-09-14 19:07:14 +0200
commit2e58e242b436d0d462748546d4451f6365de4743 (patch)
treebbfa89e8b00cf0e7a564af50a19d79653e4d3ea4 /tests/auto/widgets/graphicsview
parent68d041d27d85efa1b54d111c02f3ca252841224b (diff)
Don't rely on synthetic mouse events in updateFocusChainWhenChildDie test
Synthetic mouse events are not reliable, as the platform might restrict synthetic mouse moves. In addition, the WM might automatically activate the window when the other window is hidden, which makes the EXPECT_FAIL flakey. Since the test was not written to test window activation, let's just explicitly activate the window. Fixes: QTBUG-23699 Pick-to: 6.4 Change-Id: I0ac1d3bc0658dfbd600a1f5d960839860be6dd2c Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'tests/auto/widgets/graphicsview')
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicswidget/BLACKLIST1
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp11
2 files changed, 3 insertions, 9 deletions
diff --git a/tests/auto/widgets/graphicsview/qgraphicswidget/BLACKLIST b/tests/auto/widgets/graphicsview/qgraphicswidget/BLACKLIST
index 97aa5d3cca..cad381b7b7 100644
--- a/tests/auto/widgets/graphicsview/qgraphicswidget/BLACKLIST
+++ b/tests/auto/widgets/graphicsview/qgraphicswidget/BLACKLIST
@@ -6,4 +6,3 @@ b2qt
[updateFocusChainWhenChildDie]
b2qt
qnx
-macos-13 ci
diff --git a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp
index 0a5150de72..922589ce67 100644
--- a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp
@@ -1721,7 +1721,7 @@ void tst_QGraphicsWidget::updateFocusChainWhenChildDie()
view.resize(200, 150);
view.move(availableGeometry.topLeft() + QPoint(50, 50));
view.show();
- QApplicationPrivate::setActiveWindow(&view);
+ view.activateWindow();
QVERIFY(QTest::qWaitForWindowActive(&view));
// delete item in focus chain with no focus and verify chain
@@ -1750,13 +1750,8 @@ void tst_QGraphicsWidget::updateFocusChainWhenChildDie()
w->setParentItem(parent);
//We don't crash perfect
QVERIFY(w);
- const QPoint center(view.viewport()->width() / 2, view.viewport()->height() / 2);
- QTest::mouseMove(view.viewport(), center);
- QTest::mouseClick(view.viewport(), Qt::LeftButton, {}, center);
-#ifdef Q_OS_MAC
- QEXPECT_FAIL("", "QTBUG-23699", Continue);
-#endif
- QTRY_COMPARE(qApp->activeWindow(), static_cast<QWidget *>(&view));
+ view.activateWindow();
+ QVERIFY(QTest::qWaitForWindowActive(&view));
QTRY_COMPARE(scene.focusItem(), static_cast<QGraphicsItem *>(w));
}