Merge lp:~tpeeters/ubuntu-ui-toolkit/iconFix into lp:ubuntu-ui-toolkit/staging

Proposed by Tim Peeters
Status: Merged
Approved by: Tim Peeters
Approved revision: 1179
Merged at revision: 1169
Proposed branch: lp:~tpeeters/ubuntu-ui-toolkit/iconFix
Merge into: lp:ubuntu-ui-toolkit/staging
Diff against target: 127 lines (+90/-8)
3 files modified
debian/control (+1/-0)
modules/Ubuntu/Components/Icon.qml (+28/-8)
tests/unit_x11/tst_components/tst_icon.qml (+61/-0)
To merge this branch: bzr merge lp:~tpeeters/ubuntu-ui-toolkit/iconFix
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Zsombor Egri Approve
Review via email: mp+228832@code.launchpad.net

Commit message

Fix icon loading problems

Description of the change

Fix two icon loading issues:
- Add libqt5svg5 as a BUILD dependency (needed for running unit tests with icons)
- Fix warning caused by having a sourceSize.width or height 0 when icon is rendered.

To post a comment you must log in.
Revision history for this message
Zsombor Egri (zsombi) wrote :

Thanks!

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:1178
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/683/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/2718
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/2164
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-amd64-ci/515
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/515
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/515/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-i386-ci/515
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/2823
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/3961
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/3961/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/10676
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/1797
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2423
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2423/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/683/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2014-07-28 15:09:00 +0000
3+++ debian/control 2014-07-30 12:12:03 +0000
4@@ -26,6 +26,7 @@
5 qtdeclarative5-doc-html,
6 qtwebkit5-doc-html,
7 qtsvg5-doc-html,
8+ libqt5svg5,
9 qtscript5-doc-html,
10 qtmultimedia5-doc-html,
11 unity-action-doc,
12
13=== modified file 'modules/Ubuntu/Components/Icon.qml'
14--- modules/Ubuntu/Components/Icon.qml 2014-07-03 13:30:32 +0000
15+++ modules/Ubuntu/Components/Icon.qml 2014-07-30 12:12:03 +0000
16@@ -84,17 +84,37 @@
17
18 Image {
19 id: image
20+ anchors.fill: parent
21
22 /* Necessary so that icons are not loaded before a size is set. */
23- property bool ready: false
24- Component.onCompleted: ready = true
25-
26- anchors.fill: parent
27- source: ready && width > 0 && height > 0 && icon.name ? "image://theme/%1".arg(icon.name) : ""
28+ source: ""
29 sourceSize {
30- width: width
31- height: height
32- }
33+ width: 0
34+ height: 0
35+ }
36+
37+ Component.onCompleted: update()
38+ onWidthChanged: update()
39+ onHeightChanged: update()
40+ Connections {
41+ target: icon
42+ onNameChanged: image.update()
43+ }
44+
45+ function update() {
46+ // only set sourceSize.width, sourceSize.height and source when
47+ // icon dimensions are valid, see bug #1349769.
48+ if (width > 0 && height > 0 && icon.name) {
49+ sourceSize.width = width;
50+ sourceSize.height = height;
51+ source = "image://theme/%1".arg(icon.name);
52+ } else {
53+ source = "";
54+ sourceSize.width = 0;
55+ sourceSize.height = 0;
56+ }
57+ }
58+
59 cache: true
60 visible: !colorizedImage.active
61 }
62
63=== added file 'tests/unit_x11/tst_components/tst_icon.qml'
64--- tests/unit_x11/tst_components/tst_icon.qml 1970-01-01 00:00:00 +0000
65+++ tests/unit_x11/tst_components/tst_icon.qml 2014-07-30 12:12:03 +0000
66@@ -0,0 +1,61 @@
67+/*
68+ * Copyright 2012 Canonical Ltd.
69+ *
70+ * This program is free software; you can redistribute it and/or modify
71+ * it under the terms of the GNU Lesser General Public License as published by
72+ * the Free Software Foundation; version 3.
73+ *
74+ * This program is distributed in the hope that it will be useful,
75+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
76+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
77+ * GNU Lesser General Public License for more details.
78+ *
79+ * You should have received a copy of the GNU Lesser General Public License
80+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
81+ */
82+
83+import QtQuick 2.0
84+import QtTest 1.0
85+import Ubuntu.Components 1.1
86+
87+Item {
88+ width: units.gu(50)
89+ height: units.gu(50)
90+
91+ Row {
92+ anchors.centerIn: parent
93+ height: units.gu(10)
94+ width: childrenRect.width
95+
96+ Icon {
97+ // Fails to load the icon when suru-icon-theme or libqt5svg5 are
98+ // not installed. This causes a warning and rejection
99+ // by jenkins continuous integration.
100+ name: "add"
101+ height: parent.height
102+ width: height
103+ }
104+ Icon {
105+ // Fails when the icon is becoming invisible when non-atomic updates
106+ // cause sourceSize.width or sourceSize.height to be 0 before other
107+ // properties are updated.
108+ id: icon
109+ width: visible ? units.gu(10) : 0
110+ height: width
111+ name: "search"
112+ }
113+ }
114+
115+ TestCase {
116+ name: "Icon"
117+ when: windowShown
118+
119+ function test_updateIconSize_bug1349769() {
120+ icon.visible = false;
121+ // causes "QML Image: Failed to get image from provider: image://theme/search"
122+ // warning when sourceSize.width or sourceSize.height becomes 0 while
123+ // while still trying to render the icon. Tests will pass with the warning, but
124+ // the MR is rejected by jenkins continuous integration.
125+ }
126+ }
127+}

Subscribers

People subscribed via source and target branches