Merge lp:~artmello/gallery-app/gallery-app-fix_1523573 into lp:gallery-app

Proposed by Arthur Mello
Status: Merged
Approved by: Bill Filler
Approved revision: 1271
Merged at revision: 1289
Proposed branch: lp:~artmello/gallery-app/gallery-app-fix_1523573
Merge into: lp:gallery-app
Diff against target: 495 lines (+177/-43)
11 files modified
po/gallery-app.pot (+31/-19)
rc/qml/Components/UnableShareDialog.qml (+34/-0)
rc/qml/EventsOverview.qml (+11/-2)
rc/qml/PhotosOverview.qml (+11/-1)
tests/autopilot/gallery_app/emulators/events_view.py (+5/-0)
tests/autopilot/gallery_app/emulators/media_selector.py (+2/-1)
tests/autopilot/gallery_app/emulators/photos_view.py (+12/-3)
tests/autopilot/gallery_app/tests/__init__.py (+9/-6)
tests/autopilot/gallery_app/tests/test_events_view.py (+31/-4)
tests/autopilot/gallery_app/tests/test_photo_viewer.py (+5/-5)
tests/autopilot/gallery_app/tests/test_photos_view.py (+26/-2)
To merge this branch: bzr merge lp:~artmello/gallery-app/gallery-app-fix_1523573
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Ubuntu Phablet Team Pending
Review via email: mp+285855@code.launchpad.net

Commit message

Enable sharing multiple files
Notify user when trying to share photos and videos at the same time

Description of the change

Enable sharing multiple files
Notify user when trying to share photos and videos at the same time

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1267. By Arthur Mello

Add AP tests to check sharing files from photos and events view

1268. By Arthur Mello

Update pot file

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

Undo changes to pot files

1270. By Arthur Mello

Merge with trunk

1271. By Arthur Mello

Add changes to pot file

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'po/gallery-app.pot'
2--- po/gallery-app.pot 2016-02-11 11:53:01 +0000
3+++ po/gallery-app.pot 2016-03-07 20:24:29 +0000
4@@ -8,7 +8,7 @@
5 msgstr ""
6 "Project-Id-Version: gallery-app\n"
7 "Report-Msgid-Bugs-To: \n"
8-"POT-Creation-Date: 2016-02-11 09:44-0200\n"
9+"POT-Creation-Date: 2016-03-07 17:20-0300\n"
10 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
11 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
12 "Language-Team: LANGUAGE <LL@li.org>\n"
13@@ -25,14 +25,14 @@
14 #: rc/qml/AlbumEditor/AlbumEditMenu.qml:50
15 #: rc/qml/AlbumViewer/AlbumViewer.qml:378
16 #: rc/qml/Components/DeleteDialog.qml:32 rc/qml/EventsOverview.qml:138
17-#: rc/qml/MediaViewer/MediaViewer.qml:354 rc/qml/PhotosOverview.qml:164
18+#: rc/qml/MediaViewer/MediaViewer.qml:346 rc/qml/PhotosOverview.qml:164
19 #: rc/qml/Utility/EditingHUD.qml:67
20 msgid "Delete"
21 msgstr ""
22
23 #: rc/qml/AlbumEditor/AlbumEditor.qml:39
24-#: rc/qml/Components/MediaSelector.qml:93 rc/qml/EventsOverview.qml:156
25-#: rc/qml/MediaViewer/MediaViewer.qml:282 rc/qml/PhotosOverview.qml:182
26+#: rc/qml/Components/MediaSelector.qml:93 rc/qml/EventsOverview.qml:160
27+#: rc/qml/MediaViewer/MediaViewer.qml:274 rc/qml/PhotosOverview.qml:187
28 #: rc/qml/PickerScreen.qml:227
29 msgid "Cancel"
30 msgstr ""
31@@ -62,7 +62,7 @@
32 msgstr ""
33
34 #: rc/qml/AlbumViewer/AlbumViewer.qml:372
35-#: rc/qml/MediaViewer/MediaViewer.qml:344
36+#: rc/qml/MediaViewer/MediaViewer.qml:336
37 msgid "Add to album"
38 msgstr ""
39
40@@ -84,12 +84,12 @@
41 msgstr ""
42
43 #: rc/qml/Components/DeleteDialog.qml:36
44-#: rc/qml/MediaViewer/MediaViewer.qml:230
45+#: rc/qml/MediaViewer/MediaViewer.qml:222
46 msgid "Yes"
47 msgstr ""
48
49 #: rc/qml/Components/DeleteDialog.qml:45
50-#: rc/qml/MediaViewer/MediaViewer.qml:241
51+#: rc/qml/MediaViewer/MediaViewer.qml:233
52 msgid "No"
53 msgstr ""
54
55@@ -114,10 +114,22 @@
56 msgid "Add to Album"
57 msgstr ""
58
59-#: rc/qml/Components/PopupAlbumPicker.qml:161 rc/qml/Utility/EditingHUD.qml:78
60+#: rc/qml/Components/PopupAlbumPicker.qml:162 rc/qml/Utility/EditingHUD.qml:78
61 msgid "Add Photo to Album"
62 msgstr ""
63
64+#: rc/qml/Components/UnableShareDialog.qml:25
65+msgid "Unable to share"
66+msgstr ""
67+
68+#: rc/qml/Components/UnableShareDialog.qml:26
69+msgid "Unable to share photos and videos at the same time"
70+msgstr ""
71+
72+#: rc/qml/Components/UnableShareDialog.qml:30
73+msgid "Ok"
74+msgstr ""
75+
76 #: rc/qml/EventsOverview.qml:76 rc/qml/PhotosOverview.qml:85
77 msgid "Delete 1 photo"
78 msgstr ""
79@@ -166,13 +178,13 @@
80 msgid "Add"
81 msgstr ""
82
83-#: rc/qml/EventsOverview.qml:145 rc/qml/MediaViewer/MediaViewer.qml:365
84+#: rc/qml/EventsOverview.qml:145 rc/qml/MediaViewer/MediaViewer.qml:357
85 #: rc/qml/PhotosOverview.qml:171 rc/qml/Utility/EditingHUD.qml:72
86 msgid "Share"
87 msgstr ""
88
89-#: rc/qml/EventsOverview.qml:184 rc/qml/MediaViewer/MediaViewer.qml:186
90-#: rc/qml/PhotosOverview.qml:196
91+#: rc/qml/EventsOverview.qml:193 rc/qml/MediaViewer/MediaViewer.qml:178
92+#: rc/qml/PhotosOverview.qml:206
93 msgid "Share to"
94 msgstr ""
95
96@@ -194,31 +206,31 @@
97 msgid "Photos"
98 msgstr ""
99
100-#: rc/qml/MediaViewer/MediaViewer.qml:219
101+#: rc/qml/MediaViewer/MediaViewer.qml:211
102 msgid "Delete a photo"
103 msgstr ""
104
105-#: rc/qml/MediaViewer/MediaViewer.qml:219
106+#: rc/qml/MediaViewer/MediaViewer.qml:211
107 msgid "Delete a video"
108 msgstr ""
109
110-#: rc/qml/MediaViewer/MediaViewer.qml:252
111+#: rc/qml/MediaViewer/MediaViewer.qml:244
112 msgid "Remove a photo from album"
113 msgstr ""
114
115-#: rc/qml/MediaViewer/MediaViewer.qml:252
116+#: rc/qml/MediaViewer/MediaViewer.qml:244
117 msgid "Remove a video from album"
118 msgstr ""
119
120-#: rc/qml/MediaViewer/MediaViewer.qml:261
121+#: rc/qml/MediaViewer/MediaViewer.qml:253
122 msgid "Remove from Album"
123 msgstr ""
124
125-#: rc/qml/MediaViewer/MediaViewer.qml:272
126+#: rc/qml/MediaViewer/MediaViewer.qml:264
127 msgid "Remove from Album and Delete"
128 msgstr ""
129
130-#: rc/qml/MediaViewer/MediaViewer.qml:319
131+#: rc/qml/MediaViewer/MediaViewer.qml:311
132 msgid "Edit"
133 msgstr ""
134
135@@ -235,7 +247,7 @@
136 msgid "Toggle Selection"
137 msgstr ""
138
139-#: rc/qml/MediaViewer/SingleMediaViewer.qml:225
140+#: rc/qml/MediaViewer/SingleMediaViewer.qml:241
141 msgid "An error has occurred attempting to load media"
142 msgstr ""
143
144
145=== added file 'rc/qml/Components/UnableShareDialog.qml'
146--- rc/qml/Components/UnableShareDialog.qml 1970-01-01 00:00:00 +0000
147+++ rc/qml/Components/UnableShareDialog.qml 2016-03-07 20:24:29 +0000
148@@ -0,0 +1,34 @@
149+/*
150+ * Copyright (C) 2016 Canonical Ltd
151+ *
152+ * This program is free software: you can redistribute it and/or modify
153+ * it under the terms of the GNU General Public License version 3 as
154+ * published by the Free Software Foundation.
155+ *
156+ * This program is distributed in the hope that it will be useful,
157+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
158+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
159+ * GNU General Public License for more details.
160+ *
161+ * You should have received a copy of the GNU General Public License
162+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
163+ */
164+
165+import QtQuick 2.4
166+import Ubuntu.Components 1.3
167+import Ubuntu.Components.Popups 1.3
168+
169+Dialog {
170+ id: dialog
171+ objectName: "unableShareDialog"
172+
173+ title: i18n.tr("Unable to share")
174+ text: i18n.tr("Unable to share photos and videos at the same time")
175+
176+ Button {
177+ objectName: "unableShareDialogOk"
178+ text: i18n.tr("Ok")
179+ color: UbuntuColors.orange
180+ onClicked: PopupUtils.close(dialog);
181+ }
182+}
183
184=== modified file 'rc/qml/EventsOverview.qml'
185--- rc/qml/EventsOverview.qml 2015-11-05 18:10:29 +0000
186+++ rc/qml/EventsOverview.qml 2016-03-07 20:24:29 +0000
187@@ -144,9 +144,13 @@
188 objectName: "shareButton"
189 text: i18n.tr("Share")
190 iconName: "share"
191- enabled: selection.selectedMediaCount == 1
192+ enabled: selection.selectedMediaCount > 0
193 onTriggered: {
194- overview.pushPage(sharePicker)
195+ if (selection.isMixed) {
196+ PopupUtils.open(unableShareDialog, null);
197+ return;
198+ }
199+ overview.pushPage(sharePicker);
200 sharePicker.visible = true;
201 }
202 }
203@@ -174,6 +178,11 @@
204 head.backAction: selectionMode ? selectBackAction : null
205
206 Component {
207+ id: unableShareDialog
208+ UnableShareDialog {}
209+ }
210+
211+ Component {
212 id: contentItemComp
213 ContentItem {}
214 }
215
216=== modified file 'rc/qml/PhotosOverview.qml'
217--- rc/qml/PhotosOverview.qml 2015-12-10 17:58:04 +0000
218+++ rc/qml/PhotosOverview.qml 2016-03-07 20:24:29 +0000
219@@ -170,8 +170,13 @@
220 objectName: "shareButton"
221 text: i18n.tr("Share")
222 iconName: "share"
223- enabled: d.selection.selectedMediaCount == 1
224+ enabled: d.selection.selectedMediaCount > 0
225 onTriggered: {
226+ if (selection.isMixed) {
227+ PopupUtils.open(unableShareDialog, null);
228+ return;
229+ }
230+
231 overview.pushPage(sharePicker)
232 sharePicker.visible = true;
233 }
234@@ -186,6 +191,11 @@
235 }
236
237 Component {
238+ id: unableShareDialog
239+ UnableShareDialog {}
240+ }
241+
242+ Component {
243 id: contentItemComp
244 ContentItem {}
245 }
246
247=== modified file 'tests/autopilot/gallery_app/emulators/events_view.py'
248--- tests/autopilot/gallery_app/emulators/events_view.py 2015-04-08 05:16:08 +0000
249+++ tests/autopilot/gallery_app/emulators/events_view.py 2016-03-07 20:24:29 +0000
250@@ -46,6 +46,11 @@
251 photo_delegates = event.select_many(objectName='eventPhoto')
252 return len(photo_delegates)
253
254+ def get_share_peer_picker(self):
255+ """Returns the photo viewer share picker."""
256+ return self.app.wait_select_single(objectName="sharePickerEvents",
257+ visible=True)
258+
259 def _get_image_in_event_view(self, image_name):
260 """Return the photo of the gallery based on image name.
261
262
263=== modified file 'tests/autopilot/gallery_app/emulators/media_selector.py'
264--- tests/autopilot/gallery_app/emulators/media_selector.py 2015-08-03 12:59:55 +0000
265+++ tests/autopilot/gallery_app/emulators/media_selector.py 2016-03-07 20:24:29 +0000
266@@ -26,7 +26,8 @@
267 mediaRow = selector.wait_select_single(objectName="mediaSelectorList0")
268
269 # get the loader for the second item
270- thumbnailLoader = mediaRow.wait_select_single(objectName="thumbnailLoader1")
271+ thumbnailLoader = mediaRow.wait_select_single(
272+ objectName="thumbnailLoader1")
273
274 # return the item itself
275 return thumbnailLoader.wait_select_single(objectName="eventPhoto",
276
277=== modified file 'tests/autopilot/gallery_app/emulators/photos_view.py'
278--- tests/autopilot/gallery_app/emulators/photos_view.py 2014-05-02 17:31:46 +0000
279+++ tests/autopilot/gallery_app/emulators/photos_view.py 2016-03-07 20:24:29 +0000
280@@ -13,14 +13,23 @@
281 def __init__(self, app):
282 self.app = app
283
284+ def get_photo_in_photos_view_by_index(self, index):
285+ """Returns the photo with index in the photos view."""
286+ return self.select_many_retry(
287+ "QQuickItem",
288+ objectName="allPotosGridPhoto")[index]
289+
290 def get_first_photo_in_photos_view(self):
291 """Returns the very first photo in the photos view."""
292- return self.select_many_retry(
293- "QQuickItem",
294- objectName="allPotosGridPhoto")[0]
295+ return self.get_photo_in_photos_view_by_index(0)
296
297 def number_of_photos(self):
298 """Returns the number of events"""
299 photo_delegates = self.app.select_many("QQuickItem",
300 objectName="allPotosGridPhoto")
301 return len(photo_delegates)
302+
303+ def get_share_peer_picker(self):
304+ """Returns the photo viewer share picker."""
305+ return self.app.wait_select_single(objectName="sharePickerPhotos",
306+ visible=True)
307
308=== modified file 'tests/autopilot/gallery_app/tests/__init__.py'
309--- tests/autopilot/gallery_app/tests/__init__.py 2014-09-19 04:22:12 +0000
310+++ tests/autopilot/gallery_app/tests/__init__.py 2016-03-07 20:24:29 +0000
311@@ -123,16 +123,19 @@
312 shutil.rmtree(self.sample_destination_dir)
313 self.assertFalse(os.path.exists(self.sample_destination_dir))
314
315- self.sample_file = os.path.join(
316- self.sample_destination_dir,
317- "sample04.jpg"
318- )
319-
320 default_data_dir = os.path.join(
321 self.sample_dir,
322 "default")
323+
324+ self.sample_jpg_files = []
325+ for f in os.listdir(default_data_dir):
326+ if f.endswith(".jpg"):
327+ self.sample_jpg_files.append(os.path.join(
328+ self.sample_destination_dir, f))
329+
330 shutil.copytree(default_data_dir, self.sample_destination_dir)
331- self.assertTrue(os.path.isfile(self.sample_file))
332+ for sample in self.sample_jpg_files:
333+ self.assertTrue(os.path.isfile(sample))
334
335 self.sample_file_source = \
336 default_data_dir + self.sample_file_source
337
338=== modified file 'tests/autopilot/gallery_app/tests/test_events_view.py'
339--- tests/autopilot/gallery_app/tests/test_events_view.py 2016-01-15 20:29:19 +0000
340+++ tests/autopilot/gallery_app/tests/test_events_view.py 2016-03-07 20:24:29 +0000
341@@ -84,11 +84,11 @@
342
343 def test_delete_a_photo(self):
344 """Selecting a photo must make the delete button clickable."""
345- self.assertThat(lambda: exists(self.sample_file),
346+ self.assertThat(lambda: exists(self.sample_jpg_files[3]),
347 Eventually(Equals(True)))
348
349 self.enable_select_mode()
350- self.events_view.select_photo(self.sample_file)
351+ self.events_view.select_photo(self.sample_jpg_files[3])
352 self.main_view.get_header().click_action_button("deleteButton")
353 self.assertThat(self.gallery_utils.delete_dialog_shown,
354 Eventually(Is(True)))
355@@ -97,7 +97,7 @@
356 self.assertThat(self.gallery_utils.delete_dialog_shown,
357 Eventually(Is(False)))
358
359- self.assertThat(lambda: exists(self.sample_file),
360+ self.assertThat(lambda: exists(self.sample_jpg_files[3]),
361 Eventually(Equals(True)))
362
363 self.main_view.get_header().click_action_button("deleteButton")
364@@ -108,9 +108,36 @@
365 self.assertThat(self.gallery_utils.delete_dialog_shown,
366 Eventually(Is(False)))
367
368- self.assertThat(lambda: exists(self.sample_file),
369+ self.assertThat(lambda: exists(self.sample_jpg_files[3]),
370 Eventually(Equals(False)))
371
372+ def test_share_single_photo(self):
373+ """Selecting a photo must make the share button clickable."""
374+ self.assertThat(lambda: exists(self.sample_jpg_files[3]),
375+ Eventually(Equals(True)))
376+ self.enable_select_mode()
377+ self.events_view.select_photo(self.sample_jpg_files[3])
378+ self.main_view.get_header().click_action_button("shareButton")
379+ share_picker = self.events_view.get_share_peer_picker()
380+ self.assertThat(share_picker.visible, Eventually(Equals(True)))
381+ self.main_view.get_header().click_back_button()
382+ self.assertThat(share_picker.visible, Eventually(Equals(False)))
383+
384+ def test_share_multiple_photos(self):
385+ """Selecting multiple photos must make the share button clickable."""
386+ self.assertThat(lambda: exists(self.sample_jpg_files[2]),
387+ Eventually(Equals(True)))
388+ self.assertThat(lambda: exists(self.sample_jpg_files[3]),
389+ Eventually(Equals(True)))
390+ self.enable_select_mode()
391+ self.events_view.select_photo(self.sample_jpg_files[2])
392+ self.events_view.select_photo(self.sample_jpg_files[3])
393+ self.main_view.get_header().click_action_button("shareButton")
394+ share_picker = self.events_view.get_share_peer_picker()
395+ self.assertThat(share_picker.visible, Eventually(Equals(True)))
396+ self.main_view.get_header().click_back_button()
397+ self.assertThat(share_picker.visible, Eventually(Equals(False)))
398+
399 def test_adding_a_video(self):
400 if model() == "Desktop":
401 before = self.events_view.get_event(0)
402
403=== modified file 'tests/autopilot/gallery_app/tests/test_photo_viewer.py'
404--- tests/autopilot/gallery_app/tests/test_photo_viewer.py 2015-11-04 17:27:23 +0000
405+++ tests/autopilot/gallery_app/tests/test_photo_viewer.py 2016-03-07 20:24:29 +0000
406@@ -48,7 +48,7 @@
407 Eventually(GreaterThan(0))
408 )
409
410- self.events_view.click_photo(self.sample_file)
411+ self.events_view.click_photo(self.sample_jpg_files[3])
412
413 photo_viewer_loader = self.photo_viewer.get_main_photo_viewer_loader()
414 self.assertThat(photo_viewer_loader.loaded, Eventually(Equals(True)))
415@@ -132,11 +132,11 @@
416 photo_viewer.PopupPhotoViewer)
417 photo_viewer_popup.delete_current_photo(confirm=False)
418
419- self.assertThat(lambda: os.path.exists(self.sample_file),
420+ self.assertThat(lambda: os.path.exists(self.sample_jpg_files[3]),
421 Eventually(Equals(True)))
422
423 photo_viewer_popup.delete_current_photo()
424- self.assertThat(lambda: os.path.exists(self.sample_file),
425+ self.assertThat(lambda: os.path.exists(self.sample_jpg_files[3]),
426 Eventually(Equals(False)))
427
428 # Delete all other pictures and make sure the photo viewer closes
429@@ -241,7 +241,7 @@
430
431 def test_photo_editor_crop(self):
432 """Cropping a photo must crop it."""
433- old_file_size = os.path.getsize(self.sample_file)
434+ old_file_size = os.path.getsize(self.sample_jpg_files[3])
435
436 self.photo_viewer.click_crop_button()
437
438@@ -271,7 +271,7 @@
439 photo_viewer = self.photo_viewer.get_main_photo_viewer()
440 self.assertThat(photo_viewer.visible, Eventually(Equals(True)))
441
442- new_file_size = os.path.getsize(self.sample_file)
443+ new_file_size = os.path.getsize(self.sample_jpg_files[3])
444 self.assertThat(old_file_size > new_file_size, Equals(True))
445
446 def test_photo_editor_rotate(self):
447
448=== modified file 'tests/autopilot/gallery_app/tests/test_photos_view.py'
449--- tests/autopilot/gallery_app/tests/test_photos_view.py 2016-01-15 20:29:19 +0000
450+++ tests/autopilot/gallery_app/tests/test_photos_view.py 2016-03-07 20:24:29 +0000
451@@ -57,11 +57,14 @@
452 photo = self.photos_view.get_first_photo_in_photos_view()
453 self.click_item(photo)
454
455- def select_first_photo(self):
456- photo = self.photos_view.get_first_photo_in_photos_view()
457+ def select_photo_by_index(self, index):
458+ photo = self.photos_view.get_photo_in_photos_view_by_index(index)
459 checkbox = photo.select_single(objectName="selectionCheckbox")
460 self.click_item(checkbox)
461
462+ def select_first_photo(self):
463+ self.select_photo_by_index(0)
464+
465 def check_header_button_exist(self, button):
466 buttonName = button + "_button"
467 try:
468@@ -127,6 +130,27 @@
469 self.assertThat(lambda: self.photos_view.number_of_photos(),
470 Eventually(Equals(number_of_photos - 1)))
471
472+ def test_share_single_photo(self):
473+ """Selecting a photo must make the share button clickable."""
474+ self.main_view.get_header().click_action_button("selectButton")
475+ self.select_first_photo()
476+ self.main_view.get_header().click_action_button("shareButton")
477+ share_picker = self.photos_view.get_share_peer_picker()
478+ self.assertThat(share_picker.visible, Eventually(Equals(True)))
479+ self.main_view.get_header().click_back_button()
480+ self.assertThat(share_picker.visible, Eventually(Equals(False)))
481+
482+ def test_share_multiple_photos(self):
483+ """Selecting multiple photos must make the share button clickable."""
484+ self.main_view.get_header().click_action_button("selectButton")
485+ self.select_photo_by_index(0)
486+ self.select_photo_by_index(1)
487+ self.main_view.get_header().click_action_button("shareButton")
488+ share_picker = self.photos_view.get_share_peer_picker()
489+ self.assertThat(share_picker.visible, Eventually(Equals(True)))
490+ self.main_view.get_header().click_back_button()
491+ self.assertThat(share_picker.visible, Eventually(Equals(False)))
492+
493 @unittest.skip("Temporarily disable as it fails in some cases, "
494 "supposedly due to problems with the infrastructure")
495 def test_save_state(self):

Subscribers

People subscribed via source and target branches