Merge lp:~schwann/gallery-app/gallery-atest-tap-select into lp:gallery-app

Proposed by Günter Schwann
Status: Merged
Approved by: Ugo Riboni
Approved revision: 817
Merged at revision: 818
Proposed branch: lp:~schwann/gallery-app/gallery-atest-tap-select
Merge into: lp:gallery-app
Diff against target: 217 lines (+42/-61)
6 files modified
tests/autopilot/gallery_app/emulators/gallery_utils.py (+0/-8)
tests/autopilot/gallery_app/emulators/photos_view.py (+0/-8)
tests/autopilot/gallery_app/emulators/picker_screen.py (+8/-11)
tests/autopilot/gallery_app/tests/test_events_view.py (+4/-0)
tests/autopilot/gallery_app/tests/test_photos_view.py (+9/-0)
tests/autopilot/gallery_app/tests/test_picker_mode.py (+21/-34)
To merge this branch: bzr merge lp:~schwann/gallery-app/gallery-atest-tap-select
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Ubuntu Phablet Team Pending
Review via email: mp+180877@code.launchpad.net

Commit message

* cleanups for the autopilot tests
* test if long press on media switches to select mode

To post a comment you must log in.
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
=== modified file 'tests/autopilot/gallery_app/emulators/gallery_utils.py'
--- tests/autopilot/gallery_app/emulators/gallery_utils.py 2013-08-09 10:20:19 +0000
+++ tests/autopilot/gallery_app/emulators/gallery_utils.py 2013-08-19 14:00:17 +0000
@@ -60,14 +60,6 @@
60 return self.app.select_single("QQuickLoader",60 return self.app.select_single("QQuickLoader",
61 objectName="albumsCheckerboardLoader")61 objectName="albumsCheckerboardLoader")
6262
63 def get_tabs_bar(self):
64 """Returns the top tabs bar."""
65 return self.app.select_single("TabBar")
66
67 def get_albums_tab_button(self):
68 """Returns the photos tab."""
69 return self.app.select_single("AbstractButton", buttonIndex=0)
70
71 def get_delete_dialog(self):63 def get_delete_dialog(self):
72 """Returns the delete dialog in the events view."""64 """Returns the delete dialog in the events view."""
73 return self.select_single_retry("DeleteDialog",65 return self.select_single_retry("DeleteDialog",
7466
=== modified file 'tests/autopilot/gallery_app/emulators/photos_view.py'
--- tests/autopilot/gallery_app/emulators/photos_view.py 2013-08-12 15:33:20 +0000
+++ tests/autopilot/gallery_app/emulators/photos_view.py 2013-08-19 14:00:17 +0000
@@ -13,14 +13,6 @@
13 def __init__(self, app):13 def __init__(self, app):
14 self.app = app14 self.app = app
1515
16 def get_photos_tab_button(self):
17 """Returns the photos tab."""
18 return self.app.select_single("AbstractButton", buttonIndex=5)
19
20 def get_photos_view(self):
21 """Returns the photos view."""
22 return self.app.select_single("Tab", objectName="photosTab")
23
24 def get_first_photo_in_photos_view(self):16 def get_first_photo_in_photos_view(self):
25 """Returns the very first photo in the photos view."""17 """Returns the very first photo in the photos view."""
26 return self.select_many_retry("QQuickItem",18 return self.select_many_retry("QQuickItem",
2719
=== renamed file 'tests/autopilot/gallery_app/emulators/picker_mode.py' => 'tests/autopilot/gallery_app/emulators/picker_screen.py'
--- tests/autopilot/gallery_app/emulators/picker_mode.py 2013-06-26 08:59:08 +0000
+++ tests/autopilot/gallery_app/emulators/picker_screen.py 2013-08-19 14:00:17 +0000
@@ -5,23 +5,20 @@
5# under the terms of the GNU General Public License version 3, as published5# under the terms of the GNU General Public License version 3, as published
6# by the Free Software Foundation.6# by the Free Software Foundation.
77
8from gallery_utils import GalleryUtils8from ubuntuuitoolkit import emulators as toolkit_emulators
99
1010
11class PickerMode(GalleryUtils):11class PickerScreen(toolkit_emulators.MainView):
12
13 def __init__(self, app):
14 self.app = app
1512
16 def pick_button(self):13 def pick_button(self):
17 return self.app.select_single("Button", objectName="pickButton")14 return self.select_single("Button", objectName="pickButton")
1815
19 def get_photos_tab_button(self):16 def get_photos_tab_button(self):
20 """Returns the photos tab."""17 """Returns the photos tab."""
21 return self.app.select_single("AbstractButton", buttonIndex=3)18 return self.select_single("AbstractButton", buttonIndex=3)
2219
23 def events_view(self):20 def events_view(self):
24 return self.app.select_single("OrganicView", objectName="eventSelectView")21 return self.select_single("OrganicView", objectName="eventSelectView")
2522
26 def first_media_in_events_view(self):23 def first_media_in_events_view(self):
27 events_view = self.events_view()24 events_view = self.events_view()
@@ -29,7 +26,7 @@
29 objectName="eventsViewPhoto")[0]26 objectName="eventsViewPhoto")[0]
3027
31 def grid_view(self):28 def grid_view(self):
32 return self.app.select_single("MediaGrid")29 return self.select_single("MediaGrid")
3330
34 def first_media_in_grid_view(self):31 def first_media_in_grid_view(self):
35 grid_view = self.grid_view()32 grid_view = self.grid_view()
3633
=== modified file 'tests/autopilot/gallery_app/tests/test_events_view.py'
--- tests/autopilot/gallery_app/tests/test_events_view.py 2013-08-14 14:04:39 +0000
+++ tests/autopilot/gallery_app/tests/test_events_view.py 2013-08-19 14:00:17 +0000
@@ -61,6 +61,10 @@
61 self.assertThat(toolbar.opened, Eventually(Equals(False)))61 self.assertThat(toolbar.opened, Eventually(Equals(False)))
62 self.assertFalse(events_view.inSelectionMode)62 self.assertFalse(events_view.inSelectionMode)
6363
64 first_photo = self.gallery_utils.get_first_image_in_event_view()
65 self.tap_item(first_photo)
66 self.assertTrue(events_view.inSelectionMode)
67
64 def test_delete_a_photo(self):68 def test_delete_a_photo(self):
65 """Selecting a photo must make the delete button clickable."""69 """Selecting a photo must make the delete button clickable."""
66 number_of_photos = self.gallery_utils.number_of_photos_in_events()70 number_of_photos = self.gallery_utils.number_of_photos_in_events()
6771
=== modified file 'tests/autopilot/gallery_app/tests/test_photos_view.py'
--- tests/autopilot/gallery_app/tests/test_photos_view.py 2013-08-14 14:04:39 +0000
+++ tests/autopilot/gallery_app/tests/test_photos_view.py 2013-08-19 14:00:17 +0000
@@ -46,12 +46,21 @@
46 def test_select_button_cancel(self):46 def test_select_button_cancel(self):
47 """Clicking the cancel button after clicking the select button must47 """Clicking the cancel button after clicking the select button must
48 hide the toolbar automatically."""48 hide the toolbar automatically."""
49 photos_overview = self.app.select_single("PhotosOverview")
50 self.assertFalse(photos_overview.inSelectionMode)
51
49 self.main_view.open_toolbar().click_button("selectButton")52 self.main_view.open_toolbar().click_button("selectButton")
53 self.assertTrue(photos_overview.inSelectionMode)
5054
51 self.main_view.open_toolbar().click_custom_button("cancelButton")55 self.main_view.open_toolbar().click_custom_button("cancelButton")
5256
53 toolbar = self.main_view.get_toolbar()57 toolbar = self.main_view.get_toolbar()
54 self.assertThat(toolbar.active, Eventually(Equals(False)))58 self.assertThat(toolbar.active, Eventually(Equals(False)))
59 self.assertFalse(photos_overview.inSelectionMode)
60
61 first_photo = self.photos_view.get_first_photo_in_photos_view()
62 self.tap_item(first_photo)
63 self.assertTrue(photos_overview.inSelectionMode)
5564
56 def test_delete_a_photo(self):65 def test_delete_a_photo(self):
57 """Selecting a photo must make the delete button clickable."""66 """Selecting a photo must make the delete button clickable."""
5867
=== modified file 'tests/autopilot/gallery_app/tests/test_picker_mode.py'
--- tests/autopilot/gallery_app/tests/test_picker_mode.py 2013-08-08 11:42:24 +0000
+++ tests/autopilot/gallery_app/tests/test_picker_mode.py 2013-08-19 14:00:17 +0000
@@ -13,69 +13,56 @@
13from testtools.matchers import Equals, GreaterThan13from testtools.matchers import Equals, GreaterThan
14from autopilot.matchers import Eventually14from autopilot.matchers import Eventually
1515
16from gallery_app.emulators.picker_mode import PickerMode16from gallery_app.emulators.picker_screen import PickerScreen
17from gallery_app.tests import GalleryTestCase17from gallery_app.tests import GalleryTestCase
1818
1919
20class TestPickerMode(GalleryTestCase):20class TestPickerMode(GalleryTestCase):
2121
22 @property22 @property
23 def picker_mode(self):23 def picker_view(self):
24 return PickerMode(self.app)24 return self.app.select_single(PickerScreen)
2525
26 def setUp(self):26 def setUp(self):
27 self.ARGS.append("--pick-photo")27 self.ARGS.append("--pick-photo")
28 super(TestPickerMode, self).setUp()28 super(TestPickerMode, self).setUp()
29 29
30 def select_first_event_media(self):30 def select_first_event_media(self):
31 first_media = self.picker_mode.first_media_in_events_view()31 first_media = self.picker_view.first_media_in_events_view()
32 self.click_item(first_media)32 self.click_item(first_media)
33 33
34 def select_first_grid_media(self):34 def select_first_grid_media(self):
35 first_media = self.picker_mode.first_media_in_events_view()35 first_media = self.picker_view.first_media_in_events_view()
36 self.click_item(first_media)36 self.click_item(first_media)
37
38 def switch_to_grid_view(self):
39 tabs_bar = self.picker_mode.get_tabs_bar()
40 self.click_item(tabs_bar)
41 photos_tab_button = self.picker_mode.get_photos_tab_button()
42 # Due to some timing issues sometimes mouse moves to the location a bit
43 # earlier even though the tab item is not fully visible, hence the tab
44 # does not activate.
45 self.assertThat(photos_tab_button.opacity,
46 Eventually(GreaterThan(0.2)))
47 self.click_item(photos_tab_button)
48 self.ensure_tabs_dont_move()
4937
50 def test_pick_first_photo(self):38 def test_pick_first_photo(self):
51 """Check if the button enabled state follows the selection"""39 """Check if the button enabled state follows the selection"""
52 pick_button = self.picker_mode.pick_button()40 pick_button = self.picker_view.pick_button()
53 self.assertThat(pick_button.enabled, Eventually(Equals(False)))41 self.assertThat(pick_button.enabled, Eventually(Equals(False)))
54 first_events_media = self.picker_mode.first_media_in_events_view()42 first_events_media = self.picker_view.first_media_in_events_view()
55 self.assertThat(first_events_media.isSelected, Eventually(Equals(False)))43 self.assertThat(first_events_media.isSelected, Eventually(Equals(False)))
56 44
57 self.select_first_event_media()45 self.select_first_event_media()
58 46
59 pick_button = self.picker_mode.pick_button()47 pick_button = self.picker_view.pick_button()
60 self.assertThat(pick_button.enabled, Eventually(Equals(True)))48 self.assertThat(pick_button.enabled, Eventually(Equals(True)))
61 self.assertThat(first_events_media.isSelected, Eventually(Equals(True)))49 self.assertThat(first_events_media.isSelected, Eventually(Equals(True)))
62 50
63 self.select_first_event_media()51 self.select_first_event_media()
64 52
65 pick_button = self.picker_mode.pick_button()53 pick_button = self.picker_view.pick_button()
66 self.assertThat(pick_button.enabled, Eventually(Equals(False)))54 self.assertThat(pick_button.enabled, Eventually(Equals(False)))
67 self.assertThat(first_events_media.isSelected, Eventually(Equals(False)))55 self.assertThat(first_events_media.isSelected, Eventually(Equals(False)))
6856
69 def test_selection_synchronisation(self):57 def test_selection_synchronisation(self):
70 """Checks if the selection is the same for both views"""58 """Checks if the selection is the same for both views"""
71 first_events_media = self.picker_mode.first_media_in_events_view()59 first_events_media = self.picker_view.first_media_in_events_view()
72 self.assertThat(first_events_media.isSelected, Eventually(Equals(False)))60 self.assertThat(first_events_media.isSelected, Eventually(Equals(False)))
73 61
74 self.select_first_event_media()62 self.select_first_event_media()
75 self.assertThat(first_events_media.isSelected, Eventually(Equals(True)))63 self.assertThat(first_events_media.isSelected, Eventually(Equals(True)))
76 64
77 self.switch_to_grid_view()65 self.picker_view.switch_to_next_tab()
7866
79 first_grid_media = self.picker_mode.first_media_in_grid_view()67 first_grid_media = self.picker_view.first_media_in_grid_view()
80 self.assertThat(first_grid_media.isSelected, Eventually(Equals(True)))68 self.assertThat(first_grid_media.isSelected, Eventually(Equals(True)))
81

Subscribers

People subscribed via source and target branches