on xenial help sign in
Remove emulator, preferring main_window opening of indicator.
53a2287Allan LeSage
tests/autopilot/unity8/indicators/emulators/__init__.pydeleted−18
@@ -1,18 +0,0 @@
1−# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2−#
3−# Unity Indicators Autopilot Test Suite
4−# Copyright (C) 2013 Canonical
5−#
6−# This program is free software: you can redistribute it and/or modify
7−# it under the terms of the GNU General Public License as published by
8−# the Free Software Foundation, either version 3 of the License, or
9−# (at your option) any later version.
10−#
11−# This program is distributed in the hope that it will be useful,
12−# but WITHOUT ANY WARRANTY; without even the implied warranty of
13−# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14−# GNU General Public License for more details.
15−#
16−# You should have received a copy of the GNU General Public License
17−# along with this program. If not, see <http://www.gnu.org/licenses/>.
18−#
tests/autopilot/unity8/indicators/emulators/widget.pydeleted−57
@@ -1,57 +0,0 @@
1−# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2−#
3−# Unity Indicators Autopilot Test Suite
4−# Copyright (C) 2013 Canonical
5−#
6−# This program is free software: you can redistribute it and/or modify
7−# it under the terms of the GNU General Public License as published by
8−# the Free Software Foundation, either version 3 of the License, or
9−# (at your option) any later version.
10−#
11−# This program is distributed in the hope that it will be useful,
12−# but WITHOUT ANY WARRANTY; without even the implied warranty of
13−# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14−# GNU General Public License for more details.
15−#
16−# You should have received a copy of the GNU General Public License
17−# along with this program. If not, see <http://www.gnu.org/licenses/>.
18−
19−from unity8.shell.emulators import UnityEmulatorBase
20−
21−
22−class DefaultIndicatorWidget(UnityEmulatorBase):
23−
24− """The indicator's icon in the menu-bar."""
25−
26− def __init__(self, *args, **kwargs):
27− super(DefaultIndicatorWidget, self).__init__(*args, **kwargs)
28−
29− # TODO: submit to autopilot.introspection.types.Rectangle [alesage 2013-12-06]
30− def get_center(self):
31− """Returns (x, y) representing the center of a globalRect."""
32− return (
33− self.globalRect.x+int(self.globalRect.width/2),
34− self.globalRect.y+int(self.globalRect.height/2)
35− )
36−
37− def swipe_to_open_indicator(self, window):
38− """Swipe to open the indicator, wait until it's open."""
39− start_x, start_y = self.get_center()
40− end_x = start_x
41− end_y = window.height
42− self.pointing_device.drag(
43− start_x, start_y,
44− end_x, end_y
45− )
46− # TODO: assert that the indicator page opened [alesage 2013-12-06]
47−
48− def swipe_to_close_indicator(self, window):
49− """Swipe to close the indicator, wait until it's closed."""
50− end_x, end_y = self.get_center()
51− start_x = end_x
52− start_y = window.height
53− self.pointing_device.drag(
54− start_x, start_y,
55− end_x, end_y
56− )
57− # TODO: assert that the indicator page closed [alesage 2013-12-06]
tests/autopilot/unity8/indicators/tests/__init__.py+1−1
@@ -1,7 +1,7 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2#
2#
3# Unity - Indicators Autopilot Test Suite
3# Unity - Indicators Autopilot Test Suite
4−# Copyright (C) 2013 Canonical
4+# Copyright (C) 2013, 2014 Canonical
5#
5#
6# This program is free software: you can redistribute it and/or modify
6# This program is free software: you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
7# it under the terms of the GNU General Public License as published by
tests/autopilot/unity8/indicators/tests/test_indicators.py+7−12
@@ -18,7 +18,6 @@
18
18
19from __future__ import absolute_import
19from __future__ import absolute_import
20
20
21−from autopilot import platform
22from testscenarios import multiply_scenarios
21from testscenarios import multiply_scenarios
23
22
24from unity8.process_helpers import unlock_unity
23from unity8.process_helpers import unlock_unity
@@ -30,9 +29,11 @@ class IndicatorTestCase(UnityTestCase):
30 device_emulation_scenarios = _get_device_emulation_scenarios()
29 device_emulation_scenarios = _get_device_emulation_scenarios()
31
30
32 def setUp(self):
31 def setUp(self):
33− if platform.model() == "Desktop":
32+ if platform.model() == 'Desktop':
34− self.skipTest("Test cannot be run on the desktop.")
33+ self.skipTest('Test cannot be run on the desktop.')
35 super(IndicatorTestCase, self).setUp()
34 super(IndicatorTestCase, self).setUp()
35+ self.unity_proxy = self.launch_unity()
36+ unlock_unity(self.unity_proxy)
36
37
37
38
38class IndicatorExistsTestCase(IndicatorTestCase):
39class IndicatorExistsTestCase(IndicatorTestCase):
@@ -52,8 +53,6 @@ class IndicatorExistsTestCase(IndicatorTestCase):
52 )
53 )
53
54
54 def test_indicator_exists(self):
55 def test_indicator_exists(self):
55− unity_proxy = self.launch_unity()
56− unlock_unity(unity_proxy)
57 self.main_window.get_indicator_widget(
56 self.main_window.get_indicator_widget(
58 self.indicator_name
57 self.indicator_name
59 )
58 )
@@ -87,11 +86,7 @@ class IndicatorPageTitleMatchesWidgetTestCase(IndicatorTestCase):
87
86
88 See https://bugs.launchpad.net/ubuntu-ux/+bug/1253804 .
87 See https://bugs.launchpad.net/ubuntu-ux/+bug/1253804 .
89 """
88 """
90− unity_proxy = self.launch_unity()
91− unlock_unity(unity_proxy)
92− widget = self.main_window.get_indicator_widget(self.indicator_name)
93− widget.swipe_to_open_indicator(self.main_window)
94− indicator_page = self.main_window.get_indicator_page(
89+ indicator_page = self.main_window.open_indicator_page(
95− indicator_title=self.title
90+ self.indicator_name)
96− )
97 self.assertTrue(indicator_page.visible)
91 self.assertTrue(indicator_page.visible)
92+ self.assertEqual(indicator_page.title, self.title)
tests/autopilot/unity8/shell/emulators/main_window.py+28−4
@@ -20,13 +20,13 @@
20import logging
20import logging
21
21
22from autopilot import logging as autopilot_logging
22from autopilot import logging as autopilot_logging
23+from autopilot.input._common import get_center_point
23
24
24from unity8.shell import emulators
25from unity8.shell import emulators
25from unity8.shell.emulators.greeter import Greeter
26from unity8.shell.emulators.greeter import Greeter
26from unity8.shell.emulators.hud import Hud
27from unity8.shell.emulators.hud import Hud
27from unity8.shell.emulators.dash import Dash
28from unity8.shell.emulators.dash import Dash
28from unity8.shell.emulators.launcher import Launcher
29from unity8.shell.emulators.launcher import Launcher
29−from unity8.indicators.emulators.widget import DefaultIndicatorWidget
30
30
31logger = logging.getLogger(__name__)
31logger = logging.getLogger(__name__)
32
32
@@ -90,16 +90,40 @@ class QQuickView(emulators.UnityEmulatorBase):
90
90
91 def get_indicator_widget(self, indicator_name):
91 def get_indicator_widget(self, indicator_name):
92 return self.select_single(
92 return self.select_single(
93− DefaultIndicatorWidget,
93+ 'DefaultIndicatorWidget',
94 objectName=indicator_name+'-widget'
94 objectName=indicator_name+'-widget'
95 )
95 )
96
96
97− def get_indicator_page(self, indicator_title):
97+ def get_indicator_page(self, indicator_name):
98 return self.select_single(
98 return self.select_single(
99 'DefaultIndicatorPage',
99 'DefaultIndicatorPage',
100− title=indicator_title
100+ objectName=indicator_name+'-page'
101 )
101 )
102
102
103+ @autopilot_logging.log_action(logger.info)
104+ def open_indicator_page(self, indicator_name):
105+ """Return the indicator page.
106+
107+ Swipe to open the indicator, wait until it's open.
108+ """
109+ widget = self.get_indicator_widget(indicator_name)
110+ start_x, start_y = get_center_point(widget)
111+ end_x = start_x
112+ end_y = self.height
113+ self.pointing_device.drag(start_x, start_y, end_x, end_y)
114+ # TODO: assert that the indicator page opened [alesage 2013-12-06]
115+ return self.get_indicator_page(indicator_name)
116+
117+ @autopilot_logging.log_action(logger.info)
118+ def close_indicator_page(self, indicator_name):
119+ """Swipe to close the indicator, wait until it's closed."""
120+ widget = self.get_indicator_widget(indicator_name)
121+ end_x, end_y = get_center_point(widget)
122+ start_x = end_x
123+ start_y = self.height
124+ self.pointing_device.drag(start_x, start_y, end_x, end_y)
125+ # TODO: assert that the indicator page closed [alesage 2013-12-06]
126+
103 def get_shell_background(self):
127 def get_shell_background(self):
104 return self.select_single(
128 return self.select_single(
105 "CrossFadeImage", objectName="backgroundImage")
129 "CrossFadeImage", objectName="backgroundImage")