22
23
class TestPhotosView(GalleryTestCase):
26
def photos_view(self):
27
return PhotosView(self.app)
25
30
super(TestPhotosView, self).setUp()
26
self.assertThat(self.photo_viewer.get_qml_view().visible, Eventually(Equals(True)))
29
self.click_photos_tab_button()
31
photos_view = self.photos_view.get_photos_view()
32
self.assertThat(photos_view.focus, Eventually(Equals(True)))
36
def click_tabs_bar(self):
31
self.switch_to_photos_tab()
34
def switch_to_photos_tab(self):
37
35
tabs_bar = self.photos_view.get_tabs_bar()
38
36
self.click_item(tabs_bar)
40
def click_photos_tab_button(self):
41
photos_tab_button = self.app.select_single("AbstractButton", buttonIndex=5)
38
photos_tab_button = self.photos_view.get_photos_tab_button()
43
39
#Due to some timing issues sometimes mouse moves to the location a bit earlier
44
40
#even though the tab item is not fully visible, hence the tab does not activate.
45
41
self.assertThat(photos_tab_button.opacity, Eventually(GreaterThan(0.2)))
42
self.click_item(photos_tab_button)
47
photos_tab = self.photos_view.get_photos_tab()
48
self.click_item(photos_tab)
44
photos_view = self.photos_view.get_photos_view()
45
self.assertThat(photos_view.focus, Eventually(Equals(True)))
50
47
def enable_select_mode(self):
51
self.reveal_tool_bar()
52
49
self.click_select_icon()
54
51
def click_select_icon(self):
55
select_icon = self.photos_view.get_select_icon()
52
select_icon = self.photos_view.get_toolbar_select_button()
56
53
self.click_item(select_icon)
58
55
def click_first_photo(self):
72
69
def test_select_button_cancel(self):
73
70
"""Clicking the cancel button after clicking the select button must
74
hide the chromebar automatically."""
71
hide the toolbar automatically."""
75
72
self.enable_select_mode()
77
cancel_icon = self.photos_view.get_cancel_icon()
74
cancel_icon = self.photos_view.get_toolbar_cancel_icon()
78
75
self.click_item(cancel_icon)
80
toolbar = self.photos_view.get_tool_bar()
77
toolbar = self.photos_view.get_toolbar()
81
78
self.assertThat(toolbar.active, Eventually(Equals(False)))
83
80
def test_delete_a_photo(self):