From dc96d812ec0c2a007fdaf2659b73dd6ed8b61dfe Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Wed, 23 Mar 2022 15:40:04 +0100 Subject: [PATCH] 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 Reviewed-by: Eirik Aavitsland --- tests/baseline/shared/qwidgetbaselinetest.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/baseline/shared/qwidgetbaselinetest.cpp b/tests/baseline/shared/qwidgetbaselinetest.cpp index 3be8ae7893c..b5db9a23f15 100644 --- a/tests/baseline/shared/qwidgetbaselinetest.cpp +++ b/tests/baseline/shared/qwidgetbaselinetest.cpp @@ -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(); }