Merge lp:~rhuddie/gallery-app/photo_selector into lp:gallery-app

Proposed by Richard Huddie
Status: Merged
Merged at revision: 958
Proposed branch: lp:~rhuddie/gallery-app/photo_selector
Merge into: lp:gallery-app
Diff against target: 45 lines (+27/-0)
2 files modified
tests/autopilot/gallery_app/emulators/picker_screen.py (+13/-0)
tests/autopilot/gallery_app/tests/test_picker_mode.py (+14/-0)
To merge this branch: bzr merge lp:~rhuddie/gallery-app/photo_selector
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Arthur Mello (community) Approve
Leo Arias (community) code review Approve
VĂ­ctor R. Ruiz Pending
Javier Collado Pending
Review via email: mp+208761@code.launchpad.net

Commit message

A new emulator method for selecting a specific photo from the picker view. A new test is also added to use this method and then click on the Pick button.

Description of the change

A new emulator method for selecting a specific photo from the picker view. A new test is also added to use this method and then click on the Pick button.

To post a comment you must log in.
Revision history for this message
Leo Arias (elopio) wrote :

Please:
- change the double quotes on strings to single quotes.
- change "Returns" to "Return", and finish your sentences with a period as per pep257.
- add information about the return type on get_named_photo

And I've seen one more detail that will help hiding the implementation details a little, which might be usefule in case of an implementation detail.

Make get_named_photo private, naming it something like _get_named_photo_element()

And make a new public method

def select_photo(self, name):
   photo_element = self.picker_view.get_named_photo(
      'image://gallery-thumbnail//tmp/gallery-ap_sd/new_user.png')
   self.pointing_device.click_object(photo)

review: Needs Fixing (code review)
922. By Richard Huddie

fix review comments

Revision history for this message
Leo Arias (elopio) :
review: Approve (code review)
923. By Richard Huddie

merge from trunk

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

update image path to use thumbnailer

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

renamed test data file

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

changed test to use existing sample file

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

use wait_select_single for selecting QQuickImage item

928. By Richard Huddie

merge from trunk

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

creat file path based on sample dir

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Arthur Mello (artmello) :
review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Richard Huddie (rhuddie) wrote :

Are there any related MPs required for this MP to build/function as expected? Please list
No

Is your branch in sync with latest trunk (e.g. bzr pull lp:trunk -> no changes)
Yes

Did you perform an exploratory manual test run of your code change and any related functionality on device or emulator?
Yes - mako

Did you successfully run all tests found in your component's Test Plan (https://wiki.ubuntu.com/Process/Merges/TestPlan/gallery-app) on device or emulator?
Yes - mako

If you changed the UI, was the change specified/approved by design?
No UI changes. - Test code changes only

If you changed the packaging (debian), did you subscribe a core-dev to this MP?
No packaging changes.

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/autopilot/gallery_app/emulators/picker_screen.py'
2--- tests/autopilot/gallery_app/emulators/picker_screen.py 2013-08-19 13:58:55 +0000
3+++ tests/autopilot/gallery_app/emulators/picker_screen.py 2014-04-09 10:34:08 +0000
4@@ -32,3 +32,16 @@
5 grid_view = self.grid_view()
6 return grid_view.select_many("OrganicItemInteraction")[0]
7
8+ def _get_named_photo_element(self, photo_name):
9+ """
10+ Return the ShapeItem container object for the named photo.
11+ This object can be clicked to enable the photo to be selected.
12+ """
13+ photo_element = self.grid_view().wait_select_single('QQuickImage',
14+ source=photo_name)
15+ return photo_element.get_parent()
16+
17+ def select_named_photo(self, photo_name):
18+ """Select the named photo from the picker view."""
19+ photo_element = self._get_named_photo_element(photo_name)
20+ self.pointing_device.click_object(photo_element)
21
22=== modified file 'tests/autopilot/gallery_app/tests/test_picker_mode.py'
23--- tests/autopilot/gallery_app/tests/test_picker_mode.py 2014-04-08 16:47:21 +0000
24+++ tests/autopilot/gallery_app/tests/test_picker_mode.py 2014-04-09 10:34:08 +0000
25@@ -55,6 +55,20 @@
26 self.assertThat(pick_button.enabled, Eventually(Equals(False)))
27 self.assertThat(first_events_media.isSelected, Eventually(Equals(False)))
28
29+ def test_pick_named_photo(self):
30+ """Select a named photo and press Pick button."""
31+ self.picker_view.switch_to_tab('photosTab')
32+ pick_button = self.picker_view.pick_button()
33+ self.assertFalse(pick_button.enabled)
34+
35+ # create the image location path based on sample location
36+ image_path = 'image://thumbnailer/{}/sample02.jpg'.format(
37+ self.sample_destination_dir)
38+ self.picker_view.select_named_photo(image_path)
39+
40+ self.assertTrue(pick_button.enabled)
41+ self.click_item(pick_button)
42+
43 @unittest.skip("Temporarily disable as it fails in some cases, supposedly due to problems with the infrastructure")
44 def test_selection_synchronisation(self):
45 """Checks if the selection is the same for both views"""

Subscribers

People subscribed via source and target branches