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>
This commit is contained in:
parent
68d041d27d
commit
2e58e242b4
@ -6,4 +6,3 @@ b2qt
|
||||
[updateFocusChainWhenChildDie]
|
||||
b2qt
|
||||
qnx
|
||||
macos-13 ci
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user