Baseline testing of widget: wait before taking snapshot

Widgets and styles might use fade effects or other asynchronous mechanisms
as part of hovering. This results in mismatches when the snapshot is
taken before those effects are completed.

Since we can't control all such animations from the outside, process
events for some milliseconds before taking the snapshot.

Pick-to: 6.3
Change-Id: I771658300628238552bddcd14a6751c3f6c0c63d
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
This commit is contained in:
Volker Hilsheimer 2022-03-23 15:40:04 +01:00
parent 664b84c137
commit dc96d812ec

View File

@ -131,7 +131,8 @@ void QWidgetBaselineTest::makeVisible()
*/
QImage QWidgetBaselineTest::takeSnapshot()
{
QGuiApplication::processEvents();
// make sure all effects are done
QTest::qWait(250);
return window->grab().toImage();
}