Unity 8
__init__.py
1 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2 #
3 # Unity Autopilot Test Suite
4 # Copyright (C) 2014, 2015 Canonical
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 from autopilot.matchers import Eventually
21 from testtools.matchers import Equals
22 from ubuntuuitoolkit import fixture_setup
23 
24 from unity8 import process_helpers
25 from unity8.shell import tests
26 
27 
28 class ApplicationLifeCycleTestCase(tests.UnityTestCase):
29 
30  def setUp(self):
31  super().setUp()
32  self._qml_mock_enabled = False
33  self._data_dirs_mock_enabled = False
34  self.launch_unity()
35  process_helpers.unlock_unity()
36 
37  def create_test_application(self):
38  desktop_file_dict = fixture_setup.DEFAULT_DESKTOP_FILE_DICT
39  desktop_file_dict.update({'X-Ubuntu-Single-Instance': 'true'})
40  fake_application = fixture_setup.FakeApplication(
41  desktop_file_dict=desktop_file_dict)
42  self.useFixture(fake_application)
43  return (
44  fake_application.qml_file_path, fake_application.desktop_file_path)
45 
46  def assert_current_focused_application(self, application_name):
47  self.assertThat(
48  self.main_window.get_current_focused_app_id,
49  Eventually(Equals(application_name)))