on xenial help sign in
Moved the indicator tests to their own module.
9bc9ff2Leo Arias
tests/autopilot/unity8/indicators/tests/__init__.py+18−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, 2014 Canonical
4+# Copyright (C) 2013, 2014, 2015 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
@@ -15,3 +15,20 @@
15#
15#
16# You should have received a copy of the GNU General Public License
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/>.
17# along with this program. If not, see <http://www.gnu.org/licenses/>.
18+
19+from autopilot import platform
20+
21+from unity8 import process_helpers
22+from unity8.shell import tests
23+
24+
25+class IndicatorTestCase(tests.UnityTestCase):
26+
27+ device_emulation_scenarios = tests._get_device_emulation_scenarios()
28+
29+ def setUp(self):
30+ if platform.model() == 'Desktop':
31+ self.skipTest('Test cannot be run on the desktop.')
32+ super(IndicatorTestCase, self).setUp()
33+ self.unity_proxy = self.launch_unity()
34+ process_helpers.unlock_unity(self.unity_proxy)
tests/autopilot/unity8/indicators/tests/test_display_indicator.pynew file+37
@@ -0,0 +1,37 @@
1+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2+#
3+# Unity Indicators Autopilot Test Suite
4+# Copyright (C) 2015 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 import (
20+ fixture_setup,
21+ indicators,
22+)
23+from unity8.shell import tests
24+
25+
26+class DisplayIndicatorTestCase(tests.IndicatorTestCase):
27+
28+ def test(self):
29+ display_indicator = indicators.DisplayIndicator(self.main_window)
30+ display_indicator_page = display_indicator.open()
31+ fixture = fixture_setup.DisplayRotationLock(False)
32+
33+ display_indicator_page.unlock_rotation()
34+ self.assertEqual(fixture._is_rotation_lock_enabled(), False)
35+
36+ display_indicator_page.lock_rotation()
37+ self.assertEqual(fixture._is_rotation_lock_enabled(), True)
tests/autopilot/unity8/indicators/tests/test_indicators.py+5−33
@@ -22,24 +22,10 @@ from testscenarios import multiply_scenarios
22
22
23from autopilot import platform
23from autopilot import platform
24
24
25−from unity8 import indicators, fixture_setup
25+from unity8.indicators import tests
26−from unity8.process_helpers import unlock_unity
27−from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
28
26
29
27
30−class IndicatorTestCase(UnityTestCase):
31−
32− device_emulation_scenarios = _get_device_emulation_scenarios()
33−
34− def setUp(self):
35− if platform.model() == 'Desktop':
36− self.skipTest('Test cannot be run on the desktop.')
37− super(IndicatorTestCase, self).setUp()
38− self.unity_proxy = self.launch_unity()
39− unlock_unity(self.unity_proxy)
40−
41−
42−class IndicatorExistsTestCase(IndicatorTestCase):
28+class IndicatorExistsTestCase(tests.IndicatorTestCase):
43
29
44 indicator_scenarios = [
30 indicator_scenarios = [
45 ('Bluetooth', dict(indicator_name='indicator-bluetooth')),
31 ('Bluetooth', dict(indicator_name='indicator-bluetooth')),
@@ -52,7 +38,7 @@ class IndicatorExistsTestCase(IndicatorTestCase):
52 ]
38 ]
53 scenarios = multiply_scenarios(
39 scenarios = multiply_scenarios(
54 indicator_scenarios,
40 indicator_scenarios,
55− IndicatorTestCase.device_emulation_scenarios
41+ tests.IndicatorTestCase.device_emulation_scenarios
56 )
42 )
57
43
58 def setUp(self):
44 def setUp(self):
@@ -67,7 +53,7 @@ class IndicatorExistsTestCase(IndicatorTestCase):
67 )
53 )
68
54
69
55
70−class IndicatorPageTitleMatchesWidgetTestCase(IndicatorTestCase):
56+class IndicatorPageTitleMatchesWidgetTestCase(tests.IndicatorTestCase):
71
57
72 indicator_scenarios = [
58 indicator_scenarios = [
73 ('Bluetooth', dict(indicator_name='indicator-bluetooth',
59 ('Bluetooth', dict(indicator_name='indicator-bluetooth',
@@ -87,7 +73,7 @@ class IndicatorPageTitleMatchesWidgetTestCase(IndicatorTestCase):
87 ]
73 ]
88 scenarios = multiply_scenarios(
74 scenarios = multiply_scenarios(
89 indicator_scenarios,
75 indicator_scenarios,
90− IndicatorTestCase.device_emulation_scenarios
76+ tests.IndicatorTestCase.device_emulation_scenarios
91 )
77 )
92
78
93 def setUp(self):
79 def setUp(self):
@@ -105,17 +91,3 @@ class IndicatorPageTitleMatchesWidgetTestCase(IndicatorTestCase):
105 self.indicator_name)
91 self.indicator_name)
106 self.assertTrue(indicator_page.visible)
92 self.assertTrue(indicator_page.visible)
107 self.assertEqual(indicator_page.title, self.title)
93 self.assertEqual(indicator_page.title, self.title)
108−
109−
110−class DisplayIndicatorTestCase(IndicatorTestCase):
111−
112− def test(self):
113− display_indicator = indicators.DisplayIndicator(self.main_window)
114− display_indicator_page = display_indicator.open()
115− fixture = fixture_setup.DisplayRotationLock(False)
116−
117− display_indicator_page.unlock_rotation()
118− self.assertEqual(fixture._is_rotation_lock_enabled(), False)
119−
120− display_indicator_page.lock_rotation()
121− self.assertEqual(fixture._is_rotation_lock_enabled(), True)