on xenial help sign in
code cleanup.
commitda33378022f1de892678dbd5c0695524382fe9bb authorThomi Richards <thomi.richards@canonical.com> dateThu 18 Jul 2013, 17:30 (13 years ago) parentd91ca38
13 files changed+265−143
tests/autopilot/setup.py+16−5 tests/autopilot/unity8/__init__.py+16−4 tests/autopilot/unity8/shell/__init__.py+17−5 tests/autopilot/unity8/shell/emulators/__init__.py+16−4 tests/autopilot/unity8/shell/emulators/dash.py+20 tests/autopilot/unity8/shell/emulators/greeter.py+20−1 tests/autopilot/unity8/shell/emulators/hud.py+19−1 tests/autopilot/unity8/shell/emulators/launcher.py+19 tests/autopilot/unity8/shell/emulators/main_window.py+30−9 tests/autopilot/unity8/shell/tests/__init__.py+51−26 tests/autopilot/unity8/shell/tests/test_big_screen_alignment.py−30 tests/autopilot/unity8/shell/tests/test_hud.py+25−50 tests/autopilot/unity8/shell/tests/test_lock_screen.py+16−8
tests/autopilot/setup.py+16−5
@@ -1,11 +1,22 @@
11#!/usr/bin/python
2−
32# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
4−# Copyright 2013 Canonical
53#
6−# This program is free software: you can redistribute it and/or modify it
7−# under the terms of the GNU General Public License version 3, as published
8−# by the Free Software Foundation.
4+# Unity8 Autopilot Test Suite
5+# Copyright (C) 2012-2013 Canonical
6+#
7+# This program is free software: you can redistribute it and/or modify
8+# it under the terms of the GNU General Public License as published by
9+# the Free Software Foundation, either version 3 of the License, or
10+# (at your option) any later version.
11+#
12+# This program is distributed in the hope that it will be useful,
13+# but WITHOUT ANY WARRANTY; without even the implied warranty of
14+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+# GNU General Public License for more details.
16+#
17+# You should have received a copy of the GNU General Public License
18+# along with this program. If not, see <http://www.gnu.org/licenses/>.
19+#
920
1021
1122from distutils.core import setup
tests/autopilot/unity8/__init__.py+16−4
@@ -1,9 +1,21 @@
11# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2−# Copyright 2013 Canonical
32#
4−# This program is free software: you can redistribute it and/or modify it
5−# under the terms of the GNU General Public License version 3, as published
6−# by the Free Software Foundation.
3+# Unity8 Autopilot Test Suite
4+# Copyright (C) 2012-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+#
719
820"""unity8 autopilot tests and emulators - top level package."""
921import os
tests/autopilot/unity8/shell/__init__.py+17−5
@@ -1,18 +1,30 @@
11# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2−# Copyright 2013 Canonical
32#
4−# This program is free software: you can redistribute it and/or modify it
5−# under the terms of the GNU General Public License version 3, as published
6−# by the Free Software Foundation.
3+# Unity8 Autopilot Test Suite
4+# Copyright (C) 2012-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+#
719
820"""unity8 shell autopilot tests and emulators - sub level package."""
921
1022from functools import wraps
23+import logging
1124import os.path
1225
1326from unity8 import get_lib_path, running_installed_tests
1427
15−import logging
1628
1729logger = logging.getLogger(__name__)
1830
tests/autopilot/unity8/shell/emulators/__init__.py+16−4
@@ -1,9 +1,21 @@
11# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2−# Copyright 2013 Canonical
32#
4−# This program is free software: you can redistribute it and/or modify it
5−# under the terms of the GNU General Public License version 3, as published
6−# by the Free Software Foundation.
3+# Unity8 Autopilot Test Suite
4+# Copyright (C) 2012-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+#
719
820
921from autopilot.introspection import CustomEmulatorBase
tests/autopilot/unity8/shell/emulators/dash.py+20
@@ -1,3 +1,22 @@
1+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2+#
3+# Unity8 Autopilot Test Suite
4+# Copyright (C) 2012-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+
120from unity8.shell.emulators import Unity8EmulatorBase
221
322
@@ -18,6 +37,7 @@ class Dash(Unity8EmulatorBase):
1837 Will return None if the icon isn't found.
1938
2039 :param text: String containing the text of the icon to search for.
40+
2141 """
2242 app_grid = self.get_home_applications_grid()
2343 resp_grid = app_grid.select_single('ResponsiveGridView')
tests/autopilot/unity8/shell/emulators/greeter.py+20−1
@@ -1,3 +1,22 @@
1+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2+#
3+# Unity8 Autopilot Test Suite
4+# Copyright (C) 2012-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+
120from unity8.shell.emulators import Unity8EmulatorBase
221from autopilot.input import Touch
322
@@ -28,7 +47,7 @@ class Greeter(Unity8EmulatorBase):
2847
2948 self.created.wait_for(False)
3049
31− #TODO: This was moved here from helpers.TestShellHelpersg
50+ #TODO: This was moved here from helpers.TestShellHelpers
3251 # Needs a cleanup (used in borked above).
3352 def select_greeter_user(self, username):
3453 greeter = self.main_window.get_greeter()
tests/autopilot/unity8/shell/emulators/hud.py+19−1
@@ -1,3 +1,22 @@
1+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2+#
3+# Unity8 Autopilot Test Suite
4+# Copyright (C) 2012-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+
120from unity8 import get_grid_size
221from unity8.shell.emulators import Unity8EmulatorBase
322from autopilot.input import Touch
@@ -18,7 +37,6 @@ class Hud(Unity8EmulatorBase):
1837
1938 start_x = int(window.x + (window.width / 2))
2039 end_x = start_x
21− # start_y = window.y + (window.height - 3)
2240 start_y = window.y + window.height
2341 end_y = int(hud_show_button.y + (hud_show_button.height/2))
2442
tests/autopilot/unity8/shell/emulators/launcher.py+19
@@ -1,3 +1,22 @@
1+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2+#
3+# Unity8 Autopilot Test Suite
4+# Copyright (C) 2012-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+
120from unity8.shell.emulators import Unity8EmulatorBase
221from autopilot.input import Touch
322
tests/autopilot/unity8/shell/emulators/main_window.py+30−9
@@ -1,9 +1,21 @@
11# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2−# Copyright 2013 Canonical
32#
4−# This program is free software: you can redistribute it and/or modify it
5−# under the terms of the GNU General Public License version 3, as published
6−# by the Free Software Foundation.
3+# Unity8 Autopilot Test Suite
4+# Copyright (C) 2012-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+#
719
820
921from unity8.shell.emulators.greeter import Greeter
@@ -26,7 +38,10 @@ class MainWindow(object):
2638 return self.app.select_single(Greeter)
2739
2840 def get_greeter_content_loader(self):
29− return self.app.select_single("QQuickLoader", objectName="greeterContentLoader")
41+ return self.app.select_single(
42+ "QQuickLoader",
43+ objectName="greeterContentLoader"
44+ )
3045
3146 def get_login_loader(self):
3247 return self.app.select_single("QQuickLoader", objectName="loginLoader")
@@ -35,7 +50,7 @@ class MainWindow(object):
3550 return self.app.select_single("LoginList")
3651
3752 def get_hud(self):
38− return self.app.select_single("Hud")
53+ return self.app.select_single(Hud)
3954
4055 def get_hud_showable(self):
4156 return self.app.select_single("Showable", objectName="hudShowable")
@@ -47,19 +62,25 @@ class MainWindow(object):
4762 return self.app.select_single(Dash)
4863
4964 def get_dash_home_applications_grid(self):
50− return self.app.select_single("ApplicationsFilterGrid", objectName="dashHomeApplicationsGrid")
65+ return self.app.select_single(
66+ "ApplicationsFilterGrid",
67+ objectName="dashHomeApplicationsGrid"
68+ )
5169
5270 def get_bottombar(self):
5371 return self.app.select_single("Bottombar")
5472
5573 def get_launcher(self):
56− return self.app.select_single("Launcher")
74+ return self.app.select_single(Launcher)
5775
5876 def get_pinPadLoader(self):
5977 return self.app.select_single("QQuickLoader", objectName="pinPadLoader")
6078
6179 def get_pinPadButton(self, buttonId):
62− return self.app.select_single("PinPadButton", objectName="pinPadButton%i" % buttonId)
80+ return self.app.select_single(
81+ "PinPadButton",
82+ objectName="pinPadButton%i" % buttonId
83+ )
6384
6485 def get_lockscreen(self):
6586 return self.app.select_single("Lockscreen")
tests/autopilot/unity8/shell/tests/__init__.py+51−26
@@ -1,46 +1,66 @@
11# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2−# Copyright 2013 Canonical
32#
4−# This program is free software: you can redistribute it and/or modify it
5−# under the terms of the GNU General Public License version 3, as published
6−# by the Free Software Foundation.
3+# Unity8 Autopilot Test Suite
4+# Copyright (C) 2012-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+#
719
820"""unity8 autopilot tests."""
921
1022from autopilot.platform import model
1123from autopilot.testcase import AutopilotTestCase
1224from autopilot.matchers import Eventually
13−from testtools.matchers import Equals, NotEquals
1425from autopilot.input import Touch
1526from autopilot.display import Display
1627import logging
1728import os.path
18−import sysconfig
29+from testtools.matchers import Equals, NotEquals
1930
2031from unity8 import get_lib_path, get_unity8_binary_path
21−from unity8.shell.emulators.main_window import MainWindow
2232from unity8.shell.emulators import Unity8EmulatorBase
2333from unity8.shell.emulators.dash import Dash
34+from unity8.shell.emulators.main_window import MainWindow
2435
2536
2637logger = logging.getLogger(__name__)
2738
2839
29−class FormFactors(object):
30− Phone, Tablet, Desktop = range(3)
31−
3240def _get_device_emulation_scenarios():
3341 if model() == 'Desktop':
3442 return [
35− ('Desktop Nexus 4', dict(app_width=768, app_height=1280, grid_unit_px=18)),
36− ('Desktop Nexus 10', dict(app_width=2560, app_height=1600, grid_unit_px=20)),
43+ (
44+ 'Desktop Nexus 4',
45+ dict(app_width=768, app_height=1280, grid_unit_px=18)
46+ ),
47+ (
48+ 'Desktop Nexus 10',
49+ dict(app_width=2560, app_height=1600, grid_unit_px=20)
50+ ),
3751 ]
3852 else:
39− return [ ('Native Device', dict(app_width=0, app_height=0, grid_unit_px=0)) ]
53+ return [
54+ (
55+ 'Native Device',
56+ dict(app_width=0, app_height=0, grid_unit_px=0)
57+ )
58+ ]
59+
4060
4161class Unity8TestCase(AutopilotTestCase):
4262
43− """A sane test case base class for the Unity8 shell tests."""
63+ """A test case base class for the Unity8 shell tests."""
4464
4565 def setUp(self):
4666 super(Unity8TestCase, self).setUp()
@@ -49,7 +69,6 @@ class Unity8TestCase(AutopilotTestCase):
4969 self._setup_display_details()
5070
5171 def _setup_display_details(self):
52− # This needs a bit of a cleanup, make it clearer
5372 scale_divisor = self._determine_geometry()
5473 self._setup_grid_size(scale_divisor)
5574
@@ -65,12 +84,18 @@ class Unity8TestCase(AutopilotTestCase):
6584 scale_divisor = self._get_scaled_down_geo(width, height)
6685 width = width / scale_divisor
6786 height = height / scale_divisor
68− logger.info("Provided geometry larger than Display, scaled down to: %sx%s",
87+ logger.info(
88+ "Geometry larger than display, scaled down to: %dx%d",
6989 width,
7090 height
7191 )
72− geo_string = "%sx%s" % (width, height)
73− self.unity_geometry_args = ['-geometry', geo_string, '-frameless', '-mousetouch']
92+ geo_string = "%dx%d" % (width, height)
93+ self.unity_geometry_args = [
94+ '-geometry',
95+ geo_string,
96+ '-frameless',
97+ '-mousetouch'
98+ ]
7499 return scale_divisor
75100
76101 def _setup_grid_size(self, scale_divisor):
@@ -122,18 +147,18 @@ class Unity8TestCase(AutopilotTestCase):
122147 self._set_proxy(app_proxy)
123148
124149 # Ensure that the dash is visible before we return:
125− self.assertThat(self.get_dash().showScopeOnLoaded, Eventually(Equals("")))
150+ self.assertThat(
151+ self.get_dash().showScopeOnLoaded,
152+ Eventually(Equals(""))
153+ )
126154 return app_proxy
127155
128156 def _patch_environment(self, lib_path):
129157 """Patch environment variables for launching the unity8 shell."""
130− # ld_lib_path_patches = (
131− # os.path.join(lib_path, "qml/mocks/libusermetrics"),
132− # os.path.join(lib_path, "qml/mocks/LightDM/" + self.lightdm_mock),
133− # )
134−
135− # self.patch_environment("LD_LIBRARY_PATH", ":".join(ld_lib_path_patches))
136− self.patch_environment("QML2_IMPORT_PATH", os.path.join(lib_path, "qml/mocks"))
158+ self.patch_environment(
159+ "QML2_IMPORT_PATH",
160+ os.path.join(lib_path, "qml/mocks")
161+ )
137162
138163 def _set_proxy(self, proxy):
139164 """Keep a copy of the proxy object, so we can use it to get common parts
tests/autopilot/unity8/shell/tests/test_big_screen_alignment.pydeleted−30
@@ -1,30 +0,0 @@
1−# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2−# Copyright 2013 Canonical
3−#
4−# This program is free software: you can redistribute it and/or modify it
5−# under the terms of the GNU General Public License version 3, as published
6−# by the Free Software Foundation.
7−
8−"""Add tests here if you want to ensure everything is aligned correctly on huge screens. Because this test does not fit on most screens, you should not use input devices here or your tests are likely to fail"""
9−
10−from autopilot.matchers import Eventually
11−from testtools.matchers import Equals
12−
13−from unity8.shell.tests import Unity8TestCase
14−
15−
16−# TODO: Find out if these tests are still required, if so, what they're supposed
17−# to be testing, and whether they're supposed to work on the devices.
18−class ScreenAlignmentTests(Unity8TestCase):
19−
20− scenarios = [
21− ('Big Screen', dict(app_width=2560, app_height=1600, grid_unit_px=20, scale_geo=False))
22− ]
23−
24− def test_hud_not_shown_greeter(self):
25− self.launch_unity()
26− self.assertThat(self.main_window.get_qml_view().visible,
27− Eventually(Equals(True))
28− )
29− hud_showable = self.main_window.get_hud_showable()
30− self.assertThat(hud_showable.y, Eventually(Equals(1600)))
tests/autopilot/unity8/shell/tests/test_hud.py+25−50
@@ -1,9 +1,21 @@
11# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2−# Copyright 2013 Canonical
32#
4−# This program is free software: you can redistribute it and/or modify it
5−# under the terms of the GNU General Public License version 3, as published
6−# by the Free Software Foundation.
3+# Unity8 Autopilot Test Suite
4+# Copyright (C) 2012-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+#
719
820from __future__ import absolute_import
921
@@ -21,7 +33,7 @@ SwipeCoords = namedtuple('SwipeCoords', 'start_x end_x start_y end_y')
2133
2234class TestHud(Unity8TestCase):
2335
24− """Tests the Shell HUD"""
36+ """Tests the Shell HUD."""
2537
2638 scenarios = _get_device_emulation_scenarios()
2739
@@ -35,7 +47,10 @@ class TestHud(Unity8TestCase):
3547
3648 self._launch_test_app_from_app_screen()
3749
38− swipe_coords = self._get_hud_button_swipe_coords(window, hud_show_button)
50+ swipe_coords = self._get_hud_button_swipe_coords(
51+ window,
52+ hud_show_button
53+ )
3954 self.touch.press(swipe_coords.start_x, swipe_coords.start_y)
4055 self.addCleanup(self.touch.release)
4156 self.touch._finger_move(swipe_coords.end_x, swipe_coords.end_y)
@@ -52,7 +67,10 @@ class TestHud(Unity8TestCase):
5267
5368 self._launch_test_app_from_app_screen()
5469
55− swipe_coords = self._get_hud_button_swipe_coords(window, hud_show_button)
70+ swipe_coords = self._get_hud_button_swipe_coords(
71+ window,
72+ hud_show_button
73+ )
5674 self.touch.press(swipe_coords.start_x, swipe_coords.start_y)
5775 self.addCleanup(self._maybe_release_finger)
5876 self.touch._finger_move(swipe_coords.end_x, swipe_coords.end_y)
@@ -62,39 +80,6 @@ class TestHud(Unity8TestCase):
6280 self.touch.release()
6381 self.assertThat(hud.shown, Eventually(Equals(True)))
6482
65− # def test_show_hud_button_dont_open(self):
66− # self.launch_unity()
67− # hud_show_button = self.main_window.get_hud_show_button()
68− # hud = self.main_window.get_hud()
69− # greeter = self.main_window.get_greeter()
70− # greeter.unlock()
71−
72− # self.unlock_greeter()
73− # self.open_first_dash_home_app()
74− # hud_show_button = self.main_window.get_hud_show_button()
75− # hud = self.main_window.get_hud()
76− # window = self.main_window.get_qml_view()
77− # start_x = int(window.x + window.width / 2)
78− # start_y = window.y + window.height - 2
79− # self.assertThat(hud_show_button.opacity, Eventually(Equals(0)))
80− # self.touch.press(start_x, start_y)
81− # self.touch._finger_move(start_x, start_y - self.grid_size)
82− # self.assertThat(hud_show_button.opacity, Eventually(Equals(0)))
83− # self.touch._finger_move(start_x, start_y - self.grid_size * 2)
84− # self.touch._finger_move(start_x, start_y - self.grid_size * 3)
85− # self.touch._finger_move(start_x, start_y - self.grid_size * 4)
86− # self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0)))
87− # self.assertThat(hud_show_button.mouseOver, Eventually(Equals(False)))
88− # self.touch._finger_move(start_x, start_y - self.grid_size * 34)
89− # self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0)))
90− # self.assertThat(hud_show_button.mouseOver, Eventually(Equals(True)))
91− # self.touch._finger_move(start_x, start_y - self.grid_size)
92− # self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0)))
93− # self.assertThat(hud_show_button.mouseOver, Eventually(Equals(False)))
94− # self.touch.release()
95− # self.assertThat(hud_show_button.opacity, Eventually(Equals(0)))
96− # self.assertThat(hud.shown, Eventually(Equals(False)))
97−
9883 @with_lightdm_mock("single")
9984 def test_hide_hud_click(self):
10085 """Tapping the close button of the Hud must dismiss it."""
@@ -109,16 +94,6 @@ class TestHud(Unity8TestCase):
10994 self.touch.tap(x, y)
11095 self.assertThat(hud.shown, Eventually(Equals(False)))
11196
112− # def test_hide_hud_click_outside_handle(self):
113− # hud = self.main_window.get_hud()
114− # self.unlock_greeter()
115− # self.show_hud()
116− # rect = hud.globalRect
117− # x = int(rect[0] + rect[2] / 2)
118− # y = rect[1] + hud.handleHeight + 1
119− # self.touch.tap(x, y)
120− # self.assertRaises(MismatchError, lambda: self.assertThat(hud.shown, Eventually(Equals(False), timeout=3)))
121−
12297 @with_lightdm_mock("single")
12398 def test_hide_hud_dragging(self):
12499 """Once open the Hud must close if the upper bar is dragged and released
tests/autopilot/unity8/shell/tests/test_lock_screen.py+16−8
@@ -1,9 +1,21 @@
11# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2−# Copyright 2013 Canonical
32#
4−# This program is free software: you can redistribute it and/or modify it
5−# under the terms of the GNU General Public License version 3, as published
6−# by the Free Software Foundation.
3+# Unity8 Autopilot Test Suite
4+# Copyright (C) 2012-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+#
719
820
921from __future__ import absolute_import
@@ -13,14 +25,10 @@ from unity8.shell.tests import Unity8TestCase, _get_device_emulation_scenarios
1325
1426from autopilot.matchers import Eventually
1527from autopilot.platform import model
16−import logging
1728from testtools import skipUnless
1829from testtools.matchers import Equals
1930
2031
21−logger = logging.getLogger(__name__)
22−
23−
2432class TestLockscreen(Unity8TestCase):
2533
2634 """Tests for the lock screen."""