~artmello/gallery-app/badcontext_crash

« back to all changes in this revision

Viewing changes to tests/autopilot/goodhope/tests/__init__.py

added initial autopilot structure. No actual test yet.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
 
2
# Copyright 2012 Canonical
 
3
#
 
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.
 
7
 
 
8
"""goodhope autopilot tests."""
 
9
 
 
10
from os import remove
 
11
import os.path
 
12
 
 
13
from autopilot.introspection.qt import QtIntrospectionTestMixin
 
14
from autopilot.testcase import AutopilotTestCase
 
15
 
 
16
from goodhope.emulators.main_window import MainWindow
 
17
 
 
18
class GoodhopeTestCase(AutopilotTestCase, QtIntrospectionTestMixin):
 
19
 
 
20
    """A common test case class that provides several useful methods for goodhope tests."""
 
21
 
 
22
    def setUp(self):
 
23
        super(GoodhopeTestCase, self).setUp()
 
24
        # Lets assume we are installed system wide if this file is somewhere in /usr
 
25
        if os.path.realpath(__file__).startswith("/usr/"):
 
26
            self.launch_test_installed()
 
27
        else:
 
28
            self.launch_test_local()
 
29
 
 
30
    def launch_test_local(self):
 
31
        self.app = self.launch_test_application(
 
32
            "../../gallery"
 
33
            )
 
34
 
 
35
    def launch_test_installed(self):
 
36
        self.app = self.launch_test_application(
 
37
           "gallery",
 
38
           )
 
39
 
 
40
    @property
 
41
    def main_window(self):
 
42
        return MainWindow(self.app)
 
43