Lomiri
Loading...
Searching...
No Matches
test_url_dispatcher.py
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2#
3# Lomiri Autopilot Test Suite
4# Copyright (C) 2014, 2015 Canonical Ltd.
5#
6# This program is free software: you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation, either version 3 of the License, or
9# (at your option) any later version.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with this program. If not, see <http://www.gnu.org/licenses/>.
18#
19
20"""Test the integration with the URL dispatcher service."""
21
22import os
23import subprocess
24
25from autopilot import platform
26
27from lomiri.application_lifecycle import tests
28
29
30class URLDispatcherTestCase(tests.ApplicationLifeCycleTestCase):
31
32 def setUp(self):
33 if platform.model() == 'Desktop':
34 self.skipTest("URL dispatcher doesn't work on the desktop.")
35 super().setUp()
36
37 def test_swipe_out_application_started_by_url_dispatcher(self):
38 _, desktop_file_path = self.create_test_application()
39 desktop_file_name = os.path.basename(desktop_file_path)
40 application_name, _ = os.path.splitext(desktop_file_name)
41
42 self.assertEqual(
43 'lomiri-dash', self.main_window.get_current_focused_app_id())
44 self.addCleanup(os.system, 'pkill qmlscene')
45
46 subprocess.check_call(
47 ['url-dispatcher', 'application:///{}'.format(desktop_file_name)])
48 self.assert_current_focused_application(application_name)
49
50 self.main_window.show_dash_swiping()
51 self.assert_current_focused_application('lomiri-dash')