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
1=== modified file 'components.api'
2--- components.api 2016-02-08 12:03:42 +0000
3+++ components.api 2016-02-11 09:50:36 +0000
4@@ -500,6 +500,7 @@
5 Ubuntu.Components.Icon 1.1: Icon
6 property url source
7 Ubuntu.Components.Icon 1.3: Item
8+ property bool asynchronous
9 property color color
10 property color keyColor
11 property string name
12@@ -1006,6 +1007,7 @@
13 property bool showProgressPercentage
14 property double value
15 Ubuntu.Components.ProgressionSlot 1.3: Item
16+ property bool asynchronous
17 property color color
18 property color keyColor
19 property string name
20
21=== modified file 'src/Ubuntu/Components/1.3/Icon.qml'
22--- src/Ubuntu/Components/1.3/Icon.qml 2015-12-14 08:55:29 +0000
23+++ src/Ubuntu/Components/1.3/Icon.qml 2016-02-11 09:50:36 +0000
24@@ -101,6 +101,12 @@
25
26 property alias source: image.source
27
28+ /*!
29+ \qmlproperty bool Icon::asynchronous
30+ The property drives the image loading of the icon. Defaults to false.
31+ */
32+ property alias asynchronous: image.asynchronous
33+
34 implicitWidth: image.implicitWidth
35 implicitHeight: image.implicitHeight
36
37@@ -119,6 +125,7 @@
38
39 cache: true
40 visible: !colorizedImage.visible
41+ asynchronous: false
42 }
43
44 ShaderEffect {
45
46=== added file 'tests/unit_x11/tst_components/tst_icon13.qml'
47--- tests/unit_x11/tst_components/tst_icon13.qml 1970-01-01 00:00:00 +0000
48+++ tests/unit_x11/tst_components/tst_icon13.qml 2016-02-11 09:50:36 +0000
49@@ -0,0 +1,139 @@
50+/*
51+ * Copyright 2016 Canonical Ltd.
52+ *
53+ * This program is free software; you can redistribute it and/or modify
54+ * it under the terms of the GNU Lesser General Public License as published by
55+ * the Free Software Foundation; version 3.
56+ *
57+ * This program is distributed in the hope that it will be useful,
58+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
59+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
60+ * GNU Lesser General Public License for more details.
61+ *
62+ * You should have received a copy of the GNU Lesser General Public License
63+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
64+ */
65+
66+import QtQuick 2.4
67+import QtTest 1.0
68+import Ubuntu.Components 1.3
69+import Ubuntu.Test 1.0
70+
71+Item {
72+ width: units.gu(50)
73+ height: units.gu(50)
74+
75+ Row {
76+ anchors.centerIn: parent
77+ height: units.gu(10)
78+ width: childrenRect.width
79+
80+ Icon {
81+ // Fails to load the icon when suru-icon-theme or libqt5svg5 are
82+ // not installed. This causes a warning and rejection
83+ // by jenkins continuous integration.
84+ name: "add"
85+ height: parent.height
86+ width: height
87+ }
88+ Icon {
89+ // Fails when the icon is becoming invisible when non-atomic updates
90+ // cause sourceSize.width or sourceSize.height to be 0 before other
91+ // properties are updated.
92+ id: icon
93+ width: visible ? units.gu(10) : 0
94+ height: width
95+ name: "search"
96+ }
97+ Icon {
98+ id: icon2
99+ width: units.gu(10)
100+ height: width
101+ }
102+ Icon {
103+ // Regression test for bug #1371509
104+ // Will print "QML QQuickImage: Failed to get image from provider" when broken.
105+ id: icon3
106+ width: units.gu(10)
107+ height: width
108+ source: Qt.resolvedUrl("tst_icon-select.png")
109+ }
110+ }
111+
112+ UbuntuTestCase {
113+ name: "Icon"
114+ when: windowShown
115+
116+ SignalSpy {
117+ id: shaderSpy
118+ signalName: 'onStatusChanged'
119+ }
120+
121+ function cleanup() {
122+ icon2.name = "";
123+ }
124+
125+ function initTestCase() {
126+ compare(icon.asynchronous, false, "asynchronous default value differs");
127+ }
128+
129+ function test_updateIconSize_bug1349769() {
130+ icon.visible = false;
131+ // causes "QML Image: Failed to get image from provider: image://theme/search"
132+ // warning when sourceSize.width or sourceSize.height becomes 0 while
133+ // while still trying to render the icon. Tests will pass with the warning, but
134+ // the MR is rejected by jenkins continuous integration.
135+ }
136+
137+ function test_name() {
138+ icon2.name = "search";
139+
140+ var image = findChild(icon2, "image");
141+ compare(image.source, "image://theme/search",
142+ "Source of the image should be image://theme/{name}.");
143+ }
144+
145+ function test_source() {
146+ icon2.name = "search";
147+ icon2.source = "/usr/share/icons/suru/actions/scalable/edit-find.svg";
148+
149+ var image = findChild(icon2, "image");
150+ compare(image.source,
151+ "file:///usr/share/icons/suru/actions/scalable/edit-find.svg",
152+ "Source of the image should equal icon2.source.");
153+ }
154+
155+ function test_keyColor() {
156+ icon.visible = true;
157+ var image = findChild(icon, "image");
158+ var shader = findChild(icon, "shader");
159+ shaderSpy.target = shader;
160+
161+ compare(icon.name, 'search');
162+ compare(shader.visible, false);
163+ compare(shader.status, ShaderEffect.Uncompiled)
164+ icon.color = UbuntuColors.orange;
165+ shaderSpy.wait();
166+ compare(shader.log, '')
167+ // https://bugreports.qt.io/browse/QTBUG-49713
168+ // status may be Error with no log even if successful
169+ verify(shader.status !== ShaderEffect.Uncompiled)
170+ compare(shader.keyColorOut, icon.color);
171+ compare(shader.visible, true);
172+ compare(shader.source, image);
173+ icon.keyColor = UbuntuColors.purple;
174+ compare(shader.keyColorIn, icon.keyColor);
175+ // Unsetting the icon name should disable the shader
176+ icon.name = '';
177+ compare(icon.source, '');
178+ compare(shader.visible, false);
179+ // Let's get back to a valid source
180+ icon.name = 'search';
181+ compare(shader.visible, true);
182+ compare(shader.source, image);
183+ // Unsetting the keyColor should also disable the shader
184+ icon.color = Qt.rgba(0.0, 0.0, 0.0, 0.0);
185+ compare(shader.visible, false);
186+ }
187+ }
188+}

Subscribers

People subscribed via source and target branches