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

Proposed by Albert Astals Cid
Status: Merged
Approved by: Andrea Cimitan
Approved revision: 718
Merged at revision: 720
Proposed branch: lp:~aacid/unity8/preview_progress
Merge into: lp:unity8
Prerequisite: lp:~unity-team/unity8/unity8.preview_video
Diff against target: 202 lines (+160/-0)
5 files modified
qml/Dash/Previews/PreviewProgress.qml (+70/-0)
qml/Dash/Previews/PreviewWidgetFactory.qml (+1/-0)
tests/qmltests/CMakeLists.txt (+1/-0)
tests/qmltests/Dash/Previews/tst_PreviewProgress.qml (+87/-0)
tests/qmltests/Dash/Previews/tst_PreviewWidgetFactory.qml (+1/-0)
To merge this branch: bzr merge lp:~aacid/unity8/preview_progress
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Andrea Cimitan (community) Approve
Review via email: mp+205939@code.launchpad.net

Commit message

Progress Preview Widget

Description of the change

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

 * Did you perform an exploratory manual test run of your code change and any related functionality?
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.
lp:~aacid/unity8/preview_progress updated
713. By Albert Astals Cid

Actually commit the test file ^_^

714. By Albert Astals Cid

Some explanation of what are we doing in the test

715. By Albert Astals Cid

whitespacing

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:715
http://jenkins.qa.ubuntu.com/job/unity8-ci/2303/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/3159
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/2844/console
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/1173
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-ci/824
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/828
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/828/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-ci/824
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/2777
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/3161
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/3161/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/2846
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/2846/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/5254/console
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/3870

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

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

I think the documentation needs a \brief headline (then a new line with the rest of the description, to be consistent)

Question, is total of Ubuntu.DownloadDaemonListener 0.1 always > 0?

163 + spy.target = previewProgress
semicolon

Also, considering all the issues we had with signalSpy, I'd rather clear it after
compare(args[2], progressjsonFinish);, and compare with 1 then.

review: Needs Fixing
lp:~aacid/unity8/preview_progress updated
716. By Albert Astals Cid

fixlets

717. By Albert Astals Cid

Cimi is scared total may be <= 0

718. By Albert Astals Cid

fix test name

Revision history for this message
Andrea Cimitan (cimi) :
review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:718
http://jenkins.qa.ubuntu.com/job/unity8-ci/2305/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/3168
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/2852
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/1175
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-ci/826
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/830
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/830/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-ci/826
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/2785
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/3170
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/3170/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/2854
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/2854/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/5262
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/3879

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

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

PASSED: Continuous integration, rev:718
http://jenkins.qa.ubuntu.com/job/unity8-ci/2312/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/3202
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/2883
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/1182
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-ci/833
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/837
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/837/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-ci/833
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/2816
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/3204
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/3204/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/2885
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/2885/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/5291
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/3917

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

review: Approve (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?
Yes

 * Did CI run pass? If not, please explain why.
Yes

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'qml/Dash/Previews/PreviewProgress.qml'
2--- qml/Dash/Previews/PreviewProgress.qml 1970-01-01 00:00:00 +0000
3+++ qml/Dash/Previews/PreviewProgress.qml 2014-02-12 16:28:25 +0000
4@@ -0,0 +1,70 @@
5+/*
6+ * Copyright (C) 2014 Canonical, Ltd.
7+ *
8+ * This program is free software; you can redistribute it and/or modify
9+ * it under the terms of the GNU General Public License as published by
10+ * the Free Software Foundation; version 3.
11+ *
12+ * This program is distributed in the hope that it will be useful,
13+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+ * GNU General Public License for more details.
16+ *
17+ * You should have received a copy of the GNU General Public License
18+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
19+ */
20+
21+import QtQuick 2.1
22+import Ubuntu.Components 0.1
23+import Ubuntu.DownloadDaemonListener 0.1
24+
25+/*! \brief Preview widget for a progress bar.
26+ *
27+ * It feeds itself from the source determined in widgetData["source"]
28+ * At the moment we only support the dbus source defined
29+ * by source["dbus-name"] and source["dbus-object"]
30+ */
31+
32+PreviewWidget {
33+ id: root
34+
35+ implicitHeight: progressBar.implicitHeight
36+ implicitWidth: progressBar.implicitWidth
37+
38+ ProgressBar {
39+ id: progressBar
40+ objectName: "progressBar"
41+ value: 0
42+ maximumValue: 100
43+ implicitHeight: units.gu(5)
44+ height: parent.height
45+ width: parent.width
46+
47+ property var source: widgetData["source"]
48+ // TODO Eventually we will need to support more sources other
49+ // than DownloadTracker via dbus so we'll need a Loader based on source contents
50+
51+ DownloadTracker {
52+ service: progressBar.source["dbus-name"] || ""
53+ dbusPath: progressBar.source["dbus-object"] || ""
54+
55+ onProgress: {
56+ if (total <= 0) {
57+ progressBar.indeterminate = true;
58+ } else {
59+ progressBar.indeterminate = false;
60+ var percentage = parseInt(received * 100 / total);
61+ progressBar.value = percentage;
62+ }
63+ }
64+
65+ onFinished: {
66+ root.triggered(widgetId, "finished", widgetData)
67+ }
68+
69+ onError: {
70+ root.triggered(widgetId, "failed", widgetData)
71+ }
72+ }
73+ }
74+}
75
76=== modified file 'qml/Dash/Previews/PreviewWidgetFactory.qml'
77--- qml/Dash/Previews/PreviewWidgetFactory.qml 2014-02-12 16:28:25 +0000
78+++ qml/Dash/Previews/PreviewWidgetFactory.qml 2014-02-12 16:28:25 +0000
79@@ -47,6 +47,7 @@
80 case "gallery": return "PreviewImageGallery.qml";
81 case "header": return "PreviewHeader.qml";
82 case "image": return "PreviewZoomableImage.qml"
83+ case "progress": return "PreviewProgress.qml";
84 case "text": return "PreviewTextSummary.qml";
85 case "video": return "PreviewVideoPlayback.qml";
86 default: return "";
87
88=== modified file 'tests/qmltests/CMakeLists.txt'
89--- tests/qmltests/CMakeLists.txt 2014-02-12 16:28:25 +0000
90+++ tests/qmltests/CMakeLists.txt 2014-02-12 16:28:25 +0000
91@@ -61,6 +61,7 @@
92 add_qml_test(Dash/Previews PreviewAudioPlayback IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/tests/mocks)
93 add_qml_test(Dash/Previews PreviewImageGallery IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/tests/mocks)
94 add_qml_test(Dash/Previews PreviewHeader IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/tests/mocks)
95+add_qml_test(Dash/Previews PreviewProgress IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/tests/mocks)
96 add_qml_test(Dash/Previews PreviewTextSummary IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/tests/mocks)
97 add_qml_test(Dash/Previews PreviewVideoPlayback IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/tests/mocks)
98 add_qml_test(Dash/Previews PreviewZoomableImage IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/tests/mocks)
99
100=== added file 'tests/qmltests/Dash/Previews/tst_PreviewProgress.qml'
101--- tests/qmltests/Dash/Previews/tst_PreviewProgress.qml 1970-01-01 00:00:00 +0000
102+++ tests/qmltests/Dash/Previews/tst_PreviewProgress.qml 2014-02-12 16:28:25 +0000
103@@ -0,0 +1,87 @@
104+/*
105+ * Copyright 2014 Canonical Ltd.
106+ *
107+ * This program is free software; you can redistribute it and/or modify
108+ * it under the terms of the GNU General Public License as published by
109+ * the Free Software Foundation; version 3.
110+ *
111+ * This program is distributed in the hope that it will be useful,
112+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
113+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
114+ * GNU General Public License for more details.
115+ *
116+ * You should have received a copy of the GNU General Public License
117+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
118+ */
119+
120+import QtQuick 2.0
121+import QtTest 1.0
122+import "../../../../qml/Dash/Previews"
123+import Unity.Test 0.1 as UT
124+import Ubuntu.Components 0.1
125+
126+Rectangle {
127+ id: root
128+ width: units.gu(60)
129+ height: units.gu(80)
130+
131+ property var progressjson: {
132+ "type": "progress",
133+ "source": { "dbus-name" : "somename", "dbus-object": "somestring" }
134+ }
135+
136+ property var progressjsonFinish: {
137+ "type": "progress",
138+ "source": { "dbus-name" : "somename", "dbus-object": "finish" }
139+ }
140+
141+ property var progressjsonError: {
142+ "type": "progress",
143+ "source": { "dbus-name" : "somename", "dbus-object": "error" }
144+ }
145+
146+ SignalSpy {
147+ id: spy
148+ signalName: "triggered"
149+ }
150+
151+ PreviewProgress {
152+ id: previewProgress
153+ widgetId: "previewProgress"
154+ widgetData: progressjson
155+ width: units.gu(30)
156+
157+ Rectangle {
158+ anchors.fill: parent
159+ color: "red"
160+ opacity: 0.1
161+ }
162+ }
163+
164+ UT.UnityTestCase {
165+ name: "PreviewProgressTest"
166+ when: windowShown
167+
168+ function test_json() {
169+ spy.target = previewProgress;
170+
171+ // The mock DownloadTracker triggers its signals when you pass
172+ // finish/error as dbus-object to it. Exercise it here
173+ previewProgress.widgetData = progressjsonFinish;
174+ compare(spy.count, 1);
175+ var args = spy.signalArguments[0];
176+ compare(args[0], "previewProgress");
177+ compare(args[1], "finished");
178+ compare(args[2], progressjsonFinish);
179+
180+ spy.clear();
181+
182+ previewProgress.widgetData = progressjsonError;
183+ compare(spy.count, 1);
184+ var args = spy.signalArguments[0];
185+ compare(args[0], "previewProgress");
186+ compare(args[1], "failed");
187+ compare(args[2], progressjsonError);
188+ }
189+ }
190+}
191
192=== modified file 'tests/qmltests/Dash/Previews/tst_PreviewWidgetFactory.qml'
193--- tests/qmltests/Dash/Previews/tst_PreviewWidgetFactory.qml 2014-02-12 16:28:25 +0000
194+++ tests/qmltests/Dash/Previews/tst_PreviewWidgetFactory.qml 2014-02-12 16:28:25 +0000
195@@ -80,6 +80,7 @@
196 { tag: "Gallery", type: "gallery", source: "PreviewImageGallery.qml" },
197 { tag: "Header", type: "header", source: "PreviewHeader.qml" },
198 { tag: "Image", type: "image", source: "PreviewZoomableImage.qml" },
199+ { tag: "Progress", type: "progress", source: "PreviewProgress.qml" },
200 { tag: "Text", type: "text", source: "PreviewTextSummary.qml" },
201 { tag: "Video", type: "video", source: "PreviewVideoPlayback.qml" },
202 ];

Subscribers

People subscribed via source and target branches