on xenial help sign in
For autopilot tests, use the device simulation scenarios from the toolkit.

Approved by: Albert Astals Cid

commit87cd83ffcbd82ebd83be9aa6021832828c51a44e authorLeo Arias <leo.arias@canonical.com> dateWed 22 Apr 2015, 14:46 (11 years ago) parent92da040fa5edf7
7 files changed+33−43
tests/autopilot/unity8/indicators/tests/__init__.py+3−1 tests/autopilot/unity8/shell/tests/__init__.py−23 tests/autopilot/unity8/shell/tests/test_emulators.py+4−2 tests/autopilot/unity8/shell/tests/test_lock_screen.py+6−3 tests/autopilot/unity8/shell/tests/test_notifications.py+12−9 tests/autopilot/unity8/shell/tests/test_system_integration.py+5−3 tests/autopilot/unity8/shell/tests/test_upstart.py+3−2
tests/autopilot/unity8/indicators/tests/__init__.py+3−1
@@ -17,6 +17,7 @@
1717# along with this program. If not, see <http://www.gnu.org/licenses/>.
1818
1919from autopilot import platform
20+from ubuntuuitoolkit import ubuntu_scenarios
2021
2122from unity8 import process_helpers
2223from unity8.shell import tests
@@ -24,7 +25,8 @@ from unity8.shell import tests
2425
2526class IndicatorTestCase(tests.UnityTestCase):
2627
27− device_emulation_scenarios = tests._get_device_emulation_scenarios()
28+ device_emulation_scenarios = (
29+ ubuntu_scenarios.get_device_simulation_scenarios())
2830
2931 def setUp(self):
3032 super().setUp()
tests/autopilot/unity8/shell/tests/__init__.py−23
@@ -66,29 +66,6 @@ UNITYSHELL_LAUNCHER_KEY = "launcher-hide-mode"
6666UNITYSHELL_LAUNCHER_MODE = 1 # launcher hidden
6767
6868
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−
9269def is_unity7_running():
9370 """Return True if Unity7 is running. Otherwise, return False."""
9471 return (
tests/autopilot/unity8/shell/tests/test_emulators.py+4−2
@@ -16,7 +16,6 @@
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/>.
1818#
19−from unity8.shell.emulators.dash import ListViewWithPageHeader
2019
2120"""Tests for the Dash autopilot emulators.
2221
@@ -28,14 +27,17 @@ don't break them for those external projects.
2827
2928"""
3029
30+from ubuntuuitoolkit import ubuntu_scenarios
31+
3132from unity8 import process_helpers
3233from unity8.shell import fixture_setup, tests
3334from unity8.shell.emulators import dash as dash_emulators
35+from unity8.shell.emulators.dash import ListViewWithPageHeader
3436
3537
3638class MainWindowTestCase(tests.UnityTestCase):
3739
38− scenarios = tests._get_device_emulation_scenarios()
40+ scenarios = ubuntu_scenarios.get_device_simulation_scenarios()
3941
4042 def setUp(self):
4143 super().setUp()
tests/autopilot/unity8/shell/tests/test_lock_screen.py+6−3
@@ -17,11 +17,14 @@
1717# along with this program. If not, see <http://www.gnu.org/licenses/>.
1818#
1919
20−from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
20+import logging
2121
2222from autopilot.matchers import Eventually
2323from testtools.matchers import Equals
24−import logging
24+from ubuntuuitoolkit import ubuntu_scenarios
25+
26+from unity8.shell.tests import UnityTestCase
27+
2528
2629logger = logging.getLogger(__name__)
2730
@@ -30,7 +33,7 @@ class TestLockscreen(UnityTestCase):
3033
3134 """Tests for the lock screen."""
3235
33− scenarios = _get_device_emulation_scenarios()
36+ scenarios = ubuntu_scenarios.get_device_simulation_scenarios()
3437
3538 def test_can_unlock_pin_screen(self):
3639 """Must be able to unlock the PIN entry lock screen."""
tests/autopilot/unity8/shell/tests/test_notifications.py+12−9
@@ -19,27 +19,30 @@
1919
2020"""Tests for Notifications"""
2121
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
3022import time
3123import os
3224import logging
3325import signal
3426import subprocess
3527
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+
3638logger = logging.getLogger(__name__)
3739
3840
3941class NotificationsBase(UnityTestCase):
4042 """Base class for all notification tests that provides helper methods."""
4143
42− scenarios = _get_device_emulation_scenarios('Nexus4')
44+ scenarios = ubuntu_scenarios.get_device_simulation_scenarios(
45+ ubuntu_scenarios.NEXUS4_DEVICE)
4346
4447 def _get_icon_path(self, icon_name):
4548 """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 @@
11# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
22#
33# Unity Autopilot Test Suite
4−# Copyright (C) 2014 Canonical
4+# Copyright (C) 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
@@ -23,12 +23,14 @@ import subprocess
2323import unittest
2424
2525from autopilot import platform
26−from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
26+from ubuntuuitoolkit import ubuntu_scenarios
27+
28+from unity8.shell.tests import UnityTestCase
2729
2830
2931class SystemIntegrationTests(UnityTestCase):
3032
31− scenarios = _get_device_emulation_scenarios()
33+ scenarios = ubuntu_scenarios.get_device_simulation_scenarios()
3234
3335 @unittest.skipIf(
3436 platform.model() == "Desktop",
tests/autopilot/unity8/shell/tests/test_upstart.py+3−2
@@ -29,10 +29,11 @@ import fixtures
2929from testtools.matchers import Equals, MismatchError
3030from autopilot.matchers import Eventually
3131from autopilot.introspection import get_proxy_object_for_existing_process
32+from ubuntuuitoolkit import ubuntu_scenarios
3233
3334from unity8 import get_binary_path
3435from unity8.shell.emulators import UnityEmulatorBase
35−from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
36+from unity8.shell.tests import UnityTestCase
3637
3738import logging
3839
@@ -41,7 +42,7 @@ logger = logging.getLogger(__name__)
4142
4243class UpstartIntegrationTests(UnityTestCase):
4344
44− scenarios = _get_device_emulation_scenarios()
45+ scenarios = ubuntu_scenarios.get_device_simulation_scenarios()
4546
4647 def _get_status(self):
4748 pid, status = os.waitpid(