Merge lp:~zsombi/ubuntu-ui-toolkit/fixThemingFallback into lp:ubuntu-ui-toolkit/staging

Proposed by Zsombor Egri
Status: Merged
Approved by: Zoltan Balogh
Approved revision: 1675
Merged at revision: 1676
Proposed branch: lp:~zsombi/ubuntu-ui-toolkit/fixThemingFallback
Merge into: lp:ubuntu-ui-toolkit/staging
Diff against target: 110 lines (+8/-36)
3 files modified
src/Ubuntu/Components/plugin/ucstyleditembase.cpp (+5/-8)
src/Ubuntu/Components/plugin/ucstyleditembase_p.h (+1/-0)
tests/unit_x11/tst_subtheming/tst_subtheming.cpp (+2/-28)
To merge this branch: bzr merge lp:~zsombi/ubuntu-ui-toolkit/fixThemingFallback
Reviewer Review Type Date Requested Status
Zoltan Balogh Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+273497@code.launchpad.net

Commit message

StyledItem does no longer fall back to 1.2 style loading on mixed import versions.

Description of the change

StyledItem does no longer fall back to 1.2 style loading on mixed import versions.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Zoltan Balogh (bzoltan) wrote :

Solves the problem

Revision history for this message
Zoltan Balogh (bzoltan) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Ubuntu/Components/plugin/ucstyleditembase.cpp'
2--- src/Ubuntu/Components/plugin/ucstyleditembase.cpp 2015-09-28 07:06:36 +0000
3+++ src/Ubuntu/Components/plugin/ucstyleditembase.cpp 2015-10-06 07:18:45 +0000
4@@ -28,6 +28,7 @@
5 UCStyledItemBasePrivate::UCStyledItemBasePrivate()
6 : styleComponent(Q_NULLPTR)
7 , styleItem(Q_NULLPTR)
8+ , styleVersion(LATEST_UITK_VERSION)
9 , activeFocusOnPress(false)
10 , wasStyleLoaded(false)
11 {
12@@ -307,7 +308,7 @@
13 // either styleComponent or styleName is valid
14 QQmlComponent *component = styleComponent;
15 if (!component) {
16- component = getTheme()->createStyleComponent(styleDocument + ".qml", q);
17+ component = getTheme()->createStyleComponent(styleDocument + ".qml", q, styleVersion);
18 }
19 if (!component) {
20 return false;
21@@ -473,13 +474,9 @@
22 QQmlPropertyData *pdata = QQmlPropertyCache::property(qmlEngine(this), this, QStringLiteral("theme"), cdata, l);
23 // FIXME MainView internal styler uses theme property, meaning imports13 will be true,
24 // therefore we must check the type of the property as well in case anyone else overrides it
25- bool imports13 = data->propertyCache->isAllowedInRevision(pdata) && (property("theme").type() != QVariant::String);
26- if (!imports13) {
27- // load 1.2 theme
28- UCTheme *theme = d->getTheme();
29- // FIXME: override the global theme version to be used when creating new themes!
30- theme->setVersion(BUILD_VERSION(1, 2));
31- }
32+ d->styleVersion = data->propertyCache->isAllowedInRevision(pdata) && (property("theme").type() != QVariant::String)
33+ ? BUILD_VERSION(1, 3)
34+ : BUILD_VERSION(1, 2);
35 // no animation at this time
36 // prepare style context if not been done yet
37 d->postStyleChanged();
38
39=== modified file 'src/Ubuntu/Components/plugin/ucstyleditembase_p.h'
40--- src/Ubuntu/Components/plugin/ucstyleditembase_p.h 2015-09-21 11:40:22 +0000
41+++ src/Ubuntu/Components/plugin/ucstyleditembase_p.h 2015-10-06 07:18:45 +0000
42@@ -64,6 +64,7 @@
43 QString styleDocument;
44 QQmlComponent *styleComponent;
45 QQuickItem *styleItem;
46+ quint16 styleVersion;
47 bool activeFocusOnPress:1;
48 bool wasStyleLoaded:1;
49
50
51=== modified file 'tests/unit_x11/tst_subtheming/tst_subtheming.cpp'
52--- tests/unit_x11/tst_subtheming/tst_subtheming.cpp 2015-09-22 13:40:32 +0000
53+++ tests/unit_x11/tst_subtheming/tst_subtheming.cpp 2015-10-06 07:18:45 +0000
54@@ -636,44 +636,21 @@
55 {
56 QTest::addColumn<QString>("document");
57 QTest::addColumn<QString>("testValue");
58- QTest::addColumn<int>("row");
59- QTest::addColumn<int>("column");
60- QTest::addColumn<QString>("warning");
61
62- QTest::newRow("Theming version 1.2")
63- << "StyledItemV12.qml"
64- << ""
65- << 0 << 0 << "";
66 QTest::newRow("Theming version 1.3")
67 << "StyledItemV13.qml"
68- << "version1.3"
69- << 0 << 0 << "";
70- QTest::newRow("Fall back to 1.3")
71- << "StyledItemFallback.qml"
72- << "version1.3"
73- << 19 << 1 << "QML StyledItem: Theme 'TestModule.TestTheme' has no 'TestStyle.qml' style for version 1.0, fall back to version 1.3.";
74+ << "version1.3";
75 QTest::newRow("App theme versioned")
76 << "StyledItemAppThemeVersioned.qml"
77- << "version1.3"
78- << 0 << 0 << "";
79- QTest::newRow("App theme fallback to non-versioned")
80- << "StyledItemAppThemeFallback.qml"
81- << ""
82- << 0 << 0 << "";
83+ << "version1.3";
84 }
85 void test_theme_versions()
86 {
87 QFETCH(QString, document);
88 QFETCH(QString, testValue);
89- QFETCH(int, row);
90- QFETCH(int, column);
91- QFETCH(QString, warning);
92
93 qputenv("UBUNTU_UI_TOOLKIT_THEMES_PATH", "");
94 qputenv("XDG_DATA_DIRS", "./themes:./themes/TestModule");
95- if (!warning.isEmpty()) {
96- ThemeTestCase::ignoreWarning(document, row, column, warning);
97- }
98 QScopedPointer<ThemeTestCase> view(new ThemeTestCase(document));
99 UCStyledItemBase *styledItem = qobject_cast<UCStyledItemBase*>(view->rootObject());
100 QVERIFY(UCStyledItemBasePrivate::get(styledItem)->styleItem);
101@@ -689,9 +666,6 @@
102 qputenv("UBUNTU_UI_TOOLKIT_THEMES_PATH", "");
103 qputenv("XDG_DATA_DIRS", "./themes:./themes/TestModule:" + m_themesPath.toLatin1());
104 QScopedPointer<ThemeTestCase> view(new ThemeTestCase("DeprecatedTheme.qml"));
105- // NOTE TestTheme resets the theme therefore the theming will look for the tested style version under Ambiance theme
106- // which will cause a warning; therefore we mark the warning to be ignored
107- ThemeTestCase::ignoreWarning("DeprecatedTheme.qml", 19, 1, "QML StyledItem: Theme 'Ubuntu.Components.Themes.Ambiance' has no 'OptionSelectorStyle.qml' style for version 1.0, fall back to version 1.3.");
108 }
109
110 void test_style_change_has_precedence()

Subscribers

People subscribed via source and target branches