diff -Nru autopilot-1.6.0+17.04.20170302/autopilot/display/__init__.py autopilot-1.6.0+17.04.20170313/autopilot/display/__init__.py --- autopilot-1.6.0+17.04.20170302/autopilot/display/__init__.py 2017-03-02 18:50:19.000000000 +0000 +++ autopilot-1.6.0+17.04.20170313/autopilot/display/__init__.py 2017-03-13 17:21:39.000000000 +0000 @@ -107,8 +107,8 @@ return Display() backends = OrderedDict() - backends['UPA'] = get_upa_display backends['X11'] = get_x11_display + backends['UPA'] = get_upa_display return _pick_backend(backends, preferred_backend) class BlacklistedDriverError(RuntimeError): diff -Nru autopilot-1.6.0+17.04.20170302/autopilot/input/__init__.py autopilot-1.6.0+17.04.20170313/autopilot/input/__init__.py --- autopilot-1.6.0+17.04.20170302/autopilot/input/__init__.py 2017-03-02 18:50:19.000000000 +0000 +++ autopilot-1.6.0+17.04.20170313/autopilot/input/__init__.py 2017-03-13 17:21:39.000000000 +0000 @@ -57,6 +57,9 @@ from collections import OrderedDict from contextlib import contextmanager + +import psutil + from autopilot.input._common import get_center_point from autopilot.utilities import _pick_backend, CleanupRegistered @@ -119,16 +122,21 @@ def get_osk_kb(): try: - from autopilot.input._osk import Keyboard - return Keyboard() + maliit = [p for p in + psutil.process_iter() if p.name() == 'maliit-server'] + if maliit: + from autopilot.input._osk import Keyboard + return Keyboard() + else: + raise RuntimeError('maliit-server is not running') except ImportError as e: e.args += ("Unable to import the OSK backend",) raise backends = OrderedDict() - backends['UInput'] = get_uinput_kb - backends['OSK'] = get_osk_kb backends['X11'] = get_x11_kb + backends['OSK'] = get_osk_kb + backends['UInput'] = get_uinput_kb return _pick_backend(backends, preferred_backend) @contextmanager diff -Nru autopilot-1.6.0+17.04.20170302/autopilot/tests/unit/test_display.py autopilot-1.6.0+17.04.20170313/autopilot/tests/unit/test_display.py --- autopilot-1.6.0+17.04.20170302/autopilot/tests/unit/test_display.py 1970-01-01 00:00:00.000000000 +0000 +++ autopilot-1.6.0+17.04.20170313/autopilot/tests/unit/test_display.py 2017-03-13 17:21:39.000000000 +0000 @@ -0,0 +1,33 @@ +# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- +# +# Autopilot Functional Test Tool +# Copyright (C) 2016 Canonical +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +import unittest +from unittest.mock import patch +from autopilot.display import Display + + +class DisplayTestCase(unittest.TestCase): + + @patch('autopilot.display._pick_backend') + def test_input_backends_default_order(self, pick_backend): + d = Display() + d.create() + + backends = list(pick_backend.call_args[0][0].items()) + self.assertTrue(backends[0][0] == 'X11') + self.assertTrue(backends[1][0] == 'UPA') diff -Nru autopilot-1.6.0+17.04.20170302/autopilot/tests/unit/test_input.py autopilot-1.6.0+17.04.20170313/autopilot/tests/unit/test_input.py --- autopilot-1.6.0+17.04.20170302/autopilot/tests/unit/test_input.py 2017-03-02 18:50:13.000000000 +0000 +++ autopilot-1.6.0+17.04.20170313/autopilot/tests/unit/test_input.py 2017-03-13 17:21:39.000000000 +0000 @@ -18,6 +18,7 @@ # import logging +import unittest import testscenarios from evdev import ecodes, uinput @@ -30,7 +31,7 @@ tests, utilities ) -from autopilot.input import _uinput, get_center_point +from autopilot.input import _uinput, get_center_point, Keyboard class Empty(object): @@ -1101,3 +1102,16 @@ self.assert_power_button_press_release_emitted_write_and_sync( device._device.mock_calls ) + + +class KeyboardTestCase(unittest.TestCase): + + @patch('autopilot.input._pick_backend') + def test_input_backends_default_order(self, pick_backend): + k = Keyboard() + k.create() + + backends = list(pick_backend.call_args[0][0].items()) + self.assertTrue(backends[0][0] == 'X11') + self.assertTrue(backends[1][0] == 'OSK') + self.assertTrue(backends[2][0] == 'UInput') diff -Nru autopilot-1.6.0+17.04.20170302/debian/changelog autopilot-1.6.0+17.04.20170313/debian/changelog --- autopilot-1.6.0+17.04.20170302/debian/changelog 2017-03-13 17:24:15.000000000 +0000 +++ autopilot-1.6.0+17.04.20170313/debian/changelog 2017-03-13 17:24:15.000000000 +0000 @@ -1,3 +1,10 @@ +autopilot (1.6.0+17.04.20170313-0ubuntu1) zesty; urgency=medium + + [ Tarmac ] + * New release + + -- Jean-Baptiste Lallement Mon, 13 Mar 2017 17:21:58 +0000 + autopilot (1.6.0+17.04.20170302-0ubuntu1) zesty; urgency=medium [ Santiago Baldassin, Tarmac ]