The helper function TestWidget::waitForPainted returned after the test
widget had consumed the first paint event. In case of multiple paint
events, QRegion paintedRegions did not match the entire region that
was supposed to be painted. The test function children() failed/flaked
due to that.
This patch extends the helper function. After consumption of the first
paint event, it processes events until the painted regions no longer
change.
Pick-to: 6.4
Fixes: QTBUG-108764
Change-Id: I54e14bb07725dd1f602cc93085da13836e3b7494
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>