on xenial help sign in
Moved the indicator tests to their own module.
commit9bc9ff2f45d1ec536da83cc0b23025704ee9b3b2 authorLeo Arias <leo.arias@canonical.com> dateTue 20 Jan 2015, 11:56 (12 years ago) parent9e850b4
3 files changed+60−34
tests/autopilot/unity8/indicators/tests/__init__.py+18−1 tests/autopilot/unity8/indicators/tests/test_display_indicator.py+37 tests/autopilot/unity8/indicators/tests/test_indicators.py+5−33
tests/autopilot/unity8/indicators/tests/__init__.py+18−1
@@ -1,7 +1,7 @@
11# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
22#
33# Unity - Indicators Autopilot Test Suite
4−# Copyright (C) 2013, 2014 Canonical
4+# Copyright (C) 2013, 2014, 2015 Canonical
55#
66# This program is free software: you can redistribute it and/or modify
77# it under the terms of the GNU General Public License as published by
@@ -15,3 +15,20 @@
1515#
1616# You should have received a copy of the GNU General Public License
1717# 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
2222
2323from autopilot import platform
2424
25−from unity8 import indicators, fixture_setup
26−from unity8.process_helpers import unlock_unity
27−from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
25+from unity8.indicators import tests
2826
2927
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):
4329
4430 indicator_scenarios = [
4531 ('Bluetooth', dict(indicator_name='indicator-bluetooth')),
@@ -52,7 +38,7 @@ class IndicatorExistsTestCase(IndicatorTestCase):
5238 ]
5339 scenarios = multiply_scenarios(
5440 indicator_scenarios,
55− IndicatorTestCase.device_emulation_scenarios
41+ tests.IndicatorTestCase.device_emulation_scenarios
5642 )
5743
5844 def setUp(self):
@@ -67,7 +53,7 @@ class IndicatorExistsTestCase(IndicatorTestCase):
6753 )
6854
6955
70−class IndicatorPageTitleMatchesWidgetTestCase(IndicatorTestCase):
56+class IndicatorPageTitleMatchesWidgetTestCase(tests.IndicatorTestCase):
7157
7258 indicator_scenarios = [
7359 ('Bluetooth', dict(indicator_name='indicator-bluetooth',
@@ -87,7 +73,7 @@ class IndicatorPageTitleMatchesWidgetTestCase(IndicatorTestCase):
8773 ]
8874 scenarios = multiply_scenarios(
8975 indicator_scenarios,
90− IndicatorTestCase.device_emulation_scenarios
76+ tests.IndicatorTestCase.device_emulation_scenarios
9177 )
9278
9379 def setUp(self):
@@ -105,17 +91,3 @@ class IndicatorPageTitleMatchesWidgetTestCase(IndicatorTestCase):
10591 self.indicator_name)
10692 self.assertTrue(indicator_page.visible)
10793 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)