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
=== added file 'qml/Dash/Previews/PreviewProgress.qml'
--- qml/Dash/Previews/PreviewProgress.qml 1970-01-01 00:00:00 +0000
+++ qml/Dash/Previews/PreviewProgress.qml 2014-02-12 16:28:25 +0000
@@ -0,0 +1,70 @@
1/*
2 * Copyright (C) 2014 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU 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 General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.1
18import Ubuntu.Components 0.1
19import Ubuntu.DownloadDaemonListener 0.1
20
21/*! \brief Preview widget for a progress bar.
22 *
23 * It feeds itself from the source determined in widgetData["source"]
24 * At the moment we only support the dbus source defined
25 * by source["dbus-name"] and source["dbus-object"]
26 */
27
28PreviewWidget {
29 id: root
30
31 implicitHeight: progressBar.implicitHeight
32 implicitWidth: progressBar.implicitWidth
33
34 ProgressBar {
35 id: progressBar
36 objectName: "progressBar"
37 value: 0
38 maximumValue: 100
39 implicitHeight: units.gu(5)
40 height: parent.height
41 width: parent.width
42
43 property var source: widgetData["source"]
44 // TODO Eventually we will need to support more sources other
45 // than DownloadTracker via dbus so we'll need a Loader based on source contents
46
47 DownloadTracker {
48 service: progressBar.source["dbus-name"] || ""
49 dbusPath: progressBar.source["dbus-object"] || ""
50
51 onProgress: {
52 if (total <= 0) {
53 progressBar.indeterminate = true;
54 } else {
55 progressBar.indeterminate = false;
56 var percentage = parseInt(received * 100 / total);
57 progressBar.value = percentage;
58 }
59 }
60
61 onFinished: {
62 root.triggered(widgetId, "finished", widgetData)
63 }
64
65 onError: {
66 root.triggered(widgetId, "failed", widgetData)
67 }
68 }
69 }
70}
071
=== modified file 'qml/Dash/Previews/PreviewWidgetFactory.qml'
--- qml/Dash/Previews/PreviewWidgetFactory.qml 2014-02-12 16:28:25 +0000
+++ qml/Dash/Previews/PreviewWidgetFactory.qml 2014-02-12 16:28:25 +0000
@@ -47,6 +47,7 @@
47 case "gallery": return "PreviewImageGallery.qml";47 case "gallery": return "PreviewImageGallery.qml";
48 case "header": return "PreviewHeader.qml";48 case "header": return "PreviewHeader.qml";
49 case "image": return "PreviewZoomableImage.qml"49 case "image": return "PreviewZoomableImage.qml"
50 case "progress": return "PreviewProgress.qml";
50 case "text": return "PreviewTextSummary.qml";51 case "text": return "PreviewTextSummary.qml";
51 case "video": return "PreviewVideoPlayback.qml";52 case "video": return "PreviewVideoPlayback.qml";
52 default: return "";53 default: return "";
5354
=== modified file 'tests/qmltests/CMakeLists.txt'
--- tests/qmltests/CMakeLists.txt 2014-02-12 16:28:25 +0000
+++ tests/qmltests/CMakeLists.txt 2014-02-12 16:28:25 +0000
@@ -61,6 +61,7 @@
61add_qml_test(Dash/Previews PreviewAudioPlayback IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/tests/mocks)61add_qml_test(Dash/Previews PreviewAudioPlayback IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/tests/mocks)
62add_qml_test(Dash/Previews PreviewImageGallery IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/tests/mocks)62add_qml_test(Dash/Previews PreviewImageGallery IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/tests/mocks)
63add_qml_test(Dash/Previews PreviewHeader IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/tests/mocks)63add_qml_test(Dash/Previews PreviewHeader IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/tests/mocks)
64add_qml_test(Dash/Previews PreviewProgress IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/tests/mocks)
64add_qml_test(Dash/Previews PreviewTextSummary IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/tests/mocks)65add_qml_test(Dash/Previews PreviewTextSummary IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/tests/mocks)
65add_qml_test(Dash/Previews PreviewVideoPlayback IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/tests/mocks)66add_qml_test(Dash/Previews PreviewVideoPlayback IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/tests/mocks)
66add_qml_test(Dash/Previews PreviewZoomableImage IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/tests/mocks)67add_qml_test(Dash/Previews PreviewZoomableImage IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/tests/mocks)
6768
=== added file 'tests/qmltests/Dash/Previews/tst_PreviewProgress.qml'
--- tests/qmltests/Dash/Previews/tst_PreviewProgress.qml 1970-01-01 00:00:00 +0000
+++ tests/qmltests/Dash/Previews/tst_PreviewProgress.qml 2014-02-12 16:28:25 +0000
@@ -0,0 +1,87 @@
1/*
2 * Copyright 2014 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU 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 General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import QtTest 1.0
19import "../../../../qml/Dash/Previews"
20import Unity.Test 0.1 as UT
21import Ubuntu.Components 0.1
22
23Rectangle {
24 id: root
25 width: units.gu(60)
26 height: units.gu(80)
27
28 property var progressjson: {
29 "type": "progress",
30 "source": { "dbus-name" : "somename", "dbus-object": "somestring" }
31 }
32
33 property var progressjsonFinish: {
34 "type": "progress",
35 "source": { "dbus-name" : "somename", "dbus-object": "finish" }
36 }
37
38 property var progressjsonError: {
39 "type": "progress",
40 "source": { "dbus-name" : "somename", "dbus-object": "error" }
41 }
42
43 SignalSpy {
44 id: spy
45 signalName: "triggered"
46 }
47
48 PreviewProgress {
49 id: previewProgress
50 widgetId: "previewProgress"
51 widgetData: progressjson
52 width: units.gu(30)
53
54 Rectangle {
55 anchors.fill: parent
56 color: "red"
57 opacity: 0.1
58 }
59 }
60
61 UT.UnityTestCase {
62 name: "PreviewProgressTest"
63 when: windowShown
64
65 function test_json() {
66 spy.target = previewProgress;
67
68 // The mock DownloadTracker triggers its signals when you pass
69 // finish/error as dbus-object to it. Exercise it here
70 previewProgress.widgetData = progressjsonFinish;
71 compare(spy.count, 1);
72 var args = spy.signalArguments[0];
73 compare(args[0], "previewProgress");
74 compare(args[1], "finished");
75 compare(args[2], progressjsonFinish);
76
77 spy.clear();
78
79 previewProgress.widgetData = progressjsonError;
80 compare(spy.count, 1);
81 var args = spy.signalArguments[0];
82 compare(args[0], "previewProgress");
83 compare(args[1], "failed");
84 compare(args[2], progressjsonError);
85 }
86 }
87}
088
=== modified file 'tests/qmltests/Dash/Previews/tst_PreviewWidgetFactory.qml'
--- tests/qmltests/Dash/Previews/tst_PreviewWidgetFactory.qml 2014-02-12 16:28:25 +0000
+++ tests/qmltests/Dash/Previews/tst_PreviewWidgetFactory.qml 2014-02-12 16:28:25 +0000
@@ -80,6 +80,7 @@
80 { tag: "Gallery", type: "gallery", source: "PreviewImageGallery.qml" },80 { tag: "Gallery", type: "gallery", source: "PreviewImageGallery.qml" },
81 { tag: "Header", type: "header", source: "PreviewHeader.qml" },81 { tag: "Header", type: "header", source: "PreviewHeader.qml" },
82 { tag: "Image", type: "image", source: "PreviewZoomableImage.qml" },82 { tag: "Image", type: "image", source: "PreviewZoomableImage.qml" },
83 { tag: "Progress", type: "progress", source: "PreviewProgress.qml" },
83 { tag: "Text", type: "text", source: "PreviewTextSummary.qml" },84 { tag: "Text", type: "text", source: "PreviewTextSummary.qml" },
84 { tag: "Video", type: "video", source: "PreviewVideoPlayback.qml" },85 { tag: "Video", type: "video", source: "PreviewVideoPlayback.qml" },
85 ];86 ];

Subscribers

People subscribed via source and target branches