Merge lp:~dpniel/ubuntu-autopilot-tests/eye-of-gnome into lp:ubuntu-autopilot-tests

Proposed by Dan Chapman 
Status: Merged
Merge reported by: Dan Chapman 
Merged at revision: not available
Proposed branch: lp:~dpniel/ubuntu-autopilot-tests/eye-of-gnome
Merge into: lp:ubuntu-autopilot-tests
Diff against target: 130 lines (+114/-0)
1 file modified
ubuntu_autopilot_tests/eog/test_eog.py (+114/-0)
To merge this branch: bzr merge lp:~dpniel/ubuntu-autopilot-tests/eye-of-gnome
Reviewer Review Type Date Requested Status
Nicholas Skaggs (community) Approve
Review via email: mp+174172@code.launchpad.net

Description of the change

Created test for eog.

Testing:

1) image load
2) zoom in and out
3) can move to previous and next images
4) can rotate

To post a comment you must log in.
Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

This looks good Dan :-) I'll trust that everything runs just fine on your box, etc. Any issues with zooming steps changing on us you think?

review: Approve
Revision history for this message
Dan Chapman  (dpniel) wrote :

I dont think the zoom steps will be an issue. As it is uses the same image and at the start of the test it is set to normal size (100%). When normal size is set it seems that it always zooms in by 100% eachtime. I will keep an eye on it and see if it presents any issues.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'ubuntu_autopilot_tests/eog'
2=== added file 'ubuntu_autopilot_tests/eog/__init__.py'
3=== added directory 'ubuntu_autopilot_tests/eog/img'
4=== added file 'ubuntu_autopilot_tests/eog/img/logo-ubuntu_cof-orange-hex.png'
5Binary files ubuntu_autopilot_tests/eog/img/logo-ubuntu_cof-orange-hex.png 1970-01-01 00:00:00 +0000 and ubuntu_autopilot_tests/eog/img/logo-ubuntu_cof-orange-hex.png 2013-07-11 11:31:47 +0000 differ
6=== added file 'ubuntu_autopilot_tests/eog/img/logo-ubuntu_st_no-black_orange-hex.jpg'
7Binary files ubuntu_autopilot_tests/eog/img/logo-ubuntu_st_no-black_orange-hex.jpg 1970-01-01 00:00:00 +0000 and ubuntu_autopilot_tests/eog/img/logo-ubuntu_st_no-black_orange-hex.jpg 2013-07-11 11:31:47 +0000 differ
8=== added file 'ubuntu_autopilot_tests/eog/img/logo-ubuntu_st_no-white_orangecof-hex.png'
9Binary files ubuntu_autopilot_tests/eog/img/logo-ubuntu_st_no-white_orangecof-hex.png 1970-01-01 00:00:00 +0000 and ubuntu_autopilot_tests/eog/img/logo-ubuntu_st_no-white_orangecof-hex.png 2013-07-11 11:31:47 +0000 differ
10=== added file 'ubuntu_autopilot_tests/eog/img/logo-ubuntu_su-orange-hex.jpg'
11Binary files ubuntu_autopilot_tests/eog/img/logo-ubuntu_su-orange-hex.jpg 1970-01-01 00:00:00 +0000 and ubuntu_autopilot_tests/eog/img/logo-ubuntu_su-orange-hex.jpg 2013-07-11 11:31:47 +0000 differ
12=== added file 'ubuntu_autopilot_tests/eog/test_eog.py'
13--- ubuntu_autopilot_tests/eog/test_eog.py 1970-01-01 00:00:00 +0000
14+++ ubuntu_autopilot_tests/eog/test_eog.py 2013-07-11 11:31:47 +0000
15@@ -0,0 +1,114 @@
16+import os
17+from autopilot.testcase import AutopilotTestCase
18+from autopilot.matchers import Eventually
19+from testtools.matchers import Equals, Contains, NotEquals
20+from autopilot.input import Mouse, Touch, Pointer
21+
22+
23+
24+class EogTests(AutopilotTestCase):
25+
26+ def setUp(self):
27+ super(EogTests, self).setUp()
28+
29+ image_name = 'logo-ubuntu_su-orange-hex.jpg'
30+ for root, dirs, files in os.walk(os.getcwd()):
31+ for name in files:
32+ if name == image_name:
33+ img_path = os.path.abspath(os.path.join(root, name))
34+ #Lets auto load the image as we dn't have access to the global menu
35+ self.app = self.launch_test_application('eog', img_path)
36+
37+ self.pointing_device = Pointer(Mouse.create())
38+ self.get_eog_objects()
39+
40+ def test_display_image(self):
41+ #check that the image loaded
42+ self.assertThat(self.eog_window.title,
43+ Eventually(Contains('logo-ubuntu_su-orange-hex.jpg')))
44+
45+ def test_zoom_image(self):
46+ self.pointing_device.move_to_object(self.normal_size_button)
47+ self.pointing_device.click()
48+ self.assertThat(self.status_label.label, Eventually(Contains('100%')))
49+
50+ self.pointing_device.move_to_object(self.zoom_in_button)
51+ self.pointing_device.click()
52+ self.assertThat(self.status_label.label, Eventually(Contains('200%')))
53+
54+ self.pointing_device.move_to_object(self.zoom_out_button)
55+ self.pointing_device.click()
56+ self.assertThat(self.status_label.label, Eventually(Contains('100%')))
57+
58+ def test_show_prev_and_next_images(self):
59+
60+ self.pointing_device.move_to_object(self.previous_button)
61+ self.pointing_device.click()
62+ self.assertThat(self.eog_window.title,
63+ Eventually(Contains('logo-ubuntu_st_no-white_orangecof-hex')))
64+ self.pointing_device.click()
65+ self.assertThat(self.eog_window.title,
66+ Eventually(Contains('logo-ubuntu_st_no-black_orange-hex')))
67+
68+ self.pointing_device.click()
69+ self.assertThat(self.eog_window.title,
70+ Eventually(Contains('logo-ubuntu_cof-orange-hex')))
71+ #test we can go forward
72+ self.pointing_device.move_to_object(self.next_button)
73+ self.pointing_device.click()
74+ self.assertThat(self.eog_window.title,
75+ Eventually(Contains('logo-ubuntu_st_no-black_orange-hex')))
76+ self.pointing_device.click()
77+ self.assertThat(self.eog_window.title,
78+ Eventually(Contains('logo-ubuntu_st_no-white_orangecof-hex')))
79+ self.pointing_device.click()
80+ self.assertThat(self.eog_window.title,
81+ Eventually(Contains('logo-ubuntu_su-orange-hex.jpg')))
82+
83+ def test_rotate_image(self):
84+ self.pointing_device.move_to_object(self.normal_size_button)
85+ self.assertThat(self.status_label.label, Contains('64 pixels'))
86+
87+ self.pointing_device.move_to_object(self.rotate_left_button)
88+ self.pointing_device.click()
89+
90+ self.assertThat(self.status_label.label, Eventually(Contains('284 pixels')))
91+
92+ self.pointing_device.move_to_object(self.rotate_right_button)
93+ self.pointing_device.click()
94+
95+ self.assertThat(self.status_label.label, Eventually(Contains('64 pixels')))
96+
97+ def get_eog_objects(self):
98+ #----------------------------------------------------------------#
99+ # EOG WINDOW OBJECT #
100+ # #
101+ self.eog_window = self.app.select_single('EogWindow')
102+ #----------------------------------------------------------------#
103+ # EOG TOOLBAR OBJECTS #
104+ # #
105+ self.eog_toolbar = self.eog_window.select_single('EggEditableToolbar')
106+ self.previous_button = self.eog_toolbar.select_single('GtkLabel',
107+ label='Previous')
108+ self.next_button = self.eog_toolbar.select_single('GtkLabel',
109+ label='Next')
110+ self.zoom_in_button = self.eog_toolbar.select_single('GtkToolButton',
111+ label='In')
112+ self.zoom_out_button = self.eog_toolbar.select_single('GtkToolButton',
113+ label='Out')
114+ self.normal_size_button = self.eog_toolbar.select_single('GtkToolButton',
115+ label='Normal')
116+ self.fit_window_button = self.eog_toolbar.select_single('GtkToolButton',
117+ label='Fit')
118+ self.rotate_left_button = self.eog_toolbar.select_single('GtkToolButton',
119+ label='Left')
120+ self.rotate_right_button = self.eog_toolbar.select_single('GtkToolButton',
121+ label='Right')
122+
123+ #-----------------------------------------------------------------#
124+ # EOG STATUS BAR OBJECTS #
125+ # #
126+ self.eog_statusbar = self.eog_window.select_single('EogStatusbar')
127+ self.statusbar_frame = self.eog_statusbar.select_single('GtkFrame')
128+ self.status_label = self.statusbar_frame.select_single('GtkLabel')
129+
130\ No newline at end of file

Subscribers

People subscribed via source and target branches