~ubuntu-branches/ubuntu/quantal/mago/quantal

« back to all changes in this revision

Viewing changes to mago/application/tsclient.py

  • Committer: Bazaar Package Importer
  • Author(s): Ara Pulido
  • Date: 2010-12-03 16:08:32 UTC
  • Revision ID: james.westby@ubuntu.com-20101203160832-97pz2nxwmo54iwfk
Tags: 0.3-0ubuntu3
* Updated from trunk
 + Added new applications to our tests base
 + Fixes LP: #682845 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
PACKAGE = "mago"
 
2
 
 
3
#-*- coding:utf-8 -*-
 
4
"""
 
5
This is the "tsclient" module.
 
6
 
 
7
This module provides a wrapper for LDTP to make writing Tsclient tests easier.
 
8
"""
 
9
import ooldtp
 
10
import ldtp
 
11
import os
 
12
from .main import Application
 
13
from ..gconfwrapper import GConf
 
14
from ..cmd import globals
 
15
import time
 
16
import gettext
 
17
 
 
18
gettext.install (True)
 
19
gettext.bindtextdomain (PACKAGE, globals.LOCALE_SHARE)
 
20
gettext.textdomain (PACKAGE)
 
21
t = gettext.translation(PACKAGE, globals.LOCALE_SHARE, fallback = True)
 
22
_ = t.gettext
 
23
 
 
24
 
 
25
class Tsclient(Application):
 
26
    """
 
27
    tsclient manages the Tsclient application.
 
28
    """
 
29
 
 
30
    LAUNCHER = 'tsclient'
 
31
    LAUNCHER_ARGS = []
 
32
    WINDOW = 'frmTerminalServerClient'
 
33
 
 
34
    BTN_0 = _('btn0')
 
35
    BTN_ABOUT = _('btnAbout')
 
36
    BTN_CLOSE = _('btnClose')
 
37
    BTN_CONNECT = _('btnConnect')
 
38
    BTN_OPEN = _('btnOpen')
 
39
    BTN_SAVEAS = _('btnSaveAs')
 
40
    MNU_1024X768PIXELS = _('mnu1024x768pixels')
 
41
    MNU_1152X864PIXELS = _('mnu1152x864pixels')
 
42
    MNU_1280X960PIXELS = _('mnu1280x960pixels')
 
43
    MNU_1400X1050PIXELS = _('mnu1400x1050pixels')
 
44
    MNU_256COLORS = _('mnu256Colors')
 
45
    MNU_640X480PIXELS = _('mnu640x480pixels')
 
46
    MNU_800X600PIXELS = _('mnu800x600pixels')
 
47
    MNU_HIGHCOLOR_15BIT_ = _('mnuHighColor*15bit*')
 
48
    MNU_HIGHCOLOR_16BIT_ = _('mnuHighColor*16bit*')
 
49
    MNU_ICA = _('mnuICA')
 
50
    MNU_INFULLSCREENMODEONLY = _('mnuInfullscreenmodeonly')
 
51
    MNU_ONTHELOCALCOMPUTER = _('mnuOnthelocalcomputer')
 
52
    MNU_ONTHEREMOTECOMPUTER = _('mnuOntheremotecomputer')
 
53
    MNU_QUICKCONNECT = _('mnuQuickConnect')
 
54
    MNU_RDP = _('mnuRDP')
 
55
    MNU_RDPV5 = _('mnuRDPv5')
 
56
    MNU_TRUECOLOR_24BIT_ = _('mnuTrueColor*24bit*')
 
57
    MNU_VNC = _('mnuVNC')
 
58
    MNU_XDMCP = _('mnuXDMCP')
 
59
    TXT_6 = _('txt6')
 
60
    TXT_7 = _('txt7')
 
61
    TXT_8 = _('txt8')
 
62
    TXT_CLIENTHOSTNAME = _('txtClientHostname')
 
63
    TXT_COMPUTER = _('txtComputer')
 
64
    TXT_DOMAIN = _('txtDomain')
 
65
    TXT_PROTOCOLFILE = _('txtProtocolFile')
 
66
    TXT_USERNAME = _('txtUserName')
 
67
 
 
68
 
 
69
    def runAboutdialog(self):
 
70
        """
 
71
        This basic test simply verifies that the application launches
 
72
        and that the UI reacts
 
73
        The About dialog is the only menu that is always present in the UI
 
74
        """
 
75
        if self.BTN_ABOUT:
 
76
            self.main_window.click(self.BTN_ABOUT)
 
77
 
 
78
            # Wait for the dialog to open
 
79
            # Name of about dialogs change with the app
 
80
            timeout=60
 
81
            dlgAbout=None
 
82
            while not ( timeout>0 and dlgAbout):
 
83
                dlgs=[ w for w in ldtp.getwindowlist() if w.startswith('dlgAbout')]
 
84
                if dlgs:
 
85
                    dlgAbout = dlgs[0]
 
86
                timeout -= 1
 
87
                time.sleep(1)
 
88
 
 
89
            if not dlgAbout:
 
90
                raise AssertionError('About Dialog not found')
 
91
 
 
92
 
 
93
            # Looking for a button to close the window
 
94
            found = None
 
95
            for btnClose in ('btnClose', 'btnOK', 'btnCancel'):
 
96
                try:
 
97
                    found = ldtp.getchild(dlgAbout, btnClose, 'push button')
 
98
                    break
 
99
                except:
 
100
                    pass
 
101
 
 
102
            if not found:
 
103
                return
 
104
 
 
105
            ldtp.click(dlgAbout, btnClose)
 
106
 
 
107
    def close(self):
 
108
        self.main_window.click(self.BTN_CLOSE)
 
109
 
 
110
    def __init__(self):
 
111
        Application.__init__(self)
 
112
        self.main_window = ooldtp.context(self.WINDOW)