on xenial help sign in
For autopilot tests, use the device simulation scenarios from the toolkit.
c56e190Leonardo Arias Fonseca
tests/autopilot/unity8/indicators/tests/__init__.py+3−1
@@ -17,6 +17,7 @@
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
18
19from autopilot import platform
19from autopilot import platform
20+from ubuntuuitoolkit import ubuntu_scenarios
20
21
21from unity8 import process_helpers
22from unity8 import process_helpers
22from unity8.shell import tests
23from unity8.shell import tests
@@ -24,7 +25,8 @@ from unity8.shell import tests
24
25
25class IndicatorTestCase(tests.UnityTestCase):
26class IndicatorTestCase(tests.UnityTestCase):
26
27
27− device_emulation_scenarios = tests._get_device_emulation_scenarios()
28+ device_emulation_scenarios = (
29+ ubuntu_scenarios.get_device_simulation_scenarios())
28
30
29 def setUp(self):
31 def setUp(self):
30 super().setUp()
32 super().setUp()
tests/autopilot/unity8/shell/tests/__init__.py−23
@@ -66,29 +66,6 @@ UNITYSHELL_LAUNCHER_KEY = "launcher-hide-mode"
66UNITYSHELL_LAUNCHER_MODE = 1 # launcher hidden
66UNITYSHELL_LAUNCHER_MODE = 1 # launcher hidden
67
67
68
68
69−def _get_device_emulation_scenarios(devices='All'):
70− nexus4 = ('Desktop Nexus 4',
71− dict(app_width=768, app_height=1280, grid_unit_px=18))
72− nexus10 = ('Desktop Nexus 10',
73− dict(app_width=2560, app_height=1600, grid_unit_px=20))
74− native = ('Native Device',
75− dict(app_width=0, app_height=0, grid_unit_px=0))
76−
77− if model() == 'Desktop':
78− if devices == 'All':
79− return [nexus4, nexus10]
80− elif devices == 'Nexus4':
81− return [nexus4]
82− elif devices == 'Nexus10':
83− return [nexus10]
84− else:
85− raise RuntimeError(
86− 'Unrecognized device-option "%s" passed.' % devices
87− )
88− else:
89− return [native]
90−
91−
92def is_unity7_running():
69def is_unity7_running():
93 """Return True if Unity7 is running. Otherwise, return False."""
70 """Return True if Unity7 is running. Otherwise, return False."""
94 return (
71 return (
tests/autopilot/unity8/shell/tests/test_emulators.py+4−2
@@ -16,7 +16,6 @@
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#
18#
19−from unity8.shell.emulators.dash import ListViewWithPageHeader
20
19
21"""Tests for the Dash autopilot emulators.
20"""Tests for the Dash autopilot emulators.
22
21
@@ -28,14 +27,17 @@ don't break them for those external projects.
28
27
29"""
28"""
30
29
30+from ubuntuuitoolkit import ubuntu_scenarios
31+
31from unity8 import process_helpers
32from unity8 import process_helpers
32from unity8.shell import fixture_setup, tests
33from unity8.shell import fixture_setup, tests
33from unity8.shell.emulators import dash as dash_emulators
34from unity8.shell.emulators import dash as dash_emulators
35+from unity8.shell.emulators.dash import ListViewWithPageHeader
34
36
35
37
36class MainWindowTestCase(tests.UnityTestCase):
38class MainWindowTestCase(tests.UnityTestCase):
37
39
38− scenarios = tests._get_device_emulation_scenarios()
40+ scenarios = ubuntu_scenarios.get_device_simulation_scenarios()
39
41
40 def setUp(self):
42 def setUp(self):
41 super().setUp()
43 super().setUp()
tests/autopilot/unity8/shell/tests/test_lock_screen.py+6−3
@@ -17,11 +17,14 @@
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#
18#
19
19
20−from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
20+import logging
21
21
22from autopilot.matchers import Eventually
22from autopilot.matchers import Eventually
23from testtools.matchers import Equals
23from testtools.matchers import Equals
24−import logging
24+from ubuntuuitoolkit import ubuntu_scenarios
25+
26+from unity8.shell.tests import UnityTestCase
27+
25
28
26logger = logging.getLogger(__name__)
29logger = logging.getLogger(__name__)
27
30
@@ -30,7 +33,7 @@ class TestLockscreen(UnityTestCase):
30
33
31 """Tests for the lock screen."""
34 """Tests for the lock screen."""
32
35
33− scenarios = _get_device_emulation_scenarios()
36+ scenarios = ubuntu_scenarios.get_device_simulation_scenarios()
34
37
35 def test_can_unlock_pin_screen(self):
38 def test_can_unlock_pin_screen(self):
36 """Must be able to unlock the PIN entry lock screen."""
39 """Must be able to unlock the PIN entry lock screen."""
tests/autopilot/unity8/shell/tests/test_notifications.py+12−9
@@ -19,27 +19,30 @@
19
19
20"""Tests for Notifications"""
20"""Tests for Notifications"""
21
21
22−from unity8 import shell
23−from unity8.process_helpers import unlock_unity
24−from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
25−
26−from testtools.matchers import Equals, NotEquals
27−from autopilot.matchers import Eventually
28−
29−from gi.repository import Notify
30import time
22import time
31import os
23import os
32import logging
24import logging
33import signal
25import signal
34import subprocess
26import subprocess
35
27
28+from autopilot.matchers import Eventually
29+from gi.repository import Notify
30+from testtools.matchers import Equals, NotEquals
31+from ubuntuuitoolkit import ubuntu_scenarios
32+
33+from unity8 import shell
34+from unity8.process_helpers import unlock_unity
35+from unity8.shell.tests import UnityTestCase
36+
37+
36logger = logging.getLogger(__name__)
38logger = logging.getLogger(__name__)
37
39
38
40
39class NotificationsBase(UnityTestCase):
41class NotificationsBase(UnityTestCase):
40 """Base class for all notification tests that provides helper methods."""
42 """Base class for all notification tests that provides helper methods."""
41
43
42− scenarios = _get_device_emulation_scenarios('Nexus4')
44+ scenarios = ubuntu_scenarios.get_device_simulation_scenarios(
45+ ubuntu_scenarios.NEXUS4_DEVICE)
43
46
44 def _get_icon_path(self, icon_name):
47 def _get_icon_path(self, icon_name):
45 """Given an icons file name returns the full path (either system or
48 """Given an icons file name returns the full path (either system or
tests/autopilot/unity8/shell/tests/test_system_integration.py+5−3
@@ -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 Autopilot Test Suite
3# Unity Autopilot Test Suite
4−# Copyright (C) 2014 Canonical
4+# Copyright (C) 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
@@ -23,12 +23,14 @@ import subprocess
23import unittest
23import unittest
24
24
25from autopilot import platform
25from autopilot import platform
26+from ubuntuuitoolkit import ubuntu_scenarios
27+
26−from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
28+from unity8.shell.tests import UnityTestCase
27
29
28
30
29class SystemIntegrationTests(UnityTestCase):
31class SystemIntegrationTests(UnityTestCase):
30
32
31− scenarios = _get_device_emulation_scenarios()
33+ scenarios = ubuntu_scenarios.get_device_simulation_scenarios()
32
34
33 @unittest.skipIf(
35 @unittest.skipIf(
34 platform.model() == "Desktop",
36 platform.model() == "Desktop",
tests/autopilot/unity8/shell/tests/test_upstart.py+3−2
@@ -29,10 +29,11 @@ import fixtures
29from testtools.matchers import Equals, MismatchError
29from testtools.matchers import Equals, MismatchError
30from autopilot.matchers import Eventually
30from autopilot.matchers import Eventually
31from autopilot.introspection import get_proxy_object_for_existing_process
31from autopilot.introspection import get_proxy_object_for_existing_process
32+from ubuntuuitoolkit import ubuntu_scenarios
32
33
33from unity8 import get_binary_path
34from unity8 import get_binary_path
34from unity8.shell.emulators import UnityEmulatorBase
35from unity8.shell.emulators import UnityEmulatorBase
35−from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
36+from unity8.shell.tests import UnityTestCase
36
37
37import logging
38import logging
38
39
@@ -41,7 +42,7 @@ logger = logging.getLogger(__name__)
41
42
42class UpstartIntegrationTests(UnityTestCase):
43class UpstartIntegrationTests(UnityTestCase):
43
44
44− scenarios = _get_device_emulation_scenarios()
45+ scenarios = ubuntu_scenarios.get_device_simulation_scenarios()
45
46
46 def _get_status(self):
47 def _get_status(self):
47 pid, status = os.waitpid(
48 pid, status = os.waitpid(