23 from autopilot
import introspection
25 from unity8
import process_helpers
31 """Fixture to launch the Dash app."""
34 """Initialize an instance.
36 :param str binary_path: The path to the Dash app binary.
37 :param variables: The variables to use when launching the app.
38 :type variables: A dictionary.
46 """Launch the dash app when the fixture is used."""
51 def launch_application(self):
53 testability_arg =
'QT_LOAD_TESTABILITY={}'.format(1)
55 '{}={}'.format(key, value)
for key, value
in self.variables.items()
57 all_args = [binary_arg, testability_arg] + env_args
59 pid = process_helpers.start_job(
'unity8-dash', *all_args)
60 return introspection.get_proxy_object_for_existing_process(
62 emulator_base=emulators.UnityEmulatorBase,
65 def stop_application(self):
66 process_helpers.stop_job(
'unity8-dash')
69 class DisplayRotationLock(fixtures.Fixture):
77 original_state = self._is_rotation_lock_enabled()
78 if self.enable != original_state:
79 self.addCleanup(self._set_rotation_lock, original_state)
80 self._set_rotation_lock(self.enable)
82 def _is_rotation_lock_enabled(self):
85 'com.ubuntu.touch.system',
88 output = subprocess.check_output(command, universal_newlines=
True)
89 return True if output.count(
'true')
else False
91 def _set_rotation_lock(self, value):
92 value_string =
'true' if value
else 'false'
95 'com.ubuntu.touch.system',
96 'rotation-lock', value_string
98 subprocess.check_output(command)
def __init__(self, binary_path, variables)
def launch_application(self)
def stop_application(self)