QGraphicsWidget: skip test if graphics view fails to show

We set Qt::X11BypassWindowManagerHint on the view, which regularly makes
the test fail on X11 systems in the

QVERIFY(QTest::qWaitForWindowActive(dummyView.data()))

check.

If the view fails to show, skip the test instead of failing, we are not
testing anything X11 specific here, running this test on other platforms
will be good enough.

Fixes: QTBUG-98921
Change-Id: I46dbcddf51ee1e92eb3bbb29bb57fcc314266bea
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit a2c7428e4dcfb30fa391083aff6618c1f54e777a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Volker Hilsheimer 2022-07-14 09:11:40 +02:00 committed by Qt Cherry-pick Bot
parent 3073401ff6
commit ca7a2f84de

View File

@ -3099,7 +3099,8 @@ void tst_QGraphicsWidget::initialShow()
EventSpy paintSpy(dummyView->viewport(), QEvent::Paint);
dummyView->show();
qApp->setActiveWindow(dummyView.data());
QVERIFY(QTest::qWaitForWindowActive(dummyView.data()));
if (!QTest::qWaitForWindowActive(dummyView.data()))
QSKIP("Graphics view failed to show (possibly due to Qt::X11BypassWindowManagerHint");
const int expectedRepaintCount = paintSpy.count();
dummyView.reset();