@@ -19,6 +19,11 @@
20"""unity autopilot tests."""
20"""unity autopilot tests."""
23+ from gi.repository import Gio
22from autopilot.platform import model
27from autopilot.platform import model
23from autopilot.testcase import AutopilotTestCase
28from autopilot.testcase import AutopilotTestCase
24from autopilot.matchers import Eventually
29from autopilot.matchers import Eventually
@@ -36,6 +41,10 @@ from unity8.shell.emulators.main_window import MainWindow
37logger = logging.getLogger(__name__)
42logger = logging.getLogger(__name__)
44+UNITYSHELL_GSETTINGS_SCHEMA = "org.compiz.unityshell"
45+UNITYSHELL_GSETTINGS_PATH = "/org/compiz/profiles/unity/plugins/unityshell/"
46+UNITYSHELL_LAUNCHER_KEY = "launcher-hide-mode"
47+UNITYSHELL_LAUNCHER_MODE = 1 # launcher hidden
40def _get_device_emulation_scenarios():
49def _get_device_emulation_scenarios():
41 if model() == 'Desktop':
50 if model() == 'Desktop':
@@ -64,10 +73,21 @@ class UnityTestCase(AutopilotTestCase):
65 def setUp(self):
74 def setUp(self):
66 super(UnityTestCase, self).setUp()
75 super(UnityTestCase, self).setUp()
76+ if Gio is not None and UNITYSHELL_GSETTINGS_SCHEMA in Gio.Settings.list_relocatable_schemas():
77+ # Hide Unity launcher
78+ self._unityshell_schema = Gio.Settings.new_with_path(UNITYSHELL_GSETTINGS_SCHEMA, UNITYSHELL_GSETTINGS_PATH)
79+ self._launcher_hide_mode = self._unityshell_schema.get_int(UNITYSHELL_LAUNCHER_KEY)
80+ self._unityshell_schema.set_int(UNITYSHELL_LAUNCHER_KEY, UNITYSHELL_LAUNCHER_MODE)
81+ self.addCleanup(self._reset_launcher)
67 self._proxy = None
83 self._proxy = None
68 self.touch = Touch.create()
84 self.touch = Touch.create()
69 self._setup_display_details()
85 self._setup_display_details()
87+ def _reset_launcher(self):
88+ """Reset Unity launcher hide mode"""
89+ self._unityshell_schema.set_int(UNITYSHELL_LAUNCHER_KEY, self._launcher_hide_mode)
71 def _setup_display_details(self):
91 def _setup_display_details(self):
72 scale_divisor = self._determine_geometry()
92 scale_divisor = self._determine_geometry()
73 self._setup_grid_size(scale_divisor)
93 self._setup_grid_size(scale_divisor)