on xenial help sign in
review comments
commit35f9f7c23be5c82430f3d92f1f0870f6f3687ef0 authorNick Dedekind <nick.dedekind@canonical.com> dateTue 7 Apr 2015, 12:48 (12 years ago) parent4484708
4 files changed+21−26
data/indicators-client.desktop.in+1−1 tests/autopilot/unity8/fixture_setup.py+11−9 tests/autopilot/unity8/indicators/tests/test_action_latency.py+8−11 tests/mocks/indicator-service/CMakeLists.txt+1−5
data/indicators-client.desktop.in+1−1
@@ -1,7 +1,7 @@
11[Desktop Entry]
22Type=Application
33Name=Indicators Client
4−Comment=An interface for using the Scopes system
4+Comment=Application for testing the Indicators system
55Exec=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@/indicators-client
66Terminal=false
77Icon=
tests/autopilot/unity8/fixture_setup.py+11−9
@@ -19,6 +19,7 @@
1919
2020import fixtures
2121import subprocess
22+import logging
2223
2324from autopilot import introspection
2425
@@ -28,6 +29,7 @@ from unity8 import (
2829)
2930from unity8.shell import emulators
3031
32+logger = logging.getLogger(__name__)
3133
3234class LaunchDashApp(fixtures.Fixture):
3335
@@ -104,16 +106,17 @@ class LaunchMockIndicatorService(fixtures.Fixture):
104106
105107 """Fixture to launch the indicator test service."""
106108
107− def __init__(self, variables, ensure_not_running=True):
109+ def __init__(self, action_delay, ensure_not_running=True):
108110 """Initialize an instance.
109111
110− :param variables: The variables to use when launching the app.
111− :type variables: A dictionary.
112+ :param action_delay: The delay to use when activating actions.
113+ Measured in milliseconds. Value of -1 will result in infinite delay.
114+ :type action_delay: An integer.
112115 :param boolean ensure_not_running: Make sure service is not running
113116
114117 """
115118 super(LaunchMockIndicatorService, self).__init__()
116− self.variables = variables
119+ self.action_delay = action_delay
117120 self.ensure_not_running = ensure_not_running
118121
119122 def setUp(self):
@@ -124,16 +127,15 @@ class LaunchMockIndicatorService(fixtures.Fixture):
124127 self.application_proxy = self.launch_service()
125128
126129 def launch_service(self):
130+ logger.info("Starting unity-mock-indicator-service")
127131 binary_path = get_binary_path('unity-mock-indicator-service')
128132 binary_arg = 'BINARY={}'.format(binary_path)
129− testability_arg = 'QT_LOAD_TESTABILITY={}'.format(1)
130− env_args = [
131− '{}={}'.format(key, value) for key, value in self.variables.items()
132− ]
133− all_args = [binary_arg, testability_arg] + env_args
133+ env_args = 'ARGS=-t {}'.format(self.action_delay)
134+ all_args = [binary_arg, env_args]
134135 process_helpers.start_job('unity-mock-indicator-service', *all_args)
135136
136137 def stop_service(self):
138+ logger.info("Stopping unity-mock-indicator-service")
137139 process_helpers.stop_job('unity-mock-indicator-service')
138140
139141 def ensure_service_not_running(self):
tests/autopilot/unity8/indicators/tests/test_action_latency.py+8−11
@@ -38,10 +38,7 @@ class TestIndicatorBaseTestCase(tests.IndicatorTestCase):
3838 def setUp(self):
3939 super(TestIndicatorBaseTestCase, self).setUp()
4040
41− environment = {}
42− environment['ARGS'] = '-t {0}'\
43− .format(self.action_delay)
44− self.launch_indicator_service(environment)
41+ self.launch_indicator_service()
4542
4643 # wait for the indicator to appear in unity
4744 self.indicator = indicators.TestIndicator(self.main_window)
@@ -51,8 +48,8 @@ class TestIndicatorBaseTestCase(tests.IndicatorTestCase):
5148 )
5249 self.indicator_page = self.indicator.open()
5350
54− def launch_indicator_service(self, variables):
55− launch_service_fixture = fixture_setup.LaunchMockIndicatorService(variables)
51+ def launch_indicator_service(self):
52+ launch_service_fixture = fixture_setup.LaunchMockIndicatorService(self.action_delay)
5653 self.useFixture(launch_service_fixture)
5754
5855
@@ -61,9 +58,9 @@ class TestServerValueUpdate(TestIndicatorBaseTestCase):
6158 """Test that an action causes the server to update"""
6259
6360 time_scenarios = [
64− ('Low', dict(action_delay=0)),
65− ('Medium', dict(action_delay=2500)),
66− ('High', dict(action_delay=8000)),
61+ ('Low', {'action_delay': 0}),
62+ ('Medium', {'action_delay': 2500}),
63+ ('High', {'action_delay': 8000}),
6764 ]
6865 scenarios = multiply_scenarios(
6966 time_scenarios,
@@ -106,7 +103,7 @@ class TestBuffering(TestIndicatorBaseTestCase):
106103 """
107104 action_delay = 2500
108105
109− def test_buffered_switch(self):
106+ def test_switch_buffers_actvations(self):
110107
111108 switch = self.indicator_page.get_switcher()
112109 switch.change_state()
@@ -142,7 +139,7 @@ class TestBuffering(TestIndicatorBaseTestCase):
142139 Equals(switch_menu.serverChecked)
143140 )
144141
145− def test_buffered_slider(self):
142+ def test_slider_buffers_activations(self):
146143
147144 slider = self.indicator_page.get_slider()
148145 original_value = slider.value;
tests/mocks/indicator-service/CMakeLists.txt+1−5
@@ -8,12 +8,8 @@ include_directories(
88 ${GIO_INCLUDE_DIRS}
99)
1010
11−set(MOCK_INDICATOR_SERVICE_SRC
12− mock-indicator-service.c
13−)
14−
1511add_executable(${MOCK_INDICATOR_SERVICE_APP}
16− ${MOCK_INDICATOR_SERVICE_SRC}
12+ mock-indicator-service.c
1713)
1814
1915target_link_libraries(${MOCK_INDICATOR_SERVICE_APP} ${GIO_LDFLAGS})