Merge lp:~aacid/unity8/emblemInPreviews into lp:unity8

Proposed by Albert Astals Cid
Status: Merged
Approved by: Andrea Cimitan
Approved revision: 2182
Merged at revision: 2247
Proposed branch: lp:~aacid/unity8/emblemInPreviews
Merge into: lp:unity8
Diff against target: 115 lines (+55/-10)
2 files modified
qml/Dash/Previews/PreviewHeader.qml (+37/-9)
tests/qmltests/Dash/Previews/tst_PreviewHeader.qml (+18/-1)
To merge this branch: bzr merge lp:~aacid/unity8/emblemInPreviews
Reviewer Review Type Date Requested Status
Andrea Cimitan (community) Approve
PS Jenkins bot (community) continuous-integration Needs Fixing
Unity8 CI Bot continuous-integration Needs Fixing
Review via email: mp+286038@code.launchpad.net

Commit message

Add emblem to the preview header widget

Description of the change

 * Are there any related MPs required for this MP to build/function as expected?
No

 * Did you perform an exploratory manual test run of your code change and any related functionality?
Yes

 * Did you make sure that your branch does not contain spurious tags?
Yes

 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
N/A

 * If you changed the UI, has there been a design review?
N/A

To post a comment you must log in.
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2182
https://unity8-jenkins.ubuntu.com/job/lp-unity8-1-ci/350/
Executed test runs:
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build/478/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/501
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/519
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/519
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/515
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/515/artifact/output/*zip*/output.zip
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial/515/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/515
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/515/artifact/output/*zip*/output.zip
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial/515/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/515
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/515/artifact/output/*zip*/output.zip
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial/515/console

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-1-ci/350/rebuild

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

FAILED: Continuous integration, rev:2182
http://jenkins.qa.ubuntu.com/job/unity8-ci/7285/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-vivid-touch/6472
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-xenial-touch/700/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-vivid/1990
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-qmluitest-xenial-amd64/693
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-vivid-amd64-ci/1885
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-vivid-i386-ci/1885
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-xenial-amd64-ci/692
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-xenial-i386-ci/691
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-vivid-touch/4950
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/6483
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/6483/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/27592
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-xenial-touch/361/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-xenial-armhf/698
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-xenial-armhf/698/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/27591

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/unity8-ci/7285/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Andrea Cimitan (cimi) wrote :

 * Did you perform an exploratory manual test run of the code change and any related functionality?
y
 * Did CI run pass? If not, please explain why.
y
 * Did you make sure that the branch does not contain spurious tags?
y

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'qml/Dash/Previews/PreviewHeader.qml'
2--- qml/Dash/Previews/PreviewHeader.qml 2015-11-04 14:57:13 +0000
3+++ qml/Dash/Previews/PreviewHeader.qml 2016-02-15 11:19:06 +0000
4@@ -25,6 +25,7 @@
5 * The mascot fall back image comes in widgetData["fallback"]
6 * The subtitle comes in widgetData["subtitle"]
7 * The attributes comes in widgetData["attributes"]
8+ * The emblem comes in widgetData["emblem"]
9 */
10
11 PreviewWidget {
12@@ -40,6 +41,7 @@
13 readonly property string title: root.widgetData["title"] || ""
14 readonly property string subtitle: root.widgetData["subtitle"] || ""
15 readonly property var attributes: root.widgetData["attributes"] || null
16+ readonly property url emblem: root.widgetData["emblem"] || ""
17 readonly property color fontColor: root.scopeStyle ? root.scopeStyle.foreground : theme.palette.normal.baseText
18
19 // Rewire the source since we may have unwired it on onStatusChanged
20@@ -98,16 +100,42 @@
21 spacing: units.dp(2)
22 anchors.verticalCenter: parent.verticalCenter
23
24- Label {
25- id: titleLabel
26- objectName: "titleLabel"
27+ Item {
28 anchors { left: parent.left; right: parent.right }
29- elide: Text.ElideRight
30- font.weight: Font.Normal
31- fontSize: "large"
32- wrapMode: Text.Wrap
33- color: headerRoot.fontColor
34- text: headerRoot.title
35+ height: titleLabel.height
36+
37+ Label {
38+ id: titleLabel
39+ objectName: "titleLabel"
40+ anchors {
41+ left: parent.left;
42+ right: iconLoader.right
43+ rightMargin: iconLoader.width > 0 ? units.gu(0.5) : 0
44+ }
45+ elide: Text.ElideRight
46+ font.weight: Font.Normal
47+ fontSize: "large"
48+ wrapMode: Text.Wrap
49+ color: headerRoot.fontColor
50+ text: headerRoot.title
51+ }
52+
53+ Loader {
54+ id: iconLoader
55+ active: headerRoot.emblem != ""
56+ anchors {
57+ bottom: titleLabel.baseline
58+ right: parent.right
59+ }
60+ sourceComponent: Icon {
61+ objectName: "emblemIcon"
62+ source: headerRoot.emblem
63+ color: headerRoot.fontColor
64+ height: source != "" ? titleLabel.font.pixelSize : 0
65+ // FIXME Workaround for bug https://bugs.launchpad.net/ubuntu/+source/ubuntu-ui-toolkit/+bug/1421293
66+ width: implicitWidth > 0 && implicitHeight > 0 ? (implicitWidth / implicitHeight * height) : implicitWidth
67+ }
68+ }
69 }
70
71 Loader {
72
73=== modified file 'tests/qmltests/Dash/Previews/tst_PreviewHeader.qml'
74--- tests/qmltests/Dash/Previews/tst_PreviewHeader.qml 2015-11-04 14:57:13 +0000
75+++ tests/qmltests/Dash/Previews/tst_PreviewHeader.qml 2016-02-15 11:19:06 +0000
76@@ -38,6 +38,14 @@
77 "attributes": [{"value":"text1","icon":"image://theme/ok"},{"value":"text2","icon":"image://theme/cancel"}]
78 }
79
80+ property var emblemheaderjson: {
81+ "title": "THE TITLE",
82+ "subtitle": "Something catchy",
83+ "mascot": "../graphics/play_button.png",
84+ "attributes": [{"value":"text1","icon":"image://theme/ok"},{"value":"text2","icon":"image://theme/cancel"}],
85+ "emblem": Qt.resolvedUrl("../artwork/emblem.png")
86+ }
87+
88 property var brokenheaderjson: {
89 "title": "THE TITLE",
90 "subtitle": "Something catchy",
91@@ -56,7 +64,7 @@
92
93 PreviewHeader {
94 id: previewHeader
95- widgetData: headerjson
96+ widgetData: emblemheaderjson
97 width: units.gu(30)
98
99 Rectangle {
100@@ -128,6 +136,15 @@
101 }
102 }
103
104+ function test_emblem() {
105+ previewHeader.widgetData = emblemheaderjson;
106+
107+ var emblemIcon = findChild(previewHeader, "emblemIcon");
108+ var titleLabel = findChild(previewHeader, "titleLabel");
109+ verify(emblemIcon.height > 0);
110+ compare(emblemIcon.height, titleLabel.font.pixelSize);
111+ }
112+
113 function test_json() {
114 headerjson = origHeaderjson;
115 previewHeader.widgetData = headerjson;

Subscribers

People subscribed via source and target branches