on xenial help sign in
Implemented suggested style fixes, removed assertIsNotNone.
39a420eAllan LeSage
tests/autopilot/unity8/indicators/emulators/widget.py+7−7
@@ -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 Indicators Autopilot Test Suite
4−# Copyright (C) 2012-2013 Canonical
4+# Copyright (C) 2013 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
@@ -29,12 +29,12 @@ class DefaultIndicatorWidget(UnityEmulatorBase):
29 super(DefaultIndicatorWidget, self).__init__(*args, **kwargs)
29 super(DefaultIndicatorWidget, self).__init__(*args, **kwargs)
30 self.pointer = Pointer(Touch.create())
30 self.pointer = Pointer(Touch.create())
31
31
32− # TODO: submit to autopilot.introspection.types.Rectangle
32+ # TODO: submit to autopilot.introspection.types.Rectangle [alesage 2013-12-06]
33 def get_center(self):
33 def get_center(self):
34 """Returns (x, y) representing the center of a globalRect."""
34 """Returns (x, y) representing the center of a globalRect."""
35 return (
35 return (
36− self.globalRect[0]+int(self.globalRect[2]/2),
36+ self.globalRect.x+int(self.globalRect.width/2),
37− self.globalRect[1]+int(self.globalRect[3]/2)
37+ self.globalRect.y+int(self.globalRect.height/2)
38 )
38 )
39
39
40 def swipe_to_open_indicator(self, window):
40 def swipe_to_open_indicator(self, window):
@@ -46,7 +46,7 @@ class DefaultIndicatorWidget(UnityEmulatorBase):
46 start_x, start_y,
46 start_x, start_y,
47 end_x, end_y
47 end_x, end_y
48 )
48 )
49− # TODO: assert that the indicator page opened
49+ # TODO: assert that the indicator page opened [alesage 2013-12-06]
50
50
51 def swipe_to_close_indicator(self, window):
51 def swipe_to_close_indicator(self, window):
52 """Swipe to close the indicator, wait until it's closed."""
52 """Swipe to close the indicator, wait until it's closed."""
@@ -57,4 +57,4 @@ class DefaultIndicatorWidget(UnityEmulatorBase):
57 start_x, start_y,
57 start_x, start_y,
58 end_x, end_y
58 end_x, end_y
59 )
59 )
60− # TODO: assert that the indicator page closed
60+ # TODO: assert that the indicator page closed [alesage 2013-12-06]
tests/autopilot/unity8/indicators/tests/test_indicators.py−3
@@ -15,7 +15,6 @@
15#
15#
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−#
19
18
20from __future__ import absolute_import
19from __future__ import absolute_import
21
20
@@ -50,7 +49,6 @@ class IndicatorTestCase(UnityTestCase):
50 widget = self.main_window.get_indicator_widget(
49 widget = self.main_window.get_indicator_widget(
51 self.indicator_name
50 self.indicator_name
52 )
51 )
53− self.assertIsNotNone(widget)
54
52
55
53
56class IndicatorPageTitleMatchesWidgetTestCase(UnityTestCase):
54class IndicatorPageTitleMatchesWidgetTestCase(UnityTestCase):
@@ -86,7 +84,6 @@ class IndicatorPageTitleMatchesWidgetTestCase(UnityTestCase):
86 unlock_unity(unity_proxy)
84 unlock_unity(unity_proxy)
87 window = self.main_window.get_qml_view()
85 window = self.main_window.get_qml_view()
88 widget = self.main_window.get_indicator_widget(self.indicator_name)
86 widget = self.main_window.get_indicator_widget(self.indicator_name)
89− self.assertIsNotNone(widget)
90 widget.swipe_to_open_indicator(window)
87 widget.swipe_to_open_indicator(window)
91 title = window.wait_select_single(
88 title = window.wait_select_single(
92 "IndicatorPage",
89 "IndicatorPage",