diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2017-05-18 18:12:22 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2017-05-20 07:00:19 +0000 |
commit | ea043d5d838f638e4bc5461aa23fb69a1a9e1eb6 (patch) | |
tree | 7acc76c536361009c3c36336cbd96ad2bcb075d4 /tests/auto/qquickstyleselector/tst_qquickstyleselector.cpp | |
parent | 2b20122b223f7619c7a1ba7b4a4a65194bd2a270 (diff) |
QQuickStyleSelector: fix built-in file selectors
While selecting style files, the standard built-in platform and local
file selectors ("+linux", "+macos", "+windows"...) must be prefixed
with the standard file selector indicator ("+"). Previously the style
selector would not pick up platform-specific style files unless they
were supplied without the prefix.
[ChangeLog][Controls][Styles] Fixed the style selection mechanism so
that now it is possible to organize platform and locale-specific files
into sub-directories, such as "+linux", "+macos", and "+windows".
Change-Id: Ia44b6f14fd0247943486fd27609147827bda9666
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'tests/auto/qquickstyleselector/tst_qquickstyleselector.cpp')
-rw-r--r-- | tests/auto/qquickstyleselector/tst_qquickstyleselector.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/qquickstyleselector/tst_qquickstyleselector.cpp b/tests/auto/qquickstyleselector/tst_qquickstyleselector.cpp index 598320d2..e90a8bd9 100644 --- a/tests/auto/qquickstyleselector/tst_qquickstyleselector.cpp +++ b/tests/auto/qquickstyleselector/tst_qquickstyleselector.cpp @@ -49,6 +49,8 @@ private slots: void select_data(); void select(); + + void platformSelectors(); }; void tst_QQuickStyleSelector::initTestCase() @@ -139,6 +141,24 @@ void tst_QQuickStyleSelector::select() QCOMPARE(selector.select(file), expected); } +void tst_QQuickStyleSelector::platformSelectors() +{ + QQuickStyle::setStyle(QDir(dataDirectory()).filePath("PlatformStyle")); + + QQuickStyleSelector selector; + selector.setBaseUrl(dataDirectoryUrl()); + +#if defined(Q_OS_LINUX) + QCOMPARE(selector.select("Button.qml"), testFileUrl("PlatformStyle/+linux/Button.qml").toString()); +#elif defined(Q_OS_MACOS) + QCOMPARE(selector.select("Button.qml"), testFileUrl("PlatformStyle/+macos/Button.qml").toString()); +#elif defined(Q_OS_WIN) + QCOMPARE(selector.select("Button.qml"), testFileUrl("PlatformStyle/+windows/Button.qml").toString()); +#else + QCOMPARE(selector.select("Button.qml"), testFileUrl("PlatformStyle/Button.qml").toString()); +#endif +} + QTEST_MAIN(tst_QQuickStyleSelector) #include "tst_qquickstyleselector.moc" |