on xenial help sign in
Use -windowgeometry to start dash at the requested size.
6949c75Michał Sawicz
tests/autopilot/unity8/shell/tests/__init__.py+5−21
@@ -34,6 +34,7 @@ import logging
34import os.path
34import os.path
35import subprocess
35import subprocess
36import sys
36import sys
37+import fixtures
37from testtools.matchers import Equals
38from testtools.matchers import Equals
38from ubuntuuitoolkit import (
39from ubuntuuitoolkit import (
39 fixture_setup as toolkit_fixtures,
40 fixture_setup as toolkit_fixtures,
@@ -432,12 +433,6 @@ class DashBaseTestCase(AutopilotTestCase):
432 binary_path = get_binary_path('unity8-dash')
433 binary_path = get_binary_path('unity8-dash')
433 dash_proxy = self.launch_dash(binary_path, self.environment)
434 dash_proxy = self.launch_dash(binary_path, self.environment)
434
435
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−
441 self.dash_app = dash_helpers.DashApp(dash_proxy)
436 self.dash_app = dash_helpers.DashApp(dash_proxy)
442 self.dash = self.dash_app.dash
437 self.dash = self.dash_app.dash
443 self.wait_for_dash()
438 self.wait_for_dash()
@@ -470,18 +465,7 @@ class DashBaseTestCase(AutopilotTestCase):
470 simulate_device_fixture = self.useFixture(
465 simulate_device_fixture = self.useFixture(
471 toolkit_fixtures.SimulateDevice(
466 toolkit_fixtures.SimulateDevice(
472 self.app_width, self.app_height, self.grid_unit_px))
467 self.app_width, self.app_height, self.grid_unit_px))
473− self.app_width = simulate_device_fixture.app_width
468+ self.environment['GRID_UNIT_PX'] = simulate_device_fixture.grid_unit_px
474− self.app_height = simulate_device_fixture.app_height
469+ self.environment['ARGS'] = '-windowgeometry {0}x{1}'\
475−
470+ .format(simulate_device_fixture.app_width,
476− def resize_window(self):
471+ simulate_device_fixture.app_height)
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))))