Merge lp:~canonical-platform-qa/ubuntu-system-tests/landscape-mode into lp:ubuntu-system-tests

Proposed by Richard Huddie
Status: Work in progress
Proposed branch: lp:~canonical-platform-qa/ubuntu-system-tests/landscape-mode
Merge into: lp:ubuntu-system-tests
Diff against target: 107 lines (+53/-1)
3 files modified
ubuntu_system_tests/helpers/screen.py (+23/-0)
ubuntu_system_tests/helpers/unity8/dash.py (+4/-1)
ubuntu_system_tests/helpers/unity8/shell.py (+26/-0)
To merge this branch: bzr merge lp:~canonical-platform-qa/ubuntu-system-tests/landscape-mode
Reviewer Review Type Date Requested Status
Canonical Platform QA Team Pending
Review via email: mp+290699@code.launchpad.net
To post a comment you must log in.

Unmerged revisions

361. By Richard Huddie

over-ride launcher to use landscape co-ords.

360. By Richard Huddie

Use helpers to get landscape co-ords.

359. By Richard Huddie

Add helper to get co-ords based on orientation.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntu_system_tests/helpers/screen.py'
2--- ubuntu_system_tests/helpers/screen.py 2015-12-02 11:18:18 +0000
3+++ ubuntu_system_tests/helpers/screen.py 2016-04-01 09:35:35 +0000
4@@ -19,6 +19,8 @@
5
6 import dbus
7
8+from ubuntu_system_tests.helpers import context
9+
10 SCREEN_BUS = 'com.canonical.Unity.Screen'
11 PATH = '/'
12
13@@ -40,3 +42,24 @@
14 bus = dbus.SystemBus()
15 screen = dbus.Interface(bus.get_object(SCREEN_BUS, PATH), SCREEN_BUS)
16 screen.setTouchVisualizationEnabled(enabled)
17+
18+
19+def get_native_coords(x, y):
20+ """Return x,y co-ordinates for a specified position on screen if the device
21+ is upright at zero degrees of rotation.
22+
23+ This is done by finding the current angle of rotation and then transforming
24+ the specified x,y co-ordinates to the same point on screen when the device
25+ is at zero degrees.
26+ """
27+ shell = context.shared.unity.select_single('Shell', objectName='shell')
28+ angle = shell.orientationAngle
29+
30+ if angle == 90:
31+ return shell.height - y, x
32+ elif angle == 180:
33+ return shell.height - x, shell.width - y
34+ elif angle == 270:
35+ return y, shell.width - x
36+ else:
37+ return x, y
38
39=== modified file 'ubuntu_system_tests/helpers/unity8/dash.py'
40--- ubuntu_system_tests/helpers/unity8/dash.py 2016-02-03 16:09:24 +0000
41+++ ubuntu_system_tests/helpers/unity8/dash.py 2016-04-01 09:35:35 +0000
42@@ -26,6 +26,7 @@
43 from ubuntu_system_tests.helpers.autopilot import (
44 patched_wait_select_single, validate_dbus_object, wait_select_many)
45 from ubuntu_system_tests.helpers.autopilot.list import order_by_x_coord
46+from ubuntu_system_tests.helpers.screen import get_native_coords
47 from ubuntu_system_tests.helpers.ubuntuuitoolkit.pageheader import (
48 DashPageHeader
49 )
50@@ -139,7 +140,9 @@
51 start_x, start_y = get_center_point(overview_drag_handle)
52 stop_x = start_x
53 stop_y = 0
54- self.pointing_device.drag(start_x, start_y, stop_x, stop_y)
55+ start = get_native_coords(start_x, start_y)
56+ stop = get_native_coords(stop_x, stop_y)
57+ self.pointing_device.drag(*(start + stop))
58 self.wait_for_dash_loaded()
59 return self.wait_select_single(
60 ScopesList,
61
62=== modified file 'ubuntu_system_tests/helpers/unity8/shell.py'
63--- ubuntu_system_tests/helpers/unity8/shell.py 2016-03-15 12:29:54 +0000
64+++ ubuntu_system_tests/helpers/unity8/shell.py 2016-04-01 09:35:35 +0000
65@@ -24,12 +24,16 @@
66 exceptions,
67 logging as autopilot_logging
68 )
69+from autopilot.introspection.types import Rectangle
70 import ubuntuuitoolkit
71 from unity8.shell.emulators import main_window
72+from unity8.launcher import Launcher
73
74+from ubuntu_system_tests.helpers import context
75 from ubuntu_system_tests.helpers.autopilot import validate_dbus_object
76 from ubuntu_system_tests.helpers.indicators.message import NotificationsIndicatorPage, NotificationsIndicatorItem # NOQA
77 from ubuntu_system_tests.helpers.notifications import Notifications
78+from ubuntu_system_tests.helpers.screen import get_native_coords
79 from ubuntu_system_tests.helpers.unity8 import (
80 greeter as greeter_helpers, UNITY8_PATH_ROOT)
81
82@@ -167,3 +171,25 @@
83 item = self.select_single('IndicatorItem',
84 objectName=indicator_name + '-panelItem')
85 return item.hidden
86+
87+
88+class Launcher(Launcher):
89+
90+ @classmethod
91+ def validate_dbus_object(cls, path, state):
92+ return validate_dbus_object(
93+ path, state, UNITY8_PATH_ROOT, b'Launcher', objectName='launcher')
94+
95+ def _swipe_to_show_launcher(self):
96+ #unity = context.shared.unity
97+ #shell = unity.select_single('Shell', objectName='shell')
98+ #view = Rectangle(
99+ # shell.globalRect.x, shell.globalRect.y, shell.width, shell.height)
100+ view = self.get_root_instance().select_single('ShellView')
101+ start_y = stop_y = view.y + view.height // 2
102+
103+ start_x = view.x + 1
104+ stop_x = start_x + self.panelWidth - 1
105+ start = get_native_coords(start_x, start_y)
106+ stop = get_native_coords(stop_x, stop_y)
107+ self.pointing_device.drag(*(start + stop))

Subscribers

People subscribed via source and target branches

to all changes: