Merge lp:~cimi/unity8/preview-sharing-string-and-array into lp:unity8

Proposed by Andrea Cimitan on 2016-02-24
Status: Merged
Approved by: Albert Astals Cid on 2016-02-25
Approved revision: 2208
Merged at revision: 2262
Proposed branch: lp:~cimi/unity8/preview-sharing-string-and-array
Merge into: lp:unity8
Diff against target: 82 lines (+34/-10)
2 files modified
qml/Dash/Previews/PreviewSharing.qml (+17/-7)
tests/qmltests/Dash/Previews/tst_PreviewSharing.qml (+17/-3)
To merge this branch: bzr merge lp:~cimi/unity8/preview-sharing-string-and-array
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing on 2016-02-25
Unity8 CI Bot continuous-integration Needs Fixing on 2016-02-25
Albert Astals Cid (community) Approve on 2016-02-25
Paweł Stołowski 2016-02-24 Approve on 2016-02-24
Review via email: mp+287008@code.launchpad.net

Commit Message

PreviewSharing widget now accepts both string and array of widgetData["share-data"]["uri"]

Description of the Change

 * Are there any related MPs required for this MP to build/function as expected? Please list.
n
 * Did you perform an exploratory manual test run of your code change and any related functionality?
y
 * Did you make sure that your branch does not contain spurious tags?
y
 * 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.
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:2205
https://unity8-jenkins.ubuntu.com/job/lp-unity8-1-ci/474/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/633
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay/203
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial/203
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/656
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/674
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/674
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/670
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/670/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial/670
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial/670/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/670
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/670/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial/670
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial/670/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/670
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/670/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial/670
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial/670/artifact/output/*zip*/output.zip

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

review: Approve (continuous-integration)
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:2205
http://jenkins.qa.ubuntu.com/job/unity8-ci/7405/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-vivid-touch/6617
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-xenial-touch/820/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-vivid/2110
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-qmluitest-xenial-amd64/813
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-vivid-amd64-ci/2005
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-vivid-i386-ci/2005
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-xenial-amd64-ci/812
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-xenial-i386-ci/811
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-vivid-touch/5025
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/6628
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/6628/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/27867
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-xenial-touch/420/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-xenial-armhf/818
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-xenial-armhf/818/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/27866

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

review: Needs Fixing (continuous-integration)
Paweł Stołowski (stolowski) wrote :

Looks good to me, thanks!

review: Approve
Albert Astals Cid (aacid) wrote :

verify(exportedItems[0].url.toString().search(shareDataString["uri"][i]) != -1);

is wrong

should be

verify(exportedItems[0].url.toString().search(shareDataString["uri"]) != -1);

review: Needs Fixing
Albert Astals Cid (aacid) wrote :

Also i think it would make more sense if you made the uris real uris, i.e. "file:///Text here" and then you remove the ".toString().search" and do a real comparison.

What do you think?

2206. By Andrea Cimitan on 2016-02-25

Fix as review

2207. By Andrea Cimitan on 2016-02-25

Use uri

2208. By Andrea Cimitan on 2016-02-25

Use compare

Albert Astals Cid (aacid) wrote :

 * Did you perform an exploratory manual test run of the code change and any related functionality?
Not really, i could not find any scope that uses this but code looks good and the reporter of the bug (via email) says it works (or so i understood)

 * Did CI run pass?
Yes

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

review: Approve
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2206
https://unity8-jenkins.ubuntu.com/job/lp-unity8-1-ci/487/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/649
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay/214
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial/214
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/672
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/690
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/690
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/686
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/686/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial/686
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial/686/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/686
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/686/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial/686
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial/686/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/686
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/686/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial/686
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial/686/artifact/output/*zip*/output.zip

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

review: Needs Fixing (continuous-integration)
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:2206
http://jenkins.qa.ubuntu.com/job/unity8-ci/7418/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-vivid-touch/6635
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-xenial-touch/833/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-vivid/2123
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-qmluitest-xenial-amd64/826
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-vivid-amd64-ci/2018
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-vivid-i386-ci/2018
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-xenial-amd64-ci/825
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-xenial-i386-ci/824
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-vivid-touch/5037
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/6646
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/6646/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/27891
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-xenial-touch/430/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-xenial-armhf/831
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-xenial-armhf/831/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/27890

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

review: Needs Fixing (continuous-integration)
Zhang Enwei (zhangew401) wrote :

I verified the behaviour by using http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/6646/artifact/work/output/*zip*/output.zip and Douban scope.
https://code.launchpad.net/~hanloon-team/hanloon/douban
The link is shared to Message and Twitter. There is one bug in facebook that prevents this happening.
Thanks a lot.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'qml/Dash/Previews/PreviewSharing.qml'
2--- qml/Dash/Previews/PreviewSharing.qml 2015-12-17 15:42:39 +0000
3+++ qml/Dash/Previews/PreviewSharing.qml 2016-02-25 12:05:25 +0000
4@@ -44,6 +44,22 @@
5 }
6 }
7
8+ function createExportedItems(url) {
9+ var items = new Array();
10+ if (typeof url === "string") {
11+ var exportItem = exportItemComponent.createObject();
12+ exportItem.url = url;
13+ items.push(exportItem);
14+ } else {
15+ for (var i = 0; i < url.length; i++) {
16+ var exportItem = exportItemComponent.createObject();
17+ exportItem.url = url[i];
18+ items.push(exportItem);
19+ }
20+ }
21+ return items;
22+ }
23+
24 Component {
25 id: exportItemComponent
26 ContentItem {
27@@ -76,13 +92,7 @@
28 onPeerSelected: {
29 var transfer = peer.request();
30 if (transfer.state === ContentTransfer.InProgress) {
31- var items = new Array();
32- for (var i = 0; i < url.length; i++) {
33- var exportItem = exportItemComponent.createObject();
34- exportItem.url = url[i];
35- items.push(exportItem);
36- }
37- transfer.items = items;
38+ transfer.items = createExportedItems(url);
39 transfer.state = ContentTransfer.Charged;
40 }
41 peerPicker.visible = false;
42
43=== modified file 'tests/qmltests/Dash/Previews/tst_PreviewSharing.qml'
44--- tests/qmltests/Dash/Previews/tst_PreviewSharing.qml 2016-01-04 19:28:43 +0000
45+++ tests/qmltests/Dash/Previews/tst_PreviewSharing.qml 2016-02-25 12:05:25 +0000
46@@ -28,13 +28,18 @@
47
48 property var shareData: {
49 "uri": [
50- "Text here",
51- "text here 2",
52- "text here 3"
53+ "file:///this/is/an/url",
54+ "file:///this/is/an/url/2",
55+ "file:///this/is/an/url/3"
56 ],
57 "content-type": "text"
58 }
59
60+ property var shareDataString: {
61+ "uri": "file:///this/is/an/url",
62+ "content-type": "text"
63+ }
64+
65 PreviewSharing {
66 id: previewSharing
67 anchors { left: parent.left; bottom: parent.bottom; }
68@@ -55,5 +60,14 @@
69 mouseClick(previewSharing);
70 compare(peerPicker.visible, true);
71 }
72+
73+ function test_createExportedItems() {
74+ var exportedItems = previewSharing.createExportedItems(shareData["uri"]);
75+ for (var i = 0; i < exportedItems.length; i++) {
76+ compare(exportedItems[i].url, shareData["uri"][i]);
77+ }
78+ exportedItems = previewSharing.createExportedItems(shareDataString["uri"]);
79+ compare(exportedItems[0].url, shareDataString["uri"]);
80+ }
81 }
82 }

Subscribers

People subscribed via source and target branches