@@ -0,0 +1,140 @@
1+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
3+# Unity Autopilot Test Suite
4+# Copyright (C) 2014 Canonical
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.
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.
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/>.
23+import ubuntuuitoolkit
26+from autopilot import introspection
29+logger = logging.getLogger(__name__)
32+class RightEdgeDemoOverlay(
33+ ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
36+ def validate_dbus_object(cls, path, state):
37+ name = introspection.get_classname_from_path(path)
38+ if name == b'EdgeDemoOverlay':
39+ if state['edge'][1] == 'right':
43+ @autopilot.logging.log_action(logger.info)
45+ """Swipe to the left to complete this demo step."""
46+ x, y, width, height = self.globalRect
49+ start_y = stop_y = y + height // 2
50+ self.pointing_device.drag(start_x, start_y, stop_x, stop_y)
51+ return self.get_root_instance().wait_select_single(
52+ edge='top', active=True)
55+class TopEdgeDemoOverlay(
56+ ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
59+ def validate_dbus_object(cls, path, state):
60+ name = introspection.get_classname_from_path(path)
61+ if name == b'EdgeDemoOverlay':
62+ if state['edge'][1] == 'top':
66+ @autopilot.logging.log_action(logger.info)
68+ """Swipe to the bottom to complete this demo step."""
69+ x, y, width, height = self.globalRect
70+ start_x = stop_x = x + width // 2
73+ self.pointing_device.drag(start_x, start_y, stop_x, stop_y)
74+ return self.get_root_instance().wait_select_single(
75+ edge='bottom', active=True)
78+class BottomEdgeDemoOverlay(
79+ ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
82+ def validate_dbus_object(cls, path, state):
83+ name = introspection.get_classname_from_path(path)
84+ if name == b'EdgeDemoOverlay':
85+ if state['edge'][1] == 'bottom':
89+ @autopilot.logging.log_action(logger.info)
91+ """Swipe to the top to complete this demo step."""
92+ x, y, width, height = self.globalRect
93+ start_x = stop_x = x + width // 2
96+ self.pointing_device.drag(start_x, start_y, stop_x, stop_y)
97+ return self.get_root_instance().wait_select_single(
98+ edge='left', active=True)
101+class LeftEdgeDemoOverlay(
102+ ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
105+ def validate_dbus_object(cls, path, state):
106+ name = introspection.get_classname_from_path(path)
107+ if name == b'EdgeDemoOverlay':
108+ if state['edge'][1] == 'left':
112+ @autopilot.logging.log_action(logger.info)
114+ """Swipe to the right to complete this demo step."""
115+ x, y, width, height = self.globalRect
118+ start_y = stop_y = y + height // 2
119+ self.pointing_device.drag(start_x, start_y, stop_x, stop_y)
120+ return self.get_root_instance().wait_select_single(
121+ edge='none', active=True)
124+class FinalEdgeDemoOverlay(
125+ ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
128+ def validate_dbus_object(cls, path, state):
129+ name = introspection.get_classname_from_path(path)
130+ if name == b'EdgeDemoOverlay':
131+ if state['edge'][1] == 'none':
135+ @autopilot.logging.log_action(logger.info)
136+ def tap_to_start(self):
137+ """Tap to finish the demo and start using the Ubuntu Touch."""
139+ self.pointing_device.click_object(self)
140+ self.shown.wait_for(False)