Stabilize tst_QGraphicsEffect::draw()

It's very flakey in CI: http://testresults.qt.io/grafana/goto/XZQAAPRSg

What we want to test is whether Qt issues paint events in response
to enabling an already enabled effect. Doing so via qWait will process
both window system events and posted Qt events, and the former might
include spontaneous paint events from the system that we can't control.

Task-number: QTBUG-115945
Pick-to: 6.5 6.6
Change-Id: I65e5c6a4458e77b3bd2ad700c5caf6d441f4ca53
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
Tor Arne Vestbø 2023-08-24 14:34:21 +02:00
parent 2e37cff19e
commit ea25b3962b

View File

@ -354,7 +354,9 @@ void tst_QGraphicsEffect::draw()
// Effect is already enabled; nothing should happen.
effect->setEnabled(true);
QTest::qWait(50);
// Send only posted events, not window system events,
// so that we don't get any spontaneous paint events.
QCoreApplication::sendPostedEvents();
QCOMPARE(effect->numRepaints, 0);
QCOMPARE(item->numRepaints, 0);