@@ -21,15 +21,21 @@
22from __future__ import absolute_import
22from __future__ import absolute_import
24−from unity8.process_helpers import unlock_unity
24+import logging
25−from unity8.shell import disable_qml_mocking
25+import os
26−from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
28from autopilot.matchers import Eventually
27from autopilot.matchers import Eventually
29from autopilot.platform import model
28from autopilot.platform import model
30from testtools.matchers import Equals, NotEquals
29from testtools.matchers import Equals, NotEquals
30+from ubuntuuitoolkit import (
32+ emulators as toolkit_emulators,
35+from unity8.process_helpers import unlock_unity
36+from unity8.shell import disable_qml_mocking
37+from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
34logger = logging.getLogger(__name__)
40logger = logging.getLogger(__name__)
@@ -72,18 +78,30 @@ class ApplicationLifecycleTests(UnityTestCase):
72 app_type='qt'
78 app_type='qt'
81+ def launch_fake_app(self):
82+ qml_file_path, desktop_file_path = self.create_test_application()
83+ desktop_file_name = os.path.basename(desktop_file_path)
84+ application_name, _ = os.path.splitext(desktop_file_name)
85+ self.launch_test_application(
86+ base.get_qmlscene_launch_command(),
88+ '--desktop_file_hint={0}'.format(
90+ emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase,
92+ return application_name
75 @disable_qml_mocking
94 @disable_qml_mocking
76 def test_can_launch_application(self):
95 def test_can_launch_application(self):
77 """Must be able to launch an application."""
96 """Must be able to launch an application."""
78 unity_proxy = self.launch_unity()
97 unity_proxy = self.launch_unity()
79 unlock_unity(unity_proxy)
98 unlock_unity(unity_proxy)
81− app = self._launch_app("messaging-app")
100+ application_name = self.launch_fake_app()
83− self.assertThat(app, NotEquals(None))
84 self.assertThat(
102 self.assertThat(
85 self.main_window.get_current_focused_app_id(),
103 self.main_window.get_current_focused_app_id(),
86− Eventually(Equals("messaging-app"))
104+ Eventually(Equals(application_name))
89 @disable_qml_mocking
107 @disable_qml_mocking