on xenial help sign in
Comment and docstring cleanup.
commit8f87949a70452f8505c0fc2c1fc46869b4653c74 authorChristopher Lee <chris.lee@canonical.com> dateTue 16 Jul 2013, 21:00 (13 years ago) parent54f26b9
2 files changed+31−42
tests/autopilot/unity8/shell/tests/test_hud.py+31−40 tests/autopilot/unity8/shell/tests/test_lock_screen.py−2
tests/autopilot/unity8/shell/tests/test_hud.py+31−40
@@ -5,24 +5,6 @@
55# under the terms of the GNU General Public License version 3, as published
66# by the Free Software Foundation.
77
8−
9−# This file contains general purpose test cases for Unity.
10−# Each test written in this file will be executed for a variety of
11−# configurations, such as Phone, Tablet or Desktop form factors.
12−#
13−# Sometimes there is the need to disable a certain test for a particular
14−# configuration. To do so, add this in a new line directly below your test:
15−#
16−# test_testname.blacklist = (FormFactors.Tablet, FormFactors.Desktop,)
17−#
18−# Available form factors are:
19−# FormFactors.Phone
20−# FormFactors.Tablet
21−# FormFactors.Desktop
22−
23−
24−"""Tests for the Shell"""
25−
268from __future__ import absolute_import
279
2810from collections import namedtuple
@@ -53,7 +35,7 @@ class TestHud(Unity8TestCase):
5335 hud_show_button = self.main_window.get_hud_show_button()
5436 hud = self.main_window.get_hud()
5537
56− self._launch_application_from_app_screen()
38+ self._launch_test_app_from_app_screen()
5739
5840 swipe_coords = self._get_hud_button_swipe_coords(window, hud_show_button)
5941 self.touch.press(swipe_coords.start_x, swipe_coords.start_y)
@@ -69,7 +51,7 @@ class TestHud(Unity8TestCase):
6951 hud_show_button = self.main_window.get_hud_show_button()
7052 hud = self.main_window.get_hud()
7153
72− self._launch_application_from_app_screen()
54+ self._launch_test_app_from_app_screen()
7355
7456 swipe_coords = self._get_hud_button_swipe_coords(window, hud_show_button)
7557 self.touch.press(swipe_coords.start_x, swipe_coords.start_y)
@@ -119,14 +101,11 @@ class TestHud(Unity8TestCase):
119101 self.launch_unity()
120102 self.main_window.get_greeter().unlock()
121103 hud = self.main_window.get_hud()
122− hud.show()
123104
124− self._launch_application_from_app_screen()
125−
126− rect = hud.globalRect
127− x = int(rect[0] + rect[2] / 2)
128− y = rect[1] + self.grid_size
105+ self._launch_test_app_from_app_screen()
106+ hud.show()
129107
108+ x, y = hud.get_close_button_coords(self.grid_size)
130109 self.touch.tap(x, y)
131110 self.assertThat(hud.shown, Eventually(Equals(False)))
132111
@@ -140,17 +119,25 @@ class TestHud(Unity8TestCase):
140119 # self.touch.tap(x, y)
141120 # self.assertRaises(MismatchError, lambda: self.assertThat(hud.shown, Eventually(Equals(False), timeout=3)))
142121
143− # def test_hide_hud_dragging(self):
144− # hud = self.main_window.get_hud()
145− # self.unlock_greeter()
146− # self.show_hud()
147− # rect = hud.globalRect
148− # start_x = rect[0] + (rect[2] - rect[0]) / 2
149− # start_y = rect[1] + 1
150− # stop_x = start_x
151− # stop_y = start_y + (rect[3] - rect[1]) / 2
152− # self.touch.drag(start_x, start_y, stop_x, stop_y)
153− # self.assertThat(hud.shown, Eventually(Equals(False)))
122+ def test_hide_hud_dragging(self):
123+ """Once open the Hud must close if the upper bar is dragged and released
124+ downward.
125+
126+ """
127+ self.launch_unity()
128+ self.main_window.get_greeter().unlock()
129+ hud = self.main_window.get_hud()
130+ window = self.main_window.get_qml_view()
131+
132+ self._launch_test_app_from_app_screen()
133+ hud.show()
134+
135+ start_x, start_y = hud.get_close_button_coords(self.grid_size)
136+ end_x = start_x
137+ end_y = int(window.height / 2)
138+
139+ self.touch.drag(start_x, start_y, end_x, end_y)
140+ self.assertThat(hud.shown, Eventually(Equals(False)))
154141
155142 def test_launcher_hides_hud(self):
156143 """Opening the Launcher while the Hud is active must close the Hud."""
@@ -159,17 +146,17 @@ class TestHud(Unity8TestCase):
159146 hud = self.main_window.get_hud()
160147 launcher = self.main_window.get_launcher()
161148
162− self._launch_application_from_app_screen()
149+ self._launch_test_app_from_app_screen()
163150
164151 hud.show()
165152 launcher.show()
166153
167154 self.assertThat(hud.shown, Eventually(Equals(False)))
168155
169− def _launch_application_from_app_screen(self):
156+ def _launch_test_app_from_app_screen(self):
170157 """Launches the camera app using the Dash UI.
171158
172− This is becuase when testing on the desktop running
159+ Because when testing on the desktop running
173160 self.launch_application() will launch the application on the desktop
174161 itself and not within the Unity8 UI.
175162
@@ -191,6 +178,10 @@ class TestHud(Unity8TestCase):
191178 self.touch.release()
192179
193180 def _get_hud_button_swipe_coords(self, main_view, hud_show_button):
181+ """Returns the coords both start and end x,y for swiping to make the
182+ 'hud show' button appear.
183+
184+ """
194185 start_x = int(main_view.x + (main_view.width / 2))
195186 end_x = start_x
196187 start_y = main_view.y + (main_view.height -3)
tests/autopilot/unity8/shell/tests/test_lock_screen.py−2
@@ -6,8 +6,6 @@
66# by the Free Software Foundation.
77
88
9−"""Tests for the Shell"""
10−
119from __future__ import absolute_import
1210
1311from unity8.shell.tests import Unity8TestCase