on xenial help sign in
Further cleanup and test update.
commit24ff9a9278a5fe385d153d356002f40b5bf5aa57 authorChristopher Lee <chris.lee@canonical.com> dateWed 17 Jul 2013, 19:06 (13 years ago) parent0d0f28a
2 files changed+8−81
tests/autopilot/unity8/shell/tests/__init__.py−75 tests/autopilot/unity8/shell/tests/test_big_screen_alignment.py+8−6
tests/autopilot/unity8/shell/tests/__init__.py−75
@@ -95,7 +95,6 @@ class Unity8TestCase(AutopilotTestCase):
9595
9696 def launch_unity(self):
9797 """Launch the unity8 shell, return a proxy object for it."""
98− # first, work out which binary to launch:
9998 binary_path = get_unity8_binary_path()
10099 lib_path = get_lib_path()
101100
@@ -106,8 +105,6 @@ class Unity8TestCase(AutopilotTestCase):
106105
107106 # we now have a path to the unity8 binary, and lib_path points to the
108107 # directory where we need to patch some environment variables.
109−
110− # do the environment variable patching:
111108 self._patch_environment(lib_path)
112109
113110 # launch the shell:
@@ -121,9 +118,7 @@ class Unity8TestCase(AutopilotTestCase):
121118 self._set_proxy(app_proxy)
122119
123120 # Ensure that the dash is visible before we return:
124− logger.info("Waiting for the dash to load...")
125121 self.assertThat(self.get_dash().showScopeOnLoaded, Eventually(Equals("")))
126− logger.info("dash loaded!")
127122 return app_proxy
128123
129124 def _patch_environment(self, lib_path):
@@ -155,73 +150,3 @@ class Unity8TestCase(AutopilotTestCase):
155150 @property
156151 def main_window(self):
157152 return MainWindow(self._proxy)
158−
159−
160−class ShellTestCase(AutopilotTestCase):
161−
162− """A common test case class that provides several useful methods for shell tests."""
163−
164− libdir = "/usr/lib/{0}/unity8".format(sysconfig.get_config_var('MULTIARCH'))
165− lightdm_mock = "full"
166−
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)
173− else:
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(
177− os.path.join(
178− os.path.dirname(__file__),
179− "../../../../../builddir/unity8"
180− )
181− )
182− if os.path.exists(local_path):
183− self.launch_test_local(geometry)
184− else:
185− self.launch_test_installed(geometry)
186−
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')
195− else:
196− self.app = self.launch_test_application(
197− "../../builddir/unity8", "-fullscreen", app_type='qt')
198−
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')
205− else:
206− self.app = self.launch_test_application(
207− "unity8", "-fullscreen", app_type='qt')
208−
209− def skipWrapper(*args, **kwargs):
210− pass
211−
212− def form_factor(self):
213− return FormFactors.Desktop
214−
215− def __getattribute__(self, attr_name):
216− attr = object.__getattribute__(self, attr_name);
217− if attr_name.startswith("test_"):
218− try:
219− if self.form_factor() in attr.blacklist:
220− return self.skipWrapper
221− except:
222− pass
223− return attr
224−
225− @property
226− def main_window(self):
227− return MainWindow(self.app)
tests/autopilot/unity8/shell/tests/test_big_screen_alignment.py+8−6
@@ -10,18 +10,20 @@
1010from autopilot.matchers import Eventually
1111from testtools.matchers import Equals
1212
13−from unity8.shell.tests import ShellTestCase
13+from unity8.shell.tests import Unity8TestCase
1414
1515
1616# TODO: Find out if these tests are still required, if so, what they're supposed
1717# to be testing, and whether they're supposed to work on the devices.
18−class ScreenAlignmentTests(ShellTestCase):
19− def setUp(self):
20− super(ScreenAlignmentTests, self).setUp("2560x1600", "20")
18+# Also, this doesn't work as automatically scales the geometry . . .
19+class ScreenAlignmentTests(Unity8TestCase):
20+
21+ scenarios = [('Big Screen', dict(app_width=2560, app_height=1600, grid_unit_px=20))]
22+
23+ def test_hud_not_shown_greeter(self):
24+ self.launch_unity()
2125 self.assertThat(self.main_window.get_qml_view().visible,
2226 Eventually(Equals(True))
2327 )
24−
25− def test_hud_not_shown_greeter(self):
2628 hud_showable = self.main_window.get_hud_showable()
2729 self.assertThat(hud_showable.y, Eventually(Equals(1600)))