Merge lp:~osomon/gallery-app/photos-selection-ap-tests into lp:gallery-app

Proposed by Olivier Tilloy
Status: Merged
Approved by: Olivier Tilloy
Approved revision: 1160
Merged at revision: 1151
Proposed branch: lp:~osomon/gallery-app/photos-selection-ap-tests
Merge into: lp:gallery-app
Diff against target: 454 lines (+71/-60)
15 files modified
rc/qml/AlbumEditor/AlbumCoverMenu.qml (+2/-2)
rc/qml/MainScreen.qml (+7/-4)
rc/qml/MediaViewer/MediaViewer.qml (+2/-2)
rc/qml/OrganicView/OrganicItemInteraction.qml (+1/-0)
tests/autopilot/gallery_app/emulators/album_editor.py (+3/-3)
tests/autopilot/gallery_app/emulators/album_view.py (+8/-8)
tests/autopilot/gallery_app/emulators/gallery_utils.py (+5/-6)
tests/autopilot/gallery_app/emulators/photo_viewer.py (+5/-4)
tests/autopilot/gallery_app/emulators/picker_screen.py (+4/-9)
tests/autopilot/gallery_app/tests/test_album_editor.py (+8/-6)
tests/autopilot/gallery_app/tests/test_album_view.py (+6/-4)
tests/autopilot/gallery_app/tests/test_albums_view.py (+5/-4)
tests/autopilot/gallery_app/tests/test_photo_viewer.py (+3/-2)
tests/autopilot/gallery_app/tests/test_photos_view.py (+8/-3)
tests/autopilot/gallery_app/tests/test_picker_mode.py (+4/-3)
To merge this branch: bzr merge lp:~osomon/gallery-app/photos-selection-ap-tests
Reviewer Review Type Date Requested Status
Ugo Riboni (community) Approve
Review via email: mp+249970@code.launchpad.net

Commit message

Fix failing autopilot tests that were broken by the changes introduced at revision 1143 (fix for bug #1416043).

List of the tests that were fixed:
 ‣ test_photos_view.TestPhotosView.test_delete_photo_dialog_appears
 ‣ test_photos_view.TestPhotosView.test_delete_a_photo
 ‣ test_albums_view.TestAlbumsView.test_add_album
 ‣ test_album_view.TestAlbumView.test_add_photo
 ‣ test_album_view.TestAlbumView.test_add_photo_to_new_album
 ‣ test_album_view.TestAlbumView.test_cancel_remove_photo_from_album
 ‣ test_album_view.TestAlbumView.test_remove_photo_from_album
 ‣ test_album_view.TestAlbumView.test_remove_photo_from_album_and_delete
 ‣ test_photo_viewer.TestPhotoEditor.test_photo_editor_rotate
 ‣ test_photo_viewer.TestPhotoEditor.test_photo_editor_redo_undo_revert_enhance_states
 ‣ test_photo_viewer.TestPhotoEditor.test_photo_editor_crop
 ‣ test_photo_viewer.TestPhotoViewer.test_share_button
 ‣ test_photo_viewer.TestPhotoViewer.test_photo_delete_works
 ‣ test_photo_viewer.TestPhotoViewer.test_nav_bar_album_picker_button
 ‣ test_picker_mode.TestPickerMode.test_pick_first_photo
 ‣ test_picker_mode.TestPickerMode.test_pick_named_photo
 ‣ test_picker_mode.TestPickerMode.test_selection_synchronisation
 ‣ test_album_editor.TestAlbumEditor.test_add_photo
 ‣ test_album_editor.TestAlbumEditor.test_cover_image

To post a comment you must log in.
Revision history for this message
Ugo Riboni (uriboni) wrote :

Code LGTM and the affected tests can be run successfully

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'rc/qml/AlbumEditor/AlbumCoverMenu.qml'
2--- rc/qml/AlbumEditor/AlbumCoverMenu.qml 2013-06-20 11:54:49 +0000
3+++ rc/qml/AlbumEditor/AlbumCoverMenu.qml 2015-02-17 12:23:03 +0000
4@@ -1,5 +1,5 @@
5 /*
6- * Copyright (C) 2012 Canonical Ltd
7+ * Copyright (C) 2012-2015 Canonical Ltd
8 *
9 * This program is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 3 as
11@@ -41,7 +41,7 @@
12 model: AlbumCoverList {}
13
14 delegate: ListItem.Standard {
15- objectName: "albumCoverMenuItem"
16+ objectName: "albumCoverMenuItem_" + coverName
17 text: title
18 icon: Qt.resolvedUrl(iconFilename)
19 onClicked: {
20
21=== modified file 'rc/qml/MainScreen.qml'
22--- rc/qml/MainScreen.qml 2015-02-09 18:26:03 +0000
23+++ rc/qml/MainScreen.qml 2015-02-17 12:23:03 +0000
24@@ -1,5 +1,5 @@
25 /*
26- * Copyright (C) 2012 Canonical Ltd
27+ * Copyright (C) 2012-2015 Canonical Ltd
28 *
29 * This program is free software: you can redistribute it and/or modify
30 * it under the terms of the GNU General Public License version 3 as
31@@ -73,14 +73,17 @@
32 }
33 }
34
35- function setHeaderVisibility(visible)
36+ function setHeaderVisibility(visible, toggleFullscreen)
37 {
38- header.visible = visible;
39+ toggleFullscreen = typeof toggleFullscreen !== 'undefined' ? toggleFullscreen : true
40+ header.visible = visible;
41+ if (!APP.desktopMode && toggleFullscreen)
42+ setFullScreen(!visible);
43 }
44
45 function toggleHeaderVisibility()
46 {
47- setHeaderVisibility(!header.visible);
48+ setHeaderVisibility(!header.visible);
49 }
50
51 Component.onCompleted: {
52
53=== modified file 'rc/qml/MediaViewer/MediaViewer.qml'
54--- rc/qml/MediaViewer/MediaViewer.qml 2015-02-02 18:54:14 +0000
55+++ rc/qml/MediaViewer/MediaViewer.qml 2015-02-17 12:23:03 +0000
56@@ -1,5 +1,5 @@
57 /*
58- * Copyright (C) 2011-2012 Canonical Ltd
59+ * Copyright (C) 2011-2015 Canonical Ltd
60 *
61 * This program is free software: you can redistribute it and/or modify
62 * it under the terms of the GNU General Public License version 3 as
63@@ -186,7 +186,7 @@
64 anchors.fill: parent
65 visible: false
66
67- onVisibleChanged: overview.setHeaderVisibility(!visible)
68+ onVisibleChanged: overview.setHeaderVisibility(!visible, false)
69
70 ContentPeerPicker {
71 objectName: "sharePicker"
72
73=== modified file 'rc/qml/OrganicView/OrganicItemInteraction.qml'
74--- rc/qml/OrganicView/OrganicItemInteraction.qml 2015-02-09 18:26:03 +0000
75+++ rc/qml/OrganicView/OrganicItemInteraction.qml 2015-02-17 12:23:03 +0000
76@@ -53,6 +53,7 @@
77
78 Rectangle {
79 id: selectionRectangle
80+ objectName: "selectionCheckbox"
81 anchors {
82 top: parent.top
83 right: parent.right
84
85=== modified file 'tests/autopilot/gallery_app/emulators/album_editor.py'
86--- tests/autopilot/gallery_app/emulators/album_editor.py 2014-05-20 16:20:32 +0000
87+++ tests/autopilot/gallery_app/emulators/album_editor.py 2015-02-17 12:23:03 +0000
88@@ -1,5 +1,5 @@
89 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
90-# Copyright 2013 Canonical
91+# Copyright 2013-2015 Canonical
92 #
93 # This program is free software: you can redistribute it and/or modify it
94 # under the terms of the GNU General Public License version 3, as published
95@@ -63,5 +63,5 @@
96 def _plus_icon(self):
97 """Returns the plus icon to add photos"""
98 return self.wait_select_single("QQuickImage",
99- objectName="albumCoverAddPhotosImage",
100- visible=True)
101+ objectName="albumCoverAddPhotosImage",
102+ visible=True)
103
104=== modified file 'tests/autopilot/gallery_app/emulators/album_view.py'
105--- tests/autopilot/gallery_app/emulators/album_view.py 2015-02-10 15:29:23 +0000
106+++ tests/autopilot/gallery_app/emulators/album_view.py 2015-02-17 12:23:03 +0000
107@@ -1,5 +1,5 @@
108 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
109-# Copyright 2013 Canonical
110+# Copyright 2013-2015 Canonical
111 #
112 # This program is free software: you can redistribute it and/or modify it
113 # under the terms of the GNU General Public License version 3, as published
114@@ -135,9 +135,9 @@
115
116 def _get_remove_from_album_dialog(self):
117 """Returns the photo viewer remove from album dialog."""
118- return self.app.wait_select_single("Dialog",
119- objectName=
120- "removePhotoFromAlbumDialog")
121+ return self.app.wait_select_single(
122+ "Dialog",
123+ objectName="removePhotoFromAlbumDialog")
124
125 def _remove_from_album_dialog_shown(self):
126 dialog = self.app.select_many("Dialog",
127@@ -152,10 +152,10 @@
128
129 def _get_remove_from_album_popover_delete_item(self):
130 """Returns delete button of the remove from album popover."""
131- return self.app.select_single("Button",
132- objectName=
133- "removeFromAlbumAndDeleteButton",
134- visible=True)
135+ return self.app.select_single(
136+ "Button",
137+ objectName="removeFromAlbumAndDeleteButton",
138+ visible=True)
139
140 def _get_remove_from_album_popover_cancel_item(self):
141 """Returns cancel button of the remove from album popover."""
142
143=== modified file 'tests/autopilot/gallery_app/emulators/gallery_utils.py'
144--- tests/autopilot/gallery_app/emulators/gallery_utils.py 2014-08-31 06:36:37 +0000
145+++ tests/autopilot/gallery_app/emulators/gallery_utils.py 2015-02-17 12:23:03 +0000
146@@ -1,5 +1,5 @@
147 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
148-# Copyright 2013 Canonical
149+# Copyright 2013-2015 Canonical
150 #
151 # This program is free software: you can redistribute it and/or modify it
152 # under the terms of the GNU General Public License version 3, as published
153@@ -100,16 +100,15 @@
154 return self.app.select_single("Standard",
155 objectName="editAlbumListItem")
156
157- def get_cover_menu_item(self, text):
158- """Returns the item of the cover menu with the text *text*
159+ def get_cover_menu_item(self, name):
160+ """Returns the item of the cover menu with the name *name*
161
162- :raises StateNotFoundError: if there is no item with the text *text*
163+ :raises StateNotFoundError: if there is no item with the name *name*
164
165 """
166 return self.app.select_single(
167 "Standard",
168- objectName="albumCoverMenuItem",
169- text=text
170+ objectName="albumCoverMenuItem_" + name
171 )
172
173 def _ensure_delete_dialog_visible(self):
174
175=== modified file 'tests/autopilot/gallery_app/emulators/photo_viewer.py'
176--- tests/autopilot/gallery_app/emulators/photo_viewer.py 2015-02-11 09:58:10 +0000
177+++ tests/autopilot/gallery_app/emulators/photo_viewer.py 2015-02-17 12:23:03 +0000
178@@ -1,5 +1,5 @@
179 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
180-# Copyright 2012 Canonical
181+# Copyright 2012-2015 Canonical
182 #
183 # This program is free software: you can redistribute it and/or modify it
184 # under the terms of the GNU General Public License version 3, as published
185@@ -31,9 +31,10 @@
186
187 def get_content_peer_picker_cancel_button(self):
188 """Returns the ContentPeerPicker cancel button."""
189- return self.get_share_peer_picker().wait_select_single("Button",
190- objectName="contentPeerPickerCancelButton",
191- visible=True)
192+ return self.get_share_peer_picker().wait_select_single(
193+ "Button",
194+ objectName="contentPeerPickerCancelButton",
195+ visible=True)
196
197 def get_share_peer_picker(self):
198 """Returns the photo viewer share picker."""
199
200=== modified file 'tests/autopilot/gallery_app/emulators/picker_screen.py'
201--- tests/autopilot/gallery_app/emulators/picker_screen.py 2014-08-29 01:49:24 +0000
202+++ tests/autopilot/gallery_app/emulators/picker_screen.py 2015-02-17 12:23:03 +0000
203@@ -1,5 +1,5 @@
204 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
205-# Copyright 2012 Canonical
206+# Copyright 2012-2015 Canonical
207 #
208 # This program is free software: you can redistribute it and/or modify it
209 # under the terms of the GNU General Public License version 3, as published
210@@ -44,12 +44,6 @@
211 """Click on the pick button"""
212 self.pointing_device.click_object(self.pick_button())
213
214- def select_photo(self, photo_name):
215- """Go to the photos view and pick the named photo"""
216- photos_page = self.go_to_photos()
217- photos_page.click_named_photo(photo_name)
218- self.click_pick_button()
219-
220
221 class Page11(PickerScreen):
222 """Class to represent photos page view from picker screen"""
223@@ -63,7 +57,8 @@
224 'QQuickImage', source=photo_name)
225 return photo_element.get_parent()
226
227- def click_named_photo(self, photo_name):
228+ def select_named_photo(self, photo_name):
229 """Select the named photo from the picker view."""
230 photo_element = self._get_named_photo_element(photo_name)
231- self.pointing_device.click_object(photo_element)
232+ checkbox = photo_element.select_single(objectName="selectionCheckbox")
233+ self.pointing_device.click_object(checkbox)
234
235=== modified file 'tests/autopilot/gallery_app/tests/test_album_editor.py'
236--- tests/autopilot/gallery_app/tests/test_album_editor.py 2014-09-01 18:24:23 +0000
237+++ tests/autopilot/gallery_app/tests/test_album_editor.py 2015-02-17 12:23:03 +0000
238@@ -1,5 +1,5 @@
239 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
240-# Copyright 2012 Canonical
241+# Copyright 2012-2015 Canonical
242 #
243 # This program is free software: you can redistribute it and/or modify it
244 # under the terms of the GNU General Public License version 3, as published
245@@ -18,6 +18,7 @@
246
247 from time import sleep
248
249+
250 class TestAlbumEditor(GalleryTestCase):
251 """Tests the album editor of the gallery app"""
252
253@@ -61,8 +62,8 @@
254 self.keyboard.press_and_release("Ctrl+a")
255 text = "Photos"
256 self.keyboard.type(text)
257- #due to some reason the album title is not updated unless it loses the
258- #focus. So we click on the subtitle field.
259+ # due to some reason the album title is not updated unless it loses the
260+ # focus. So we click on the subtitle field.
261 editor.click_subtitle_field()
262 self.assertThat(subtitle_field.activeFocus, Eventually(Equals(True)))
263 self.assertThat(title_field.text, Eventually(Equals(text)))
264@@ -93,7 +94,7 @@
265 # should click away of any photo to toggle header
266 photo = self.album_view.get_first_photo()
267 x, y, w, h = photo.globalRect
268- self.pointing_device.move(x + 40 , y + h + 40)
269+ self.pointing_device.move(x + 40, y + h + 40)
270 self.pointing_device.click()
271
272 self.main_view.get_header().click_custom_back_button()
273@@ -106,7 +107,8 @@
274 self.media_selector.ensure_fully_open()
275
276 photo = self.media_selector.get_second_photo()
277- self.click_item(photo)
278+ checkbox = photo.select_single(objectName="selectionCheckbox")
279+ self.click_item(checkbox)
280 self.main_view.get_header().click_action_button("addButton")
281 editor = self.app.select_single(album_editor.AlbumEditor)
282 editor.ensure_fully_closed()
283@@ -129,7 +131,7 @@
284 self.pointing_device.move(x + int(w / 2), y + h - int(h / 10))
285 self.pointing_device.click()
286
287- green_item = self.gallery_utils.get_cover_menu_item("Green")
288+ green_item = self.gallery_utils.get_cover_menu_item("green")
289 self.click_item(green_item)
290
291 self.assertThat(lambda: cover_image.source.endswith(
292
293=== modified file 'tests/autopilot/gallery_app/tests/test_album_view.py'
294--- tests/autopilot/gallery_app/tests/test_album_view.py 2015-02-09 15:38:00 +0000
295+++ tests/autopilot/gallery_app/tests/test_album_view.py 2015-02-17 12:23:03 +0000
296@@ -1,5 +1,5 @@
297 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
298-# Copyright 2013 Canonical
299+# Copyright 2013-2015 Canonical
300 #
301 # This program is free software: you can redistribute it and/or modify it
302 # under the terms of the GNU General Public License version 3, as published
303@@ -84,7 +84,7 @@
304 # should click away of any photo to toggle header
305 photo = self.album_view.get_first_photo()
306 x, y, w, h = photo.globalRect
307- self.pointing_device.move(x + 40 , y + h + 40)
308+ self.pointing_device.move(x + 40, y + h + 40)
309 self.pointing_device.click()
310
311 # open media selector but cancel
312@@ -102,7 +102,8 @@
313 self.media_selector.ensure_fully_open()
314
315 photo = self.media_selector.get_second_photo()
316- self.click_item(photo)
317+ checkbox = photo.select_single(objectName="selectionCheckbox")
318+ self.click_item(checkbox)
319 self.main_view.get_header().click_action_button("addButton")
320
321 self.assertThat(
322@@ -193,7 +194,8 @@
323 self.media_selector.ensure_fully_open()
324
325 photo = self.media_selector.get_second_photo()
326- self.click_item(photo)
327+ checkbox = photo.select_single(objectName="selectionCheckbox")
328+ self.click_item(checkbox)
329 self.main_view.get_header().click_action_button("addButton")
330
331 self.open_first_album()
332
333=== modified file 'tests/autopilot/gallery_app/tests/test_albums_view.py'
334--- tests/autopilot/gallery_app/tests/test_albums_view.py 2015-02-09 17:03:59 +0000
335+++ tests/autopilot/gallery_app/tests/test_albums_view.py 2015-02-17 12:23:03 +0000
336@@ -1,5 +1,5 @@
337 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
338-# Copyright 2013 Canonical
339+# Copyright 2013-2015 Canonical
340 #
341 # This program is free software: you can redistribute it and/or modify it
342 # under the terms of the GNU General Public License version 3, as published
343@@ -76,7 +76,8 @@
344 self.click_item(plus)
345 self.media_selector.ensure_fully_open()
346 photo = self.media_selector.get_second_photo()
347- self.click_item(photo)
348+ checkbox = photo.select_single(objectName="selectionCheckbox")
349+ self.click_item(checkbox)
350 self.main_view.get_header().click_action_button("addButton")
351
352 self.assertThat(
353@@ -85,8 +86,8 @@
354 )
355
356 def test_add_album_and_cancel(self):
357- """Add one album, cancel it and checks if the number of albums does
358- not change. Do this in the two different ways we have to cancel editing.
359+ """Add one album, cancel it and checks if the number of albums does not
360+ change. Do this in the two different ways we have to cancel editing.
361 """
362
363 # Cancel by pressing back in the header
364
365=== modified file 'tests/autopilot/gallery_app/tests/test_photo_viewer.py'
366--- tests/autopilot/gallery_app/tests/test_photo_viewer.py 2015-02-11 09:58:10 +0000
367+++ tests/autopilot/gallery_app/tests/test_photo_viewer.py 2015-02-17 12:23:03 +0000
368@@ -1,5 +1,5 @@
369 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
370-# Copyright 2012 Canonical
371+# Copyright 2012-2015 Canonical
372 #
373 # This program is free software: you can redistribute it and/or modify it
374 # under the terms of the GNU General Public License version 3, as published
375@@ -112,7 +112,8 @@
376 self.main_view.get_header().click_action_button("shareButton")
377 share_picker = self.photo_viewer.get_share_peer_picker()
378 self.assertThat(share_picker.visible, Eventually(Equals(True)))
379- cancel_button = self.photo_viewer.get_content_peer_picker_cancel_button()
380+ cancel_button = \
381+ self.photo_viewer.get_content_peer_picker_cancel_button()
382 self.click_item(cancel_button)
383 self.assertThat(share_picker.visible, Eventually(Equals(False)))
384
385
386=== modified file 'tests/autopilot/gallery_app/tests/test_photos_view.py'
387--- tests/autopilot/gallery_app/tests/test_photos_view.py 2014-08-26 21:54:25 +0000
388+++ tests/autopilot/gallery_app/tests/test_photos_view.py 2015-02-17 12:23:03 +0000
389@@ -1,5 +1,5 @@
390 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
391-# Copyright 2012 Canonical
392+# Copyright 2012-2015 Canonical
393 #
394 # This program is free software: you can redistribute it and/or modify it
395 # under the terms of the GNU General Public License version 3, as published
396@@ -57,6 +57,11 @@
397 photo = self.photos_view.get_first_photo_in_photos_view()
398 self.click_item(photo)
399
400+ def select_first_photo(self):
401+ photo = self.photos_view.get_first_photo_in_photos_view()
402+ checkbox = photo.select_single(objectName="selectionCheckbox")
403+ self.click_item(checkbox)
404+
405 def check_header_button_exist(self, button):
406 header = self.main_view.get_header()
407 buttonName = button + "_header_button"
408@@ -92,7 +97,7 @@
409 def test_delete_photo_dialog_appears(self):
410 """Selecting a photo must make the delete button clickable."""
411 self.main_view.get_header().click_action_button("selectButton")
412- self.click_first_photo()
413+ self.select_first_photo()
414 self.main_view.get_header().click_action_button("deleteButton")
415
416 self.assertThat(self.gallery_utils.delete_dialog_shown,
417@@ -107,7 +112,7 @@
418 """Must be able to select a photo and use the dialog to delete it."""
419 number_of_photos = self.photos_view.number_of_photos()
420 self.main_view.get_header().click_action_button("selectButton")
421- self.click_first_photo()
422+ self.select_first_photo()
423 self.main_view.get_header().click_action_button("deleteButton")
424
425 self.assertThat(self.gallery_utils.delete_dialog_shown,
426
427=== modified file 'tests/autopilot/gallery_app/tests/test_picker_mode.py'
428--- tests/autopilot/gallery_app/tests/test_picker_mode.py 2015-02-09 17:32:27 +0000
429+++ tests/autopilot/gallery_app/tests/test_picker_mode.py 2015-02-17 12:23:03 +0000
430@@ -1,5 +1,5 @@
431 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
432-# Copyright 2013 Canonical
433+# Copyright 2013-2015 Canonical
434 #
435 # This program is free software: you can redistribute it and/or modify it
436 # under the terms of the GNU General Public License version 3, as published
437@@ -28,7 +28,8 @@
438
439 def select_first_event_media(self):
440 first_media = self.picker_view.first_media_in_events_view()
441- self.click_item(first_media)
442+ checkbox = first_media.select_single(objectName="selectionCheckbox")
443+ self.click_item(checkbox)
444
445 def select_first_grid_media(self):
446 first_media = self.picker_view.first_media_in_events_view()
447@@ -71,7 +72,7 @@
448 # create the image location path based on sample location
449 image_path = 'image://thumbnailer/{}/sample02.jpg'.format(
450 self.sample_destination_dir)
451- photos_page.click_named_photo(image_path)
452+ photos_page.select_named_photo(image_path)
453 self.assertThat(pick_button.enabled, Eventually(Equals(True)))
454 self.picker_view.click_pick_button()
455

Subscribers

People subscribed via source and target branches