@@ -0,0 +1,72 @@
1+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
3+# Unity Indicators Autopilot Test Suite
4+# Copyright (C) 2013, 2014, 2015 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/>.
19+from autopilot import input
20+from unity8.shell import emulators
21+from unity8.shell.emulators import main_window
22+import unity8.indicators
24+class IndicatorsMenu (emulators.UnityEmulatorBase):
25+ """Autopilot helper for the IndicatorPage component."""
27+ widget = self.select_single('IndicatorItem',objectName='indicator-sound-panelItem')
28+ start_x, start_y = input.get_center_point(widget)
31+ self.pointing_device.drag(start_x, start_y, end_x, end_y)
32+ self.fullyOpened.wait_for(True)
34+ def open_rotation_indicator(self):
36+ indicators_bar_flickable = self.select_single(
37+ 'IndicatorsBar').select_single(
38+ main_window.QQuickFlickable, objectName='flickable')
39+ indicators_bar_flickable.swipe_to_x_end()
40+ indicator_rotation_icon = self.select_single(
41+ objectName='indicator-rotation-lock-panelItem')
42+ self.pointing_device.click_object(indicator_rotation_icon)
43+ self.fullyOpened.wait_for(True)
44+ return DisplayIndicator(self.select_single('IndicatorPage', objectName='indicator-rotation-lock-page'))
46+class DisplayIndicator (emulators.UnityEmulatorBase):
47+ def __init__ (self, subject):
48+ self.__subject = subject
49+ def __getattr__(self, name):
50+ return getattr(self.__subject, name)
52+ def lock_rotation(self):
53+ """Toggles the rotation lock indicator to locked.
55+ Swipes open indicator-display and ensures that rotation lock is toggled
59+ switcher = self.select_single('CheckBox', objectName='switcher')
60+ switcher.checked = True
63+ def unlock_rotation(self):
64+ """Toggles the rotation lock indicator to unlocked.
66+ Swipes open indicator-display and ensures that rotation lock is toggled
70+ switcher = self.select_single('CheckBox', objectName='switcher')
71+ switcher.checked = False