Unity 8
unity8.shell.tests.UnityTestCase Class Reference
Inheritance diagram for unity8.shell.tests.UnityTestCase:

Public Member Functions

def setUpClass (cls)
 
def setUp (self)
 
def launch_unity (self, mode="full-greeter", args)
 
def patch_lightdm_mock (self)
 
def wait_for_unity (self)
 
def get_dash (self)
 
def main_window (self)
 

Public Attributes

 touch
 
 unity_geometry_args
 
 grid_size
 

Detailed Description

A test case base class for the Unity shell tests.

Definition at line 111 of file __init__.py.

Member Function Documentation

def unity8.shell.tests.UnityTestCase.launch_unity (   self,
  mode = "full-greeter",
  args 
)
    Launch the unity shell, return a proxy object for it.

:param str mode: The type of greeter/shell mode to use
:param args: A list of aguments to pass to unity8

Definition at line 255 of file __init__.py.

255  def launch_unity(self, mode="full-greeter", *args):
256  """
257  Launch the unity shell, return a proxy object for it.
258 
259  :param str mode: The type of greeter/shell mode to use
260  :param args: A list of aguments to pass to unity8
261 
262  """
263  binary_path = get_binary_path()
264  lib_path = get_lib_path()
265 
266  logger.info(
267  "Lib path is '%s', binary path is '%s'",
268  lib_path,
269  binary_path
270  )
271 
272  self.patch_lightdm_mock()
273 
274  if self._qml_mock_enabled:
275  self._environment['QML2_IMPORT_PATH'] = (
276  get_qml_import_path_with_mock()
277  )
278 
279  if self._data_dirs_mock_enabled:
280  self._patch_data_dirs()
281 
282  # FIXME: we shouldn't be doing this
283  # $MIR_SOCKET, fallback to $XDG_RUNTIME_DIR/mir_socket and
284  # /tmp/mir_socket as last resort
285  try:
286  os.unlink(
287  os.getenv('MIR_SOCKET',
288  os.path.join(os.getenv('XDG_RUNTIME_DIR', "/tmp"),
289  "mir_socket")))
290  except OSError:
291  pass
292  try:
293  os.unlink("/tmp/mir_socket")
294  except OSError:
295  pass
296 
297  unity8_cli_args_list = ["--mode={}".format(mode)]
298  if len(args) != 0:
299  unity8_cli_args_list += args
300 
301  app_proxy = self._launch_unity_with_upstart(
302  binary_path,
303  self.unity_geometry_args + unity8_cli_args_list
304  )
305 
306  self._set_proxy(app_proxy)
307 
308  # Ensure that the dash is visible before we return:
309  logger.debug("Unity started, waiting for it to be ready.")
310  self.wait_for_unity()
311  logger.debug("Unity loaded and ready.")
312 
313  if model() == 'Desktop':
314  # On desktop, close the dash because it's opened in a separate
315  # window and it gets in the way.
316  process_helpers.stop_job('unity8-dash')
317 
318  return app_proxy
319 
def launch_unity(self, mode="full-greeter", args)
Definition: __init__.py:255
def _set_proxy(self, proxy)
Definition: __init__.py:375
def _launch_unity_with_upstart(self, binary_path, args)
Definition: __init__.py:320

The documentation for this class was generated from the following file: