on xenial help sign in
Use -windowgeometry to start dash at the requested size.
commit6949c753c6aa973c33a1e2b68fddf3c8dc8ef8c5 authorMichał Sawicz <michal.sawicz@canonical.com> dateThu 4 Sep 2014, 15:16 (12 years ago) parentb41eead
1 file changed+5−21
tests/autopilot/unity8/shell/tests/__init__.py+5−21
tests/autopilot/unity8/shell/tests/__init__.py+5−21
@@ -34,6 +34,7 @@ import logging
3434import os.path
3535import subprocess
3636import sys
37+import fixtures
3738from testtools.matchers import Equals
3839from ubuntuuitoolkit import (
3940 fixture_setup as toolkit_fixtures,
@@ -432,12 +433,6 @@ class DashBaseTestCase(AutopilotTestCase):
432433 binary_path = get_binary_path('unity8-dash')
433434 dash_proxy = self.launch_dash(binary_path, self.environment)
434435
435− if self.should_simulate_device():
436− # XXX Currently we have no way to launch the application with a
437− # specific size, so we must resize it after it's launched.
438− # --elopio - 2014-06-25
439− self.resize_window()
440−
441436 self.dash_app = dash_helpers.DashApp(dash_proxy)
442437 self.dash = self.dash_app.dash
443438 self.wait_for_dash()
@@ -470,18 +465,7 @@ class DashBaseTestCase(AutopilotTestCase):
470465 simulate_device_fixture = self.useFixture(
471466 toolkit_fixtures.SimulateDevice(
472467 self.app_width, self.app_height, self.grid_unit_px))
473− self.app_width = simulate_device_fixture.app_width
474− self.app_height = simulate_device_fixture.app_height
475−
476− def resize_window(self):
477− application = self.process_manager.get_running_applications()[0]
478− window = application.get_windows()[0]
479− window.resize(self.app_width, self.app_height)
480−
481− def get_window_size():
482− _, _, window_width, window_height = window.geometry
483− return window_width, window_height
484−
485− self.assertThat(
486− get_window_size,
487− Eventually(Equals((self.app_width, self.app_height))))
468+ self.environment['GRID_UNIT_PX'] = simulate_device_fixture.grid_unit_px
469+ self.environment['ARGS'] = '-windowgeometry {0}x{1}'\
470+ .format(simulate_device_fixture.app_width,
471+ simulate_device_fixture.app_height)