1
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2
# Copyright 2013 Canonical
4
# This program is free software: you can redistribute it and/or modify it
5
# under the terms of the GNU General Public License version 3, as published
6
# by the Free Software Foundation.
8
"""Docviewer app autopilot tests."""
12
from autopilot.input import Mouse, Touch, Pointer
13
from autopilot.platform import model
14
from autopilot.testcase import AutopilotTestCase
16
from ubuntu_docviewer_app.emulators.main_window import MainWindow
19
class DocviewerTestCase(AutopilotTestCase):
21
"""A common test case class that provides several useful methods for
25
if model() == 'Desktop':
26
scenarios = [('with mouse', dict(input_device_class=Mouse))]
28
scenarios = [('with touch', dict(input_device_class=Touch))]
30
local_location = "../../ubuntu-docviewer-app.qml"
33
self.pointing_device = Pointer(self.input_device_class.create())
34
super(DocviewerTestCase, self).setUp()
35
if os.path.exists(self.local_location):
36
self.launch_test_local()
38
self.launch_test_installed()
40
def launch_test_local(self):
41
self.app = self.launch_test_application(
46
def launch_test_installed(self):
47
self.app = self.launch_test_application(
49
"/usr/share/ubuntu-docviewer-app/ubuntu-docviewer-app.qml",
50
"--desktop_file_hint=/usr/share/applications/ubuntu-docviewer-app.desktop",
54
def main_window(self):
55
return MainWindow(self.app)