~ubuntu-branches/ubuntu/natty/mago/natty

« back to all changes in this revision

Viewing changes to mago/application/main.py

  • Committer: Bazaar Package Importer
  • Author(s): Ara Pulido
  • Date: 2010-04-14 14:05:34 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20100414140534-grv0bwv9wv97khir
Tags: 0.2-0ubuntu1
* Mago tests updated for Lucid
  + Fixes arguments handling (LP: #562965)
  + Fixes seahorse tests (LP: #552618)
  + Fixes ubuntu-menu tests (LP: #551492)

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
    Superclass for the rest of the applications
11
11
 
12
12
    Constants that should be defined in the classes that inherit from this class
13
 
    LAUNCHER: Argument to be passed when launching the application through ldtp.launchapp
 
13
    LAUNCHER: Command to launching the application through ldtp.launchapp
 
14
    LAUNCHER_ARGS: Arguments to pass when launching the application through
 
15
                   ldtp.launchapp.
14
16
    WINDOW: Top application frame pattern using ldtp syntax
15
17
    CLOSE_TYPE: Close object type (one of 'menu' or 'button')
16
18
    CLOSE_NAME: Close object name
17
19
    """
18
20
    CLOSE_TYPE = 'menu'
19
21
    CLOSE_NAME = 'mnuQuit'
 
22
    LAUNCHER_ARGS = []
20
23
    WINDOW     = ''
21
24
    TOP_PANEL = 'frmTopExpandedEdgePanel'
22
25
 
65
68
    def open(self):
66
69
        """
67
70
        Given an application, it tries to open it.
68
 
         
69
71
        """
70
72
        self._enable_a11y(True)
71
 
        ldtp.launchapp(self.LAUNCHER)
 
73
        ldtp.launchapp(self.LAUNCHER, args=self.LAUNCHER_ARGS)
72
74
        self._enable_a11y(False)
73
75
 
74
76
        ldtp.wait(2)
75
77
        response = ldtp.waittillguiexist(self.name, '', 20)
76
 
        
 
78
 
77
79
        if response == 0:
78
 
            raise ldtp.LdtpExecutionError, "The " + self.name + " window was not found."    
 
80
            raise ldtp.LdtpExecutionError, "The " + self.name + " window was not found."
79
81
 
80
82
    def is_opened(self):
81
83
        """
85
87
 
86
88
    def close(self):
87
89
        """
88
 
        Given an application, it tries to close it. 
 
90
        Given an application, it tries to close it.
89
91
        """
90
92
        try:
91
93
            app = ooldtp.context(self.name)
108
110
 
109
111
    def save(self, save_menu='mnuSave'):
110
112
        """
111
 
        Given an application, it tries to save the current document. 
 
113
        Given an application, it tries to save the current document.
112
114
        This method gives very basic functionality. Please, override this method in the subclasses for error checking.
113
 
         
 
115
 
114
116
        @type save_menu: string
115
117
        @param save_menu: The name of the Save menu of the application. If not mentioned the default will be used ("Save").
116
118
        """