Merge lp:~tpeeters/ubuntu-ui-toolkit/fix-black-icon into lp:~bzoltan/ubuntu-ui-toolkit/landing_18.09

Proposed by Tim Peeters
Status: Merged
Merged at revision: 1255
Proposed branch: lp:~tpeeters/ubuntu-ui-toolkit/fix-black-icon
Merge into: lp:~bzoltan/ubuntu-ui-toolkit/landing_18.09
Diff against target: 86 lines (+45/-11)
2 files modified
modules/Ubuntu/Components/Icon10.qml (+36/-10)
tests/unit_x11/tst_components/tst_icon.qml (+9/-1)
To merge this branch: bzr merge lp:~tpeeters/ubuntu-ui-toolkit/fix-black-icon
Reviewer Review Type Date Requested Status
Lars Karlitski (community) Approve
Zoltan Balogh Pending
Review via email: mp+235291@code.launchpad.net

Commit message

Fix black icons in gallery-app header.

Description of the change

Fix black icons in gallery-app header.

To post a comment you must log in.
Revision history for this message
Lars Karlitski (larsu) wrote :

This looks good to me. I removed the update() function because it wasn't needed for the unitythemeiconprovider anymore, but forgot to test with other icon providers.

Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'modules/Ubuntu/Components/Icon10.qml'
2--- modules/Ubuntu/Components/Icon10.qml 2014-09-05 04:42:38 +0000
3+++ modules/Ubuntu/Components/Icon10.qml 2014-09-19 13:31:22 +0000
4@@ -34,16 +34,42 @@
5 Image {
6 id: image
7 objectName: "image"
8- anchors { top: parent.top; bottom: parent.bottom }
9- fillMode: Image.PreserveAspectFit;
10- sourceSize.height: height
11- source: {
12- if (icon.name)
13- return "image://theme/%1".arg(icon.name);
14- else if (icon.hasOwnProperty("source"))
15- return icon.source;
16- else
17- return "";
18+ anchors.fill: parent
19+
20+ /* Necessary so that icons are not loaded before a size is set. */
21+ source: ""
22+ sourceSize {
23+ width: 0
24+ height: 0
25+ }
26+
27+ Component.onCompleted: update()
28+ onWidthChanged: update()
29+ onHeightChanged: update()
30+ Connections {
31+ target: icon
32+ ignoreUnknownSignals: true
33+ onNameChanged: image.update()
34+ onSourceChanged: image.update()
35+ }
36+
37+ function update() {
38+ // only set sourceSize.width, sourceSize.height and source when
39+ // icon dimensions are valid, see bug #1349769.
40+ if (width > 0 && height > 0
41+ && (icon.name || (icon.hasOwnProperty("source") && icon.source))) {
42+ sourceSize.width = width;
43+ sourceSize.height = height;
44+ if (icon.hasOwnProperty("source")) {
45+ source = icon.source;
46+ } else {
47+ source = "image://theme/%1".arg(icon.name);
48+ }
49+ } else {
50+ source = "";
51+ sourceSize.width = 0;
52+ sourceSize.height = 0;
53+ }
54 }
55
56 cache: true
57
58=== added file 'tests/unit_x11/tst_components/tst_icon-select@18.png'
59Binary files tests/unit_x11/tst_components/tst_icon-select@18.png 1970-01-01 00:00:00 +0000 and tests/unit_x11/tst_components/tst_icon-select@18.png 2014-09-19 13:31:22 +0000 differ
60=== modified file 'tests/unit_x11/tst_components/tst_icon.qml'
61--- tests/unit_x11/tst_components/tst_icon.qml 2014-09-02 09:39:09 +0000
62+++ tests/unit_x11/tst_components/tst_icon.qml 2014-09-19 13:31:22 +0000
63@@ -50,6 +50,14 @@
64 width: units.gu(10)
65 height: width
66 }
67+ Icon {
68+ // Regression test for bug #1371509
69+ // Will print "QML QQuickImage: Failed to get image from provider" when broken.
70+ id: icon3
71+ width: units.gu(10)
72+ height: width
73+ source: Qt.resolvedUrl("tst_icon-select.png")
74+ }
75 }
76
77 UbuntuTestCase {
78@@ -82,7 +90,7 @@
79
80 var image = findChild(icon2, "image");
81 compare(image.source,
82- "image://theme/search",
83+ "file:///usr/share/icons/suru/actions/scalable/search.svg",
84 "Source of the image should equal icon2.source.");
85 }
86 }

Subscribers

People subscribed via source and target branches

to all changes: