Lomiri
lomiri.shell.tests.LomiriTestCase Class Reference
Inheritance diagram for lomiri.shell.tests.LomiriTestCase:

Public Member Functions

def setUpClass (cls)
 
def setUp (self)
 
def launch_lomiri (self, mode="full-greeter", *args)
 
def patch_lightdm_mock (self)
 
def wait_for_lomiri (self)
 
def get_dash (self)
 
def main_window (self)
 

Public Attributes

 lomiri_geometry_args
 
 grid_size
 

Detailed Description

A test case base class for the Lomiri shell tests.

Definition at line 88 of file __init__.py.

Member Function Documentation

◆ get_dash()

def lomiri.shell.tests.LomiriTestCase.get_dash (   self)

Definition at line 292 of file __init__.py.

292 def get_dash(self):
293 pid = process_helpers.get_job_pid('lomiri-dash')
294 dash_proxy = introspection.get_proxy_object_for_existing_process(
295 pid=pid,
296 emulator_base=lomiriuitoolkit.LomiriUIToolkitCustomProxyObjectBase
297 )
298 dash_app = dash_helpers.DashApp(dash_proxy)
299 return dash_app.dash
300

◆ launch_lomiri()

def lomiri.shell.tests.LomiriTestCase.launch_lomiri (   self,
  mode = "full-greeter",
args 
)
    Launch the lomiri 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 lomiri

Definition at line 183 of file __init__.py.

183 def launch_lomiri(self, mode="full-greeter", *args):
184 """
185 Launch the lomiri shell, return a proxy object for it.
186
187 :param str mode: The type of greeter/shell mode to use
188 :param args: A list of aguments to pass to lomiri
189
190 """
191 binary_path = get_binary_path()
192 lib_path = get_lib_path()
193
194 logger.info(
195 "Lib path is '%s', binary path is '%s'",
196 lib_path,
197 binary_path
198 )
199
200 self.patch_lightdm_mock()
201
202 if self._qml_mock_enabled:
203 self._environment['QML2_IMPORT_PATH'] = (
204 get_qml_import_path_with_mock()
205 )
206
207 if self._data_dirs_mock_enabled:
208 self._patch_data_dirs()
209
210 lomiri_cli_args_list = ["--mode={}".format(mode)]
211 if len(args) != 0:
212 lomiri_cli_args_list += args
213
214 app_proxy = self._launch_lomiri_with_upstart(
215 binary_path,
216 self.lomiri_geometry_args + lomiri_cli_args_list
217 )
218
219 self._set_proxy(app_proxy)
220
221 # Ensure that the dash is visible before we return:
222 logger.debug("Lomiri started, waiting for it to be ready.")
223 self.wait_for_lomiri()
224 logger.debug("Lomiri loaded and ready.")
225
226 if model() == 'Desktop':
227 # On desktop, close the dash because it's opened in a separate
228 # window and it gets in the way.
229 process_helpers.stop_job('lomiri-dash')
230
231 return app_proxy
232

◆ main_window()

def lomiri.shell.tests.LomiriTestCase.main_window (   self)

Definition at line 302 of file __init__.py.

302 def main_window(self):
303 return self._proxy.select_single(shell.ShellView)
304
305

◆ patch_lightdm_mock()

def lomiri.shell.tests.LomiriTestCase.patch_lightdm_mock (   self)

Definition at line 250 of file __init__.py.

250 def patch_lightdm_mock(self):
251 logger.info("Setting up LightDM mock lib")
252 new_ld_library_path = [
253 get_default_extra_mock_libraries(),
254 self._get_lightdm_mock_path()
255 ]
256 if os.getenv('LD_LIBRARY_PATH') is not None:
257 new_ld_library_path.append(os.getenv('LD_LIBRARY_PATH'))
258
259 new_ld_library_path = ':'.join(new_ld_library_path)
260 logger.info("New library path: %s", new_ld_library_path)
261
262 self._environment['LD_LIBRARY_PATH'] = new_ld_library_path
263

◆ setUp()

def lomiri.shell.tests.LomiriTestCase.setUp (   self)

Definition at line 115 of file __init__.py.

115 def setUp(self):
116 super().setUp()
117 if is_lomiri7_running():
118 self.useFixture(toolkit_fixtures.HideLomiri7Launcher())
119
120 self._proxy = None
121 self._qml_mock_enabled = True
122 self._data_dirs_mock_enabled = True
123 self._environment = {}
124
125 self._setup_display_details()
126

◆ setUpClass()

def lomiri.shell.tests.LomiriTestCase.setUpClass (   cls)

Definition at line 93 of file __init__.py.

93 def setUpClass(cls):
94 try:
95 is_lomiri_running = process_helpers.is_job_running('lomiri')
96 except process_helpers.JobError as e:
97 xdg_config_home = os.getenv(
98 'XDG_CONFIG_HOME', os.path.join(os.getenv('HOME'), '.config'))
99 upstart_config_path = os.path.join(xdg_config_home, 'upstart')
100 logger.error(
101 '`initctl status lomiri` failed, most probably the '
102 'lomiri session could not be found:\n\n'
103 '{0}\n'
104 'Please install lomiri or copy data/lomiri.conf to '
105 '{1}\n'.format(e.output, upstart_config_path)
106 )
107 raise e
108 else:
109 assert not is_lomiri_running, (
110 'Lomiri is currently running, these tests require it to be '
111 'stopped.\n'
112 'Please run this command before running these tests: \n'
113 'initctl stop lomiri\n')
114

◆ wait_for_lomiri()

def lomiri.shell.tests.LomiriTestCase.wait_for_lomiri (   self)

Definition at line 288 of file __init__.py.

288 def wait_for_lomiri(self):
289 greeter = self.main_window.wait_select_single(objectName='greeter')
290 greeter.waiting.wait_for(False)
291

Member Data Documentation

◆ grid_size

lomiri.shell.tests.LomiriTestCase.grid_size

Definition at line 160 of file __init__.py.

◆ lomiri_geometry_args

lomiri.shell.tests.LomiriTestCase.lomiri_geometry_args

Definition at line 136 of file __init__.py.


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