on xenial help sign in
Stylistic cleanups.
996643dAllan LeSage
tests/autopilot/unity8/indicators/emulators/__init__.py+1−1
@@ -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 Indicators 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
tests/autopilot/unity8/indicators/emulators/widget.py+12−6
@@ -32,16 +32,20 @@ class DefaultIndicatorWidget(UnityEmulatorBase):
32 # TODO: submit to autopilot.introspection.types.Rectangle
32 # TODO: submit to autopilot.introspection.types.Rectangle
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 (self.globalRect[0]+int(self.globalRect[2]/2),
36+ self.globalRect[0]+int(self.globalRect[2]/2),
36− self.globalRect[1]+int(self.globalRect[3]/2))
37+ self.globalRect[1]+int(self.globalRect[3]/2)
38+ )
37
39
38 def swipe_to_open_indicator(self, window):
40 def swipe_to_open_indicator(self, window):
39 """Swipe to open the indicator, wait until it's open."""
41 """Swipe to open the indicator, wait until it's open."""
40 start_x, start_y = self.get_center()
42 start_x, start_y = self.get_center()
41 end_x = start_x
43 end_x = start_x
42 end_y = window.height
44 end_y = window.height
43− self.pointer.drag(start_x, start_y,
45+ self.pointer.drag(
46+ start_x, start_y,
44− end_x, end_y)
47+ end_x, end_y
48+ )
45 # TODO: assert that the indicator page opened
49 # TODO: assert that the indicator page opened
46
50
47 def swipe_to_close_indicator(self, window):
51 def swipe_to_close_indicator(self, window):
@@ -49,6 +53,8 @@ class DefaultIndicatorWidget(UnityEmulatorBase):
49 end_x, end_y = self.get_center()
53 end_x, end_y = self.get_center()
50 start_x = end_x
54 start_x = end_x
51 start_y = window.height
55 start_y = window.height
52− self.pointer.drag(start_x, start_y,
56+ self.pointer.drag(
57+ start_x, start_y,
53− end_x, end_y)
58+ end_x, end_y
59+ )
54 # TODO: assert that the indicator page closed
60 # TODO: assert that the indicator page closed
tests/autopilot/unity8/indicators/tests/test_indicators.py+6−4
@@ -19,7 +19,7 @@
19
19
20from __future__ import absolute_import
20from __future__ import absolute_import
21
21
22−from autopilot.platform import model
22+import autopilot.platform
23
23
24from unity8.indicators.emulators.widget import DefaultIndicatorWidget
24from unity8.indicators.emulators.widget import DefaultIndicatorWidget
25from unity8.process_helpers import unlock_unity
25from unity8.process_helpers import unlock_unity
@@ -73,7 +73,7 @@ class IndicatorPageTitleMatchesWidgetTestCase(UnityTestCase):
73 ]
73 ]
74
74
75 def setUp(self):
75 def setUp(self):
76− if model() == "Desktop":
76+ if platform.model() == "Desktop":
77 self.skipTest("Test cannot be run on the desktop.")
77 self.skipTest("Test cannot be run on the desktop.")
78 super(IndicatorPageTitleMatchesWidgetTestCase, self).setUp()
78 super(IndicatorPageTitleMatchesWidgetTestCase, self).setUp()
79
79
@@ -88,5 +88,7 @@ class IndicatorPageTitleMatchesWidgetTestCase(UnityTestCase):
88 widget = self.main_window.get_indicator_widget(self.indicator_name)
88 widget = self.main_window.get_indicator_widget(self.indicator_name)
89 self.assertIsNotNone(widget)
89 self.assertIsNotNone(widget)
90 widget.swipe_to_open_indicator(window)
90 widget.swipe_to_open_indicator(window)
91− title = window.wait_select_single("IndicatorPage",
91+ title = window.wait_select_single(
92+ "IndicatorPage",
92− title=self.title)
93+ title=self.title
94+ )