on xenial help sign in
Merged with prerequisite.
commit1d7fa530751a22dd5ff2caa489c466a9fbb9f9ae authorLeo Arias <leo.arias@canonical.com> dateWed 9 Jul 2014, 12:30 (12 years ago) parent15737de1ff9280
3 files changed+5−83
tests/autopilot/unity8/shell/emulators/launcher.py+4−20 tests/autopilot/unity8/shell/emulators/main_window.py−5 tests/autopilot/unity8/shell/tests/test_emulators.py+1−58
tests/autopilot/unity8/shell/emulators/launcher.py+4−20
@@ -35,36 +35,20 @@ class Launcher(emulators.UnityEmulatorBase):
3535 def show(self):
3636 """Show the launcher swiping it to the right."""
3737 if not self.shown:
38− self._swipe_launcher('right')
38+ self._swipe_to_show_launcher()
3939 self.shown.wait_for(True)
4040 else:
4141 logger.debug('The launcher is already opened.')
4242
43− def _swipe_launcher(self, direction):
43+ def _swipe_to_show_launcher(self):
4444 view = self.get_root_instance().select_single('QQuickView')
4545 start_y = stop_y = view.y + view.height // 2
4646
47− left = view.x + 1
48− right = left + self.panelWidth - 1
49−
50− if direction == 'right':
51− start_x = left
52− stop_x = right
53− elif direction == 'left':
54− start_x = right
55− stop_x = left
47+ start_x = view.x + 1
48+ stop_x = start_x + self.panelWidth - 1
5649
5750 self.pointing_device.drag(start_x, start_y, stop_x, stop_y)
5851
59− @autopilot.logging.log_action(logger.debug)
60− def hide(self):
61− """Hide the launcher swiping it to the left."""
62− if self.shown:
63− self._swipe_launcher('left')
64− self.shown.wait_for(False)
65− else:
66− logger.debug('The launcher is already closed.')
67−
6852 @autopilot.logging.log_action(logger.debug)
6953 def click_dash_icon(self):
7054 if self.shown:
tests/autopilot/unity8/shell/emulators/main_window.py−5
@@ -153,11 +153,6 @@ class QQuickView(emulators.UnityEmulatorBase):
153153 def _get_launcher(self):
154154 return self.select_single(Launcher)
155155
156− @autopilot_logging.log_action(logger.info)
157− def close_launcher(self):
158− launcher = self._get_launcher()
159− launcher.hide()
160−
161156 def is_launcher_open(self):
162157 return self._get_launcher().shown
163158
tests/autopilot/unity8/shell/tests/test_emulators.py+1−58
@@ -34,10 +34,7 @@ except ImportError:
3434
3535from unity8 import process_helpers
3636from unity8.shell import emulators, fixture_setup, tests
37−from unity8.shell.emulators import (
38− dash as dash_emulators,
39− launcher as launcher_emulator
40−)
37+from unity8.shell.emulators import dash as dash_emulators
4138
4239
4340class MainWindowTestCase(tests.UnityTestCase):
@@ -55,24 +52,6 @@ class MainWindowTestCase(tests.UnityTestCase):
5552 self.assertEqual(text_field.text, 'Test')
5653 self.assertEqual(text_field.state, 'idle')
5754
58− def test_open_launcher_must_return_launcher_custom_proxy_object(self):
59− launcher = self.main_window.open_launcher()
60− self.assertIsInstance(launcher, launcher_emulator.Launcher)
61−
62− def test_open_launcher_must_open_it(self):
63− # Make sure that the launcher is closed.
64− self.main_window.close_launcher()
65− self.main_window.open_launcher()
66−
67− self.assertTrue(self.main_window.is_launcher_open())
68−
69− def test_close_launcher_must_close_it(self):
70− # Make sure that the launcher is open.
71− self.main_window.open_launcher()
72− self.main_window.close_launcher()
73−
74− self.assertFalse(self.main_window.is_launcher_open())
75−
7655
7756class DashBaseTestCase(tests.UnityTestCase):
7857
@@ -219,39 +198,3 @@ class DashAppsEmulatorTestCase(DashBaseTestCase):
219198 return filtergrid.collapsedRowCount * filtergrid.columns
220199 else:
221200 return filtergrid.uncollapsedRowCount * filtergrid.columns
222−
223−
224−class LauncherTestCase(tests.UnityTestCase):
225−
226− scenarios = tests._get_device_emulation_scenarios()
227−
228− def setUp(self):
229− super(LauncherTestCase, self).setUp()
230− unity_proxy = self.launch_unity()
231− process_helpers.unlock_unity(unity_proxy)
232−
233− def test_show_launcher_with_launcher_open_must_do_nothing(self):
234− launcher = self.main_window.open_launcher()
235− with mock.patch.object(launcher.pointing_device, 'drag') as mock_drag:
236− launcher.show()
237−
238− self.assertFalse(mock_drag.called)
239−
240− def test_hide_launcher_with_launcher_closed_must_do_nothing(self):
241− launcher = self.main_window.open_launcher()
242− launcher.hide()
243− with mock.patch.object(launcher.pointing_device, 'drag') as mock_drag:
244− launcher.hide()
245−
246− self.assertFalse(mock_drag.called)
247−
248− def test_click_dash_icon_with_launcher_closed_must_raise_exception(self):
249− launcher = self.main_window.open_launcher()
250− launcher.hide()
251−
252− exception = self.assertRaises(
253− emulators.UnityEmulatorException,
254− launcher.click_dash_icon)
255−
256− self.assertEqual(
257− 'The launcher is closed.', str(exception))