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

Proposed by Zsombor Egri
Status: Merged
Approved by: Andrea Bernabei
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
Ubuntu SDK team 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.
Revision history for this message
Andrea Bernabei (faenil) wrote :

just a typo, looks good otherwise

Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
1869. By Zsombor Egri

typo fixed

Revision history for this message
Zsombor Egri (zsombi) wrote :

> just a typo, looks good otherwise

Fixed.

Revision history for this message
Andrea Bernabei (faenil) wrote :

great, thanks! :)

Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/Ubuntu/Components/plugin/ucdeprecatedtheme.cpp'
--- src/Ubuntu/Components/plugin/ucdeprecatedtheme.cpp 2016-01-11 17:18:51 +0000
+++ src/Ubuntu/Components/plugin/ucdeprecatedtheme.cpp 2016-02-25 19:50:35 +0000
@@ -131,7 +131,8 @@
131QObject* UCDeprecatedTheme::palette()131QObject* UCDeprecatedTheme::palette()
132{132{
133 showDeprecatedNote(this, "Theme.palette is deprecated. Use ThemeSettings instead.");133 showDeprecatedNote(this, "Theme.palette is deprecated. Use ThemeSettings instead.");
134 return defaultTheme()->palette();134 // force loading 1.2 palette!
135 return defaultTheme()->palette(BUILD_VERSION(1, 2));
135}136}
136137
137/*!138/*!
138139
=== modified file 'src/Ubuntu/Components/plugin/uctheme.cpp'
--- src/Ubuntu/Components/plugin/uctheme.cpp 2016-02-01 18:57:26 +0000
+++ src/Ubuntu/Components/plugin/uctheme.cpp 2016-02-25 19:50:35 +0000
@@ -537,9 +537,13 @@
537 * The palette doesn't need to be reset as it automatically resets when the537 * The palette doesn't need to be reset as it automatically resets when the
538 * palette used for configuration is destroyed.538 * palette used for configuration is destroyed.
539 */539 */
540QObject* UCTheme::palette()540QObject* UCTheme::palette(quint16 version)
541{541{
542 if (!m_palette) {542 if (!m_palette) {
543 if (version) {
544 // force version to be used
545 previousVersion = version;
546 }
543 loadPalette(qmlEngine(this), false);547 loadPalette(qmlEngine(this), false);
544 }548 }
545 return m_palette;549 return m_palette;
546550
=== modified file 'src/Ubuntu/Components/plugin/uctheme.h'
--- src/Ubuntu/Components/plugin/uctheme.h 2016-01-11 17:14:43 +0000
+++ src/Ubuntu/Components/plugin/uctheme.h 2016-02-25 19:50:35 +0000
@@ -72,7 +72,7 @@
72 QString name() const;72 QString name() const;
73 void setName(const QString& name);73 void setName(const QString& name);
74 void resetName();74 void resetName();
75 QObject* palette();75 QObject* palette(quint16 version = 0);
76 void setPalette(QObject *config);76 void setPalette(QObject *config);
77 static void checkMixedVersionImports(QQuickItem *item, quint16 version);77 static void checkMixedVersionImports(QQuickItem *item, quint16 version);
7878
7979
=== added file 'tests/unit_x11/tst_deprecated_theme_engine/ErroneousPaletteUse.qml'
--- tests/unit_x11/tst_deprecated_theme_engine/ErroneousPaletteUse.qml 1970-01-01 00:00:00 +0000
+++ tests/unit_x11/tst_deprecated_theme_engine/ErroneousPaletteUse.qml 2016-02-25 19:50:35 +0000
@@ -0,0 +1,33 @@
1/*
2 * Copyright 2016 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.4
18import Ubuntu.Components 1.2
19
20MainView {
21 width: units.gu(48)
22 height: units.gu(60)
23
24 Page {
25 title: "Hello, I am blue." // should be darkGrey
26 Label {
27 anchors.centerIn: parent
28 text: "bla"
29 color: Theme.palette.normal.negative // this color does not exist in 1.2 palette
30 }
31 }
32}
33
034
=== modified file 'tests/unit_x11/tst_deprecated_theme_engine/tst_deprecated_theme_engine.cpp'
--- tests/unit_x11/tst_deprecated_theme_engine/tst_deprecated_theme_engine.cpp 2016-02-10 10:35:50 +0000
+++ tests/unit_x11/tst_deprecated_theme_engine/tst_deprecated_theme_engine.cpp 2016-02-25 19:50:35 +0000
@@ -94,6 +94,7 @@
94 void testNoImportPathSet();94 void testNoImportPathSet();
95 void testBogusImportPathSet();95 void testBogusImportPathSet();
96 void testMultipleImportPathsSet();96 void testMultipleImportPathsSet();
97 void testPaletteUsed_bug1549830();
97};98};
9899
99void tst_UCDeprecatedTheme::initTestCase()100void tst_UCDeprecatedTheme::initTestCase()
@@ -257,6 +258,13 @@
257 view->setTheme("TestModule.TestTheme");258 view->setTheme("TestModule.TestTheme");
258}259}
259260
261void tst_UCDeprecatedTheme::testPaletteUsed_bug1549830()
262{
263 ThemeTestCase::ignoreWarning("ErroneousPaletteUse.qml", 29, 20, "Unable to assign [undefined] to QColor", 3);
264 QScopedPointer<ThemeTestCase> view(new ThemeTestCase("ErroneousPaletteUse.qml"));
265}
266
267
260QTEST_MAIN(tst_UCDeprecatedTheme)268QTEST_MAIN(tst_UCDeprecatedTheme)
261269
262#include "tst_deprecated_theme_engine.moc"270#include "tst_deprecated_theme_engine.moc"
263271
=== modified file 'tests/unit_x11/tst_deprecated_theme_engine/tst_deprecated_theme_engine.pro'
--- tests/unit_x11/tst_deprecated_theme_engine/tst_deprecated_theme_engine.pro 2016-01-11 06:17:26 +0000
+++ tests/unit_x11/tst_deprecated_theme_engine/tst_deprecated_theme_engine.pro 2016-02-25 19:50:35 +0000
@@ -11,4 +11,5 @@
11 themes/CustomTheme/parent_theme \11 themes/CustomTheme/parent_theme \
12 themes/TestModule/TestTheme/TestStyle.qml \12 themes/TestModule/TestTheme/TestStyle.qml \
13 themes/TestModule/TestTheme/qmldir \13 themes/TestModule/TestTheme/qmldir \
14 themes/TestModule/TestTheme/parent_theme14 themes/TestModule/TestTheme/parent_theme \
15 ErroneousPaletteUse.qml

Subscribers

People subscribed via source and target branches