From b340fb69828bdbb101c3eeb0c773f554014bba77 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Fri, 29 Nov 2024 10:48:45 +0100 Subject: [PATCH] Baseline tests: disable animations in the vista style The Vista style uses a dynamic property on each objects to control animations; respect that dynamic property on the style itself as well to make it possible to turn off animations. Do so in the baseline test framework to get rid of some flakiness when using the Windows Vista style. Change-Id: I2bad329786f38e37d99f947f121e5cd44f5741c1 Reviewed-by: Axel Spoerl Reviewed-by: Wladimir Leuschner --- src/plugins/styles/modernwindows/qwindowsvistastyle.cpp | 3 +++ tests/baseline/shared/qwidgetbaselinetest.cpp | 1 + 2 files changed, 4 insertions(+) diff --git a/src/plugins/styles/modernwindows/qwindowsvistastyle.cpp b/src/plugins/styles/modernwindows/qwindowsvistastyle.cpp index 4ef47c36da9..d288295fbee 100644 --- a/src/plugins/styles/modernwindows/qwindowsvistastyle.cpp +++ b/src/plugins/styles/modernwindows/qwindowsvistastyle.cpp @@ -204,6 +204,9 @@ void QWindowsVistaStylePrivate::cleanup(bool force) bool QWindowsVistaStylePrivate::transitionsEnabled() const { + Q_Q(const QWindowsVistaStyle); + if (q->property("_q_no_animation").toBool()) + return false; if (QApplication::desktopSettingsAware()) { BOOL animEnabled = false; if (SystemParametersInfo(SPI_GETCLIENTAREAANIMATION, 0, &animEnabled, 0)) { diff --git a/tests/baseline/shared/qwidgetbaselinetest.cpp b/tests/baseline/shared/qwidgetbaselinetest.cpp index f0d3da9e13c..32fd3eef9b7 100644 --- a/tests/baseline/shared/qwidgetbaselinetest.cpp +++ b/tests/baseline/shared/qwidgetbaselinetest.cpp @@ -33,6 +33,7 @@ QWidgetBaselineTest::QWidgetBaselineTest() #endif // turn off animations and make the cursor flash time really long to avoid blinking QApplication::style()->setProperty("_qt_animation_time", QTime()); + QApplication::style()->setProperty("_q_no_animation", true); QGuiApplication::styleHints()->setCursorFlashTime(50000); QByteArray appearanceBytes;