~dpm/ubuntu-terminal-app/enable-translations

« back to all changes in this revision

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

  • Committer: Tarmac
  • Author(s): nskaggs
  • Date: 2013-08-09 20:18:47 UTC
  • mfrom: (18.1.6 ubuntu-terminal-app)
  • Revision ID: tarmac-20130809201847-oiam1wcvdnud4vhq
This converts the terminal ap tests to the ubuntusdk emulator as well as cleans up and fixes all the tests; including the color scheme check. Fixes: https://bugs.launchpad.net/bugs/1188841.

Approved by Ubuntu Phone Apps Jenkins Bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
 
8
8
"""Terminal app autopilot tests."""
9
9
 
 
10
import sqlite3
10
11
import os.path
11
 
import sqlite3
12
12
 
13
13
from autopilot.input import Mouse, Touch, Pointer
14
14
from autopilot.platform import model
15
15
from autopilot.testcase import AutopilotTestCase
 
16
from ubuntuuitoolkit import emulators as toolkit_emulators
16
17
 
17
 
from ubuntu_terminal_app.emulators.main_window import MainWindow
18
 
from ubuntu_terminal_app.emulators.ubuntusdk import ubuntusdk
 
18
from ubuntu_terminal_app import emulators
19
19
 
20
20
 
21
21
class TerminalTestCase(AutopilotTestCase):
22
22
 
23
 
    """A common test case class that provides several useful methods for
24
 
    terminal-app tests.
 
23
    """A common testcase class that provides useful methods for the terminal
 
24
    app.
25
25
 
26
26
    """
27
27
    if model() == 'Desktop':
34
34
    def setUp(self):
35
35
        self.pointing_device = Pointer(self.input_device_class.create())
36
36
        super(TerminalTestCase, self).setUp()
 
37
 
37
38
        if os.path.exists(self.local_location):
38
39
            self.launch_test_local()
39
40
        else:
43
44
        self.app = self.launch_test_application(
44
45
            "qmlscene",
45
46
            self.local_location,
46
 
            app_type='qt')
 
47
            app_type='qt',
 
48
            emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase)
47
49
 
48
50
    def launch_test_installed(self):
49
51
        self.app = self.launch_test_application(
50
52
            "qmlscene",
51
53
            "/usr/share/ubuntu-terminal-app/ubuntu-terminal-app.qml",
52
 
            "--desktop_file_hint=/usr/share/applications/ubuntu-terminal-app.desktop",
53
 
            app_type='qt')
54
 
 
55
 
    @property
56
 
    def main_window(self):
57
 
        return MainWindow(self, self.app)
58
 
 
59
 
    @property
60
 
    def ubuntu_sdk(self):
61
 
        return ubuntusdk(self, self.app)
62
 
 
 
54
            "--desktop_file_hint="
 
55
            "/usr/share/applications/ubuntu-terminal-app.desktop",
 
56
            app_type='qt',
 
57
            emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase)
 
58
 
 
59
    @property
 
60
    def main_view(self):
 
61
        return self.app.select_single(emulators.MainView)
63
62
 
64
63
class DbMan(object):
65
64
    """
99
98
        conn = sqlite3.connect(db)
100
99
 
101
100
        with conn:
102
 
            cur = conn.cursor()    
 
101
            cur = conn.cursor()
103
102
            cur.execute("SELECT value FROM config WHERE item='fontSize'")
104
103
            row = cur.fetchone()
105
104
            if row is None:
106
105
                self.assertNotEquals(row, None)
107
106
            return int(row[0])
108
 
            
 
107
 
109
108
    def get_color_scheme_from_storage(self):
110
109
        db = self.get_db()
111
110
        conn = sqlite3.connect(db)
112
111
 
113
112
        with conn:
114
 
            cur = conn.cursor()    
 
113
            cur = conn.cursor()
115
114
            cur.execute("SELECT value FROM config WHERE item='colorScheme'")
116
115
            row = cur.fetchone()
117
116
            if row is None: