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

Proposed by Zsombor Egri
Status: Merged
Approved by: Cris Dywan
Approved revision: 1833
Merged at revision: 1845
Proposed branch: lp:~zsombi/ubuntu-ui-toolkit/icon_async
Merge into: lp:ubuntu-ui-toolkit/staging
Diff against target: 188 lines (+148/-0)
3 files modified
components.api (+2/-0)
src/Ubuntu/Components/1.3/Icon.qml (+7/-0)
tests/unit_x11/tst_components/tst_icon13.qml (+139/-0)
To merge this branch: bzr merge lp:~zsombi/ubuntu-ui-toolkit/icon_async
Reviewer Review Type Date Requested Status
ubuntu-sdk-build-bot continuous-integration Approve
Cris Dywan Approve
Albert Astals Cid (community) Approve
Review via email: mp+284599@code.launchpad.net

Commit message

Expose Icon.asynchronous property to drive image loading of the icon.

Description of the change

Expose Icon.asynchronous property to drive image loading of the icon.

To post a comment you must log in.
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

proeprty -> property

Defaults to true. -> Defaults to false.

review: Needs Fixing
1829. By Zsombor Egri

typo and default value mistake fixed

1830. By Zsombor Egri

staging sync

Revision history for this message
Albert Astals Cid (aacid) wrote :

Looks good to me

review: Approve
Revision history for this message
Cris Dywan (kalikiana) wrote :

This obviously make sense... it's unfortunate however very sensible to keep it off by default... maybe we can re-consider that for 1.4 at least.

I notice test_keyColor no longer has the work-around for qtbug 49713 where log is '' and the value is Error, I can't imagine how that bug would no longer apply here.

review: Needs Information
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
1831. By Zsombor Egri

moving shader result test from previous version

Revision history for this message
Cris Dywan (kalikiana) wrote :

Thanks! Let's see the test passing now.

review: Approve
1832. By Zsombor Egri

API updated

1833. By Zsombor Egri

fixing API changes

Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (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)
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)
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 'components.api'
--- components.api 2016-02-08 12:03:42 +0000
+++ components.api 2016-02-11 09:50:36 +0000
@@ -500,6 +500,7 @@
500Ubuntu.Components.Icon 1.1: Icon500Ubuntu.Components.Icon 1.1: Icon
501 property url source501 property url source
502Ubuntu.Components.Icon 1.3: Item502Ubuntu.Components.Icon 1.3: Item
503 property bool asynchronous
503 property color color504 property color color
504 property color keyColor505 property color keyColor
505 property string name506 property string name
@@ -1006,6 +1007,7 @@
1006 property bool showProgressPercentage1007 property bool showProgressPercentage
1007 property double value1008 property double value
1008Ubuntu.Components.ProgressionSlot 1.3: Item1009Ubuntu.Components.ProgressionSlot 1.3: Item
1010 property bool asynchronous
1009 property color color1011 property color color
1010 property color keyColor1012 property color keyColor
1011 property string name1013 property string name
10121014
=== modified file 'src/Ubuntu/Components/1.3/Icon.qml'
--- src/Ubuntu/Components/1.3/Icon.qml 2015-12-14 08:55:29 +0000
+++ src/Ubuntu/Components/1.3/Icon.qml 2016-02-11 09:50:36 +0000
@@ -101,6 +101,12 @@
101101
102 property alias source: image.source102 property alias source: image.source
103103
104 /*!
105 \qmlproperty bool Icon::asynchronous
106 The property drives the image loading of the icon. Defaults to false.
107 */
108 property alias asynchronous: image.asynchronous
109
104 implicitWidth: image.implicitWidth110 implicitWidth: image.implicitWidth
105 implicitHeight: image.implicitHeight111 implicitHeight: image.implicitHeight
106112
@@ -119,6 +125,7 @@
119125
120 cache: true126 cache: true
121 visible: !colorizedImage.visible127 visible: !colorizedImage.visible
128 asynchronous: false
122 }129 }
123130
124 ShaderEffect {131 ShaderEffect {
125132
=== added file 'tests/unit_x11/tst_components/tst_icon13.qml'
--- tests/unit_x11/tst_components/tst_icon13.qml 1970-01-01 00:00:00 +0000
+++ tests/unit_x11/tst_components/tst_icon13.qml 2016-02-11 09:50:36 +0000
@@ -0,0 +1,139 @@
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 QtTest 1.0
19import Ubuntu.Components 1.3
20import Ubuntu.Test 1.0
21
22Item {
23 width: units.gu(50)
24 height: units.gu(50)
25
26 Row {
27 anchors.centerIn: parent
28 height: units.gu(10)
29 width: childrenRect.width
30
31 Icon {
32 // Fails to load the icon when suru-icon-theme or libqt5svg5 are
33 // not installed. This causes a warning and rejection
34 // by jenkins continuous integration.
35 name: "add"
36 height: parent.height
37 width: height
38 }
39 Icon {
40 // Fails when the icon is becoming invisible when non-atomic updates
41 // cause sourceSize.width or sourceSize.height to be 0 before other
42 // properties are updated.
43 id: icon
44 width: visible ? units.gu(10) : 0
45 height: width
46 name: "search"
47 }
48 Icon {
49 id: icon2
50 width: units.gu(10)
51 height: width
52 }
53 Icon {
54 // Regression test for bug #1371509
55 // Will print "QML QQuickImage: Failed to get image from provider" when broken.
56 id: icon3
57 width: units.gu(10)
58 height: width
59 source: Qt.resolvedUrl("tst_icon-select.png")
60 }
61 }
62
63 UbuntuTestCase {
64 name: "Icon"
65 when: windowShown
66
67 SignalSpy {
68 id: shaderSpy
69 signalName: 'onStatusChanged'
70 }
71
72 function cleanup() {
73 icon2.name = "";
74 }
75
76 function initTestCase() {
77 compare(icon.asynchronous, false, "asynchronous default value differs");
78 }
79
80 function test_updateIconSize_bug1349769() {
81 icon.visible = false;
82 // causes "QML Image: Failed to get image from provider: image://theme/search"
83 // warning when sourceSize.width or sourceSize.height becomes 0 while
84 // while still trying to render the icon. Tests will pass with the warning, but
85 // the MR is rejected by jenkins continuous integration.
86 }
87
88 function test_name() {
89 icon2.name = "search";
90
91 var image = findChild(icon2, "image");
92 compare(image.source, "image://theme/search",
93 "Source of the image should be image://theme/{name}.");
94 }
95
96 function test_source() {
97 icon2.name = "search";
98 icon2.source = "/usr/share/icons/suru/actions/scalable/edit-find.svg";
99
100 var image = findChild(icon2, "image");
101 compare(image.source,
102 "file:///usr/share/icons/suru/actions/scalable/edit-find.svg",
103 "Source of the image should equal icon2.source.");
104 }
105
106 function test_keyColor() {
107 icon.visible = true;
108 var image = findChild(icon, "image");
109 var shader = findChild(icon, "shader");
110 shaderSpy.target = shader;
111
112 compare(icon.name, 'search');
113 compare(shader.visible, false);
114 compare(shader.status, ShaderEffect.Uncompiled)
115 icon.color = UbuntuColors.orange;
116 shaderSpy.wait();
117 compare(shader.log, '')
118 // https://bugreports.qt.io/browse/QTBUG-49713
119 // status may be Error with no log even if successful
120 verify(shader.status !== ShaderEffect.Uncompiled)
121 compare(shader.keyColorOut, icon.color);
122 compare(shader.visible, true);
123 compare(shader.source, image);
124 icon.keyColor = UbuntuColors.purple;
125 compare(shader.keyColorIn, icon.keyColor);
126 // Unsetting the icon name should disable the shader
127 icon.name = '';
128 compare(icon.source, '');
129 compare(shader.visible, false);
130 // Let's get back to a valid source
131 icon.name = 'search';
132 compare(shader.visible, true);
133 compare(shader.source, image);
134 // Unsetting the keyColor should also disable the shader
135 icon.color = Qt.rgba(0.0, 0.0, 0.0, 0.0);
136 compare(shader.visible, false);
137 }
138 }
139}

Subscribers

People subscribed via source and target branches