@@ -19,6 +19,11 @@
1919
2020"""unity autopilot tests."""
2121
22+try:
23+ from gi.repository import Gio
24+except ImportError:
25+ Gio = None
26+
2227from autopilot.platform import model
2328from autopilot.testcase import AutopilotTestCase
2429from autopilot.matchers import Eventually
@@ -36,6 +41,10 @@ from unity8.shell.emulators.main_window import MainWindow
3641
3742logger = logging.getLogger(__name__)
3843
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
3948
4049def _get_device_emulation_scenarios():
4150 if model() == 'Desktop':
@@ -64,10 +73,21 @@ class UnityTestCase(AutopilotTestCase):
6473
6574 def setUp(self):
6675 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)
82+
6783 self._proxy = None
6884 self.touch = Touch.create()
6985 self._setup_display_details()
7086
87+ def _reset_launcher(self):
88+ """Reset Unity launcher hide mode"""
89+ self._unityshell_schema.set_int(UNITYSHELL_LAUNCHER_KEY, self._launcher_hide_mode)
90+
7191 def _setup_display_details(self):
7292 scale_divisor = self._determine_geometry()
7393 self._setup_grid_size(scale_divisor)