@@ -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