@@ -95,7 +95,6 @@ class Unity8TestCase(AutopilotTestCase):
96 def launch_unity(self):
96 def launch_unity(self):
97 """Launch the unity8 shell, return a proxy object for it."""
97 """Launch the unity8 shell, return a proxy object for it."""
98− # first, work out which binary to launch:
99 binary_path = get_unity8_binary_path()
98 binary_path = get_unity8_binary_path()
100 lib_path = get_lib_path()
99 lib_path = get_lib_path()
@@ -106,8 +105,6 @@ class Unity8TestCase(AutopilotTestCase):
107 # we now have a path to the unity8 binary, and lib_path points to the
106 # we now have a path to the unity8 binary, and lib_path points to the
108 # directory where we need to patch some environment variables.
107 # directory where we need to patch some environment variables.
110− # do the environment variable patching:
111 self._patch_environment(lib_path)
108 self._patch_environment(lib_path)
113 # launch the shell:
110 # launch the shell:
@@ -121,9 +118,7 @@ class Unity8TestCase(AutopilotTestCase):
121 self._set_proxy(app_proxy)
118 self._set_proxy(app_proxy)
123 # Ensure that the dash is visible before we return:
120 # Ensure that the dash is visible before we return:
124− logger.info("Waiting for the dash to load...")
125 self.assertThat(self.get_dash().showScopeOnLoaded, Eventually(Equals("")))
121 self.assertThat(self.get_dash().showScopeOnLoaded, Eventually(Equals("")))
126− logger.info("dash loaded!")
127 return app_proxy
122 return app_proxy
129 def _patch_environment(self, lib_path):
124 def _patch_environment(self, lib_path):
@@ -155,73 +150,3 @@ class Unity8TestCase(AutopilotTestCase):
155 @property
150 @property
156 def main_window(self):
151 def main_window(self):
157 return MainWindow(self._proxy)
152 return MainWindow(self._proxy)
160−class ShellTestCase(AutopilotTestCase):
162− """A common test case class that provides several useful methods for shell tests."""
164− libdir = "/usr/lib/{0}/unity8".format(sysconfig.get_config_var('MULTIARCH'))
165− lightdm_mock = "full"
167− def setUp(self, geometry, grid_size):
168− super(ShellTestCase, self).setUp()
169− # Lets assume we are installed system wide if this file is somewhere in /usr
170− if grid_size != "0":
171− os.environ['GRID_UNIT_PX'] = grid_size
172− self.grid_size = int(grid_size)
174− self.grid_size = int(os.environ['GRID_UNIT_PX'])
175− # launch the local binary if it exists, system binary otherwise
176− local_path = os.path.abspath(
178− os.path.dirname(__file__),
179− "../../../../../builddir/unity8"
182− if os.path.exists(local_path):
183− self.launch_test_local(geometry)
185− self.launch_test_installed(geometry)
187− def launch_test_local(self, geometry):
188− # TODO: This assumed we're launching the tests from the autopilot test root
189− # dir, which may not always be the case.
190− os.environ['LD_LIBRARY_PATH'] = "../../builddir/tests/mocks/libusermetrics:../../builddir/tests/mocks/LightDM" + self.lightdm_mock
191− os.environ['QML2_IMPORT_PATH'] = "../../builddir/tests/mocks"
192− if geometry != "0x0":
193− self.app = self.launch_test_application(
194− "../../builddir/unity8", "-geometry", geometry, "-frameless", app_type='qt')
196− self.app = self.launch_test_application(
197− "../../builddir/unity8", "-fullscreen", app_type='qt')
199− def launch_test_installed(self, geometry):
200− os.environ['LD_LIBRARY_PATH'] = "{0}/qml/mocks/libusermetrics:{0}/qml/mocks/LightDM/{1}".format(self.libdir, self.lightdm_mock)
201− os.environ['QML2_IMPORT_PATH'] = "{0}/qml/mocks".format(self.libdir)
202− if model() == 'Desktop' and geometry != "0x0":
203− self.app = self.launch_test_application(
204− "unity8", "-geometry", geometry, "-frameless", app_type='qt')
206− self.app = self.launch_test_application(
207− "unity8", "-fullscreen", app_type='qt')
209− def skipWrapper(*args, **kwargs):
212− def form_factor(self):
213− return FormFactors.Desktop
215− def __getattribute__(self, attr_name):
216− attr = object.__getattribute__(self, attr_name);
217− if attr_name.startswith("test_"):
219− if self.form_factor() in attr.blacklist:
220− return self.skipWrapper
226− def main_window(self):
227− return MainWindow(self.app)