@@ -20,13 +20,13 @@
20import logging
20import logging
22from autopilot import logging as autopilot_logging
22from autopilot import logging as autopilot_logging
23+from autopilot.input._common import get_center_point
24from unity8.shell import emulators
25from unity8.shell import emulators
25from unity8.shell.emulators.greeter import Greeter
26from unity8.shell.emulators.greeter import Greeter
26from unity8.shell.emulators.hud import Hud
27from unity8.shell.emulators.hud import Hud
27from unity8.shell.emulators.dash import Dash
28from unity8.shell.emulators.dash import Dash
28from unity8.shell.emulators.launcher import Launcher
29from unity8.shell.emulators.launcher import Launcher
29−from unity8.indicators.emulators.widget import DefaultIndicatorWidget
31logger = logging.getLogger(__name__)
31logger = logging.getLogger(__name__)
@@ -90,16 +90,40 @@ class QQuickView(emulators.UnityEmulatorBase):
91 def get_indicator_widget(self, indicator_name):
91 def get_indicator_widget(self, indicator_name):
92 return self.select_single(
92 return self.select_single(
93− DefaultIndicatorWidget,
93+ 'DefaultIndicatorWidget',
94 objectName=indicator_name+'-widget'
94 objectName=indicator_name+'-widget'
97− def get_indicator_page(self, indicator_title):
97+ def get_indicator_page(self, indicator_name):
98 return self.select_single(
98 return self.select_single(
99 'DefaultIndicatorPage',
99 'DefaultIndicatorPage',
100− title=indicator_title
100+ objectName=indicator_name+'-page'
103+ @autopilot_logging.log_action(logger.info)
104+ def open_indicator_page(self, indicator_name):
105+ """Return the indicator page.
107+ Swipe to open the indicator, wait until it's open.
109+ widget = self.get_indicator_widget(indicator_name)
110+ start_x, start_y = get_center_point(widget)
113+ self.pointing_device.drag(start_x, start_y, end_x, end_y)
114+ # TODO: assert that the indicator page opened [alesage 2013-12-06]
115+ return self.get_indicator_page(indicator_name)
117+ @autopilot_logging.log_action(logger.info)
118+ def close_indicator_page(self, indicator_name):
119+ """Swipe to close the indicator, wait until it's closed."""
120+ widget = self.get_indicator_widget(indicator_name)
121+ end_x, end_y = get_center_point(widget)
123+ start_y = self.height
124+ self.pointing_device.drag(start_x, start_y, end_x, end_y)
125+ # TODO: assert that the indicator page closed [alesage 2013-12-06]
103 def get_shell_background(self):
127 def get_shell_background(self):
104 return self.select_single(
128 return self.select_single(
105 "CrossFadeImage", objectName="backgroundImage")
129 "CrossFadeImage", objectName="backgroundImage")