Stabilize test by not activating window

Window activation is not working reliably on X11 when combined with
X11BypassWindowManagerHint, see QXcbWindow::requestActivateWindow().

The test itself counts repaints, so qWaitForWindowExposed() shouldn't be
needed.

This way we don't need to QSKIP() the test if window activation fails.

Fixes: QTBUG-98921
Change-Id: I849b7261c757fb7cbcde73f11bbe1a74a862cb9c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Dimitrios Apostolou 2022-07-29 12:45:16 +02:00
parent 74f3bc263a
commit 7524a36a26
2 changed files with 2 additions and 8 deletions

View File

@ -6,6 +6,3 @@ b2qt
[updateFocusChainWhenChildDie]
b2qt
qnx
[initialShow]
macos ci
opensuse-leap

View File

@ -3098,9 +3098,7 @@ void tst_QGraphicsWidget::initialShow()
dummyView->setWindowFlags(Qt::X11BypassWindowManagerHint);
EventSpy paintSpy(dummyView->viewport(), QEvent::Paint);
dummyView->show();
qApp->setActiveWindow(dummyView.data());
if (!QTest::qWaitForWindowActive(dummyView.data()))
QSKIP("Graphics view failed to show (possibly due to Qt::X11BypassWindowManagerHint");
QVERIFY(QTest::qWaitForWindowExposed(dummyView.data()));
const int expectedRepaintCount = paintSpy.count();
dummyView.reset();
@ -3113,8 +3111,7 @@ void tst_QGraphicsWidget::initialShow()
QGraphicsView view(&scene);
view.setWindowFlags(view.windowFlags()|Qt::X11BypassWindowManagerHint);
view.show();
qApp->setActiveWindow(&view);
QVERIFY(QTest::qWaitForWindowActive(&view));
QVERIFY(QTest::qWaitForWindowExposed(&view));
QTRY_COMPARE(widget->repaints, expectedRepaintCount);
}