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

Proposed by Zsombor Egri on 2016-02-25
Status: Merged
Approved by: Andrea Bernabei on 2016-02-25
Approved revision: 1869
Merged at revision: 1869
Proposed branch: lp:~zsombi/ubuntu-ui-toolkit/wrongPaletteIn12
Merge into: lp:ubuntu-ui-toolkit/staging
Diff against target: 120 lines (+51/-4)
6 files modified
src/Ubuntu/Components/plugin/ucdeprecatedtheme.cpp (+2/-1)
src/Ubuntu/Components/plugin/uctheme.cpp (+5/-1)
src/Ubuntu/Components/plugin/uctheme.h (+1/-1)
tests/unit_x11/tst_deprecated_theme_engine/ErroneousPaletteUse.qml (+33/-0)
tests/unit_x11/tst_deprecated_theme_engine/tst_deprecated_theme_engine.cpp (+8/-0)
tests/unit_x11/tst_deprecated_theme_engine/tst_deprecated_theme_engine.pro (+2/-1)
To merge this branch: bzr merge lp:~zsombi/ubuntu-ui-toolkit/wrongPaletteIn12
Reviewer Review Type Date Requested Status
ubuntu-sdk-build-bot continuous-integration Approve on 2016-02-26
Ubuntu SDK team 2016-02-25 Pending
Review via email: mp+287206@code.launchpad.net

Commit message

Deprecated Theme forces palette to be loaded from 1.2 themes.

To post a comment you must log in.
Andrea Bernabei (faenil) wrote :

just a typo, looks good otherwise

1869. By Zsombor Egri on 2016-02-25

typo fixed

Zsombor Egri (zsombi) wrote :

> just a typo, looks good otherwise

Fixed.

Andrea Bernabei (faenil) wrote :

great, thanks! :)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Ubuntu/Components/plugin/ucdeprecatedtheme.cpp'
2--- src/Ubuntu/Components/plugin/ucdeprecatedtheme.cpp 2016-01-11 17:18:51 +0000
3+++ src/Ubuntu/Components/plugin/ucdeprecatedtheme.cpp 2016-02-25 19:50:35 +0000
4@@ -131,7 +131,8 @@
5 QObject* UCDeprecatedTheme::palette()
6 {
7 showDeprecatedNote(this, "Theme.palette is deprecated. Use ThemeSettings instead.");
8- return defaultTheme()->palette();
9+ // force loading 1.2 palette!
10+ return defaultTheme()->palette(BUILD_VERSION(1, 2));
11 }
12
13 /*!
14
15=== modified file 'src/Ubuntu/Components/plugin/uctheme.cpp'
16--- src/Ubuntu/Components/plugin/uctheme.cpp 2016-02-01 18:57:26 +0000
17+++ src/Ubuntu/Components/plugin/uctheme.cpp 2016-02-25 19:50:35 +0000
18@@ -537,9 +537,13 @@
19 * The palette doesn't need to be reset as it automatically resets when the
20 * palette used for configuration is destroyed.
21 */
22-QObject* UCTheme::palette()
23+QObject* UCTheme::palette(quint16 version)
24 {
25 if (!m_palette) {
26+ if (version) {
27+ // force version to be used
28+ previousVersion = version;
29+ }
30 loadPalette(qmlEngine(this), false);
31 }
32 return m_palette;
33
34=== modified file 'src/Ubuntu/Components/plugin/uctheme.h'
35--- src/Ubuntu/Components/plugin/uctheme.h 2016-01-11 17:14:43 +0000
36+++ src/Ubuntu/Components/plugin/uctheme.h 2016-02-25 19:50:35 +0000
37@@ -72,7 +72,7 @@
38 QString name() const;
39 void setName(const QString& name);
40 void resetName();
41- QObject* palette();
42+ QObject* palette(quint16 version = 0);
43 void setPalette(QObject *config);
44 static void checkMixedVersionImports(QQuickItem *item, quint16 version);
45
46
47=== added file 'tests/unit_x11/tst_deprecated_theme_engine/ErroneousPaletteUse.qml'
48--- tests/unit_x11/tst_deprecated_theme_engine/ErroneousPaletteUse.qml 1970-01-01 00:00:00 +0000
49+++ tests/unit_x11/tst_deprecated_theme_engine/ErroneousPaletteUse.qml 2016-02-25 19:50:35 +0000
50@@ -0,0 +1,33 @@
51+/*
52+ * Copyright 2016 Canonical Ltd.
53+ *
54+ * This program is free software; you can redistribute it and/or modify
55+ * it under the terms of the GNU Lesser General Public License as published by
56+ * the Free Software Foundation; version 3.
57+ *
58+ * This program is distributed in the hope that it will be useful,
59+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
60+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
61+ * GNU Lesser General Public License for more details.
62+ *
63+ * You should have received a copy of the GNU Lesser General Public License
64+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
65+ */
66+
67+import QtQuick 2.4
68+import Ubuntu.Components 1.2
69+
70+MainView {
71+ width: units.gu(48)
72+ height: units.gu(60)
73+
74+ Page {
75+ title: "Hello, I am blue." // should be darkGrey
76+ Label {
77+ anchors.centerIn: parent
78+ text: "bla"
79+ color: Theme.palette.normal.negative // this color does not exist in 1.2 palette
80+ }
81+ }
82+}
83+
84
85=== modified file 'tests/unit_x11/tst_deprecated_theme_engine/tst_deprecated_theme_engine.cpp'
86--- tests/unit_x11/tst_deprecated_theme_engine/tst_deprecated_theme_engine.cpp 2016-02-10 10:35:50 +0000
87+++ tests/unit_x11/tst_deprecated_theme_engine/tst_deprecated_theme_engine.cpp 2016-02-25 19:50:35 +0000
88@@ -94,6 +94,7 @@
89 void testNoImportPathSet();
90 void testBogusImportPathSet();
91 void testMultipleImportPathsSet();
92+ void testPaletteUsed_bug1549830();
93 };
94
95 void tst_UCDeprecatedTheme::initTestCase()
96@@ -257,6 +258,13 @@
97 view->setTheme("TestModule.TestTheme");
98 }
99
100+void tst_UCDeprecatedTheme::testPaletteUsed_bug1549830()
101+{
102+ ThemeTestCase::ignoreWarning("ErroneousPaletteUse.qml", 29, 20, "Unable to assign [undefined] to QColor", 3);
103+ QScopedPointer<ThemeTestCase> view(new ThemeTestCase("ErroneousPaletteUse.qml"));
104+}
105+
106+
107 QTEST_MAIN(tst_UCDeprecatedTheme)
108
109 #include "tst_deprecated_theme_engine.moc"
110
111=== modified file 'tests/unit_x11/tst_deprecated_theme_engine/tst_deprecated_theme_engine.pro'
112--- tests/unit_x11/tst_deprecated_theme_engine/tst_deprecated_theme_engine.pro 2016-01-11 06:17:26 +0000
113+++ tests/unit_x11/tst_deprecated_theme_engine/tst_deprecated_theme_engine.pro 2016-02-25 19:50:35 +0000
114@@ -11,4 +11,5 @@
115 themes/CustomTheme/parent_theme \
116 themes/TestModule/TestTheme/TestStyle.qml \
117 themes/TestModule/TestTheme/qmldir \
118- themes/TestModule/TestTheme/parent_theme
119+ themes/TestModule/TestTheme/parent_theme \
120+ ErroneousPaletteUse.qml

Subscribers

People subscribed via source and target branches