diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2021-01-11 17:36:30 +0100 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2021-01-13 11:33:07 +0100 |
commit | 4b66c0bd7de6063982459fe45f69278fd0519b1b (patch) | |
tree | f460843770617b2a08d4cf586be70778c6e3a22b /tests/auto/shared | |
parent | 023a03e9c5d2e714b676df0c89e90f3057be52e4 (diff) |
Ensure that C++ Qt Quick tests are run with all applicable styles
Since 8b534487044dfb3b464431ecb91ef4e0864af4ed, the C++ tests were only
being run with the default style for the platform that they were run
on.
Fix this by keeping track of whether a default style is in use and
checking it in the tests.
Pick-to: 6.0
Change-Id: I4ddd90aba12ede83fff0d3d1002534e79fce8c87
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/shared')
-rw-r--r-- | tests/auto/shared/qtest_quickcontrols.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/auto/shared/qtest_quickcontrols.h b/tests/auto/shared/qtest_quickcontrols.h index acd0304c..8eadd979 100644 --- a/tests/auto/shared/qtest_quickcontrols.h +++ b/tests/auto/shared/qtest_quickcontrols.h @@ -46,7 +46,11 @@ static QStringList testStyles() { - if (QQuickStyle::name().isEmpty()) + // It's not enough to check if the name is empty, because since Qt 6 + // we set an appropriate style for the platform if no style was specified. + // Also, we need the name check to come first, as isUsingDefaultStyle() does not do any resolving, + // and so its return value wouldn't be correct otherwise. + if (QQuickStyle::name().isEmpty() || QQuickStylePrivate::isUsingDefaultStyle()) return QQuickStylePrivate::builtInStyles(); return QStringList(QQuickStyle::name()); } |