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
=== modified file 'debian/control'
--- debian/control 2014-07-28 15:09:00 +0000
+++ debian/control 2014-07-30 12:12:03 +0000
@@ -26,6 +26,7 @@
26 qtdeclarative5-doc-html,26 qtdeclarative5-doc-html,
27 qtwebkit5-doc-html,27 qtwebkit5-doc-html,
28 qtsvg5-doc-html,28 qtsvg5-doc-html,
29 libqt5svg5,
29 qtscript5-doc-html,30 qtscript5-doc-html,
30 qtmultimedia5-doc-html,31 qtmultimedia5-doc-html,
31 unity-action-doc,32 unity-action-doc,
3233
=== modified file 'modules/Ubuntu/Components/Icon.qml'
--- modules/Ubuntu/Components/Icon.qml 2014-07-03 13:30:32 +0000
+++ modules/Ubuntu/Components/Icon.qml 2014-07-30 12:12:03 +0000
@@ -84,17 +84,37 @@
8484
85 Image {85 Image {
86 id: image86 id: image
87 anchors.fill: parent
8788
88 /* Necessary so that icons are not loaded before a size is set. */89 /* Necessary so that icons are not loaded before a size is set. */
89 property bool ready: false90 source: ""
90 Component.onCompleted: ready = true
91
92 anchors.fill: parent
93 source: ready && width > 0 && height > 0 && icon.name ? "image://theme/%1".arg(icon.name) : ""
94 sourceSize {91 sourceSize {
95 width: width92 width: 0
96 height: height93 height: 0
97 }94 }
95
96 Component.onCompleted: update()
97 onWidthChanged: update()
98 onHeightChanged: update()
99 Connections {
100 target: icon
101 onNameChanged: image.update()
102 }
103
104 function update() {
105 // only set sourceSize.width, sourceSize.height and source when
106 // icon dimensions are valid, see bug #1349769.
107 if (width > 0 && height > 0 && icon.name) {
108 sourceSize.width = width;
109 sourceSize.height = height;
110 source = "image://theme/%1".arg(icon.name);
111 } else {
112 source = "";
113 sourceSize.width = 0;
114 sourceSize.height = 0;
115 }
116 }
117
98 cache: true118 cache: true
99 visible: !colorizedImage.active119 visible: !colorizedImage.active
100 }120 }
101121
=== added file 'tests/unit_x11/tst_components/tst_icon.qml'
--- tests/unit_x11/tst_components/tst_icon.qml 1970-01-01 00:00:00 +0000
+++ tests/unit_x11/tst_components/tst_icon.qml 2014-07-30 12:12:03 +0000
@@ -0,0 +1,61 @@
1/*
2 * Copyright 2012 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.0
18import QtTest 1.0
19import Ubuntu.Components 1.1
20
21Item {
22 width: units.gu(50)
23 height: units.gu(50)
24
25 Row {
26 anchors.centerIn: parent
27 height: units.gu(10)
28 width: childrenRect.width
29
30 Icon {
31 // Fails to load the icon when suru-icon-theme or libqt5svg5 are
32 // not installed. This causes a warning and rejection
33 // by jenkins continuous integration.
34 name: "add"
35 height: parent.height
36 width: height
37 }
38 Icon {
39 // Fails when the icon is becoming invisible when non-atomic updates
40 // cause sourceSize.width or sourceSize.height to be 0 before other
41 // properties are updated.
42 id: icon
43 width: visible ? units.gu(10) : 0
44 height: width
45 name: "search"
46 }
47 }
48
49 TestCase {
50 name: "Icon"
51 when: windowShown
52
53 function test_updateIconSize_bug1349769() {
54 icon.visible = false;
55 // causes "QML Image: Failed to get image from provider: image://theme/search"
56 // warning when sourceSize.width or sourceSize.height becomes 0 while
57 // while still trying to render the icon. Tests will pass with the warning, but
58 // the MR is rejected by jenkins continuous integration.
59 }
60 }
61}

Subscribers

People subscribed via source and target branches