100
100
Given an application, it tries to close it.
103
app = ooldtp.context(self.name)
105
close_widget = app.getchild(self.close_name)
106
except ldtp.LdtpExecutionError:
107
raise ldtp.LdtpExecutionError, "The " + self.close_name + " widget was not found."
102
app = ooldtp.context(self.name)
103
close_widget = app.getchild(self.close_name)
109
if self.close_type == 'menu':
110
close_widget.selectmenuitem()
111
elif self.close_type == 'button':
114
raise ldtp.LdtpExecutionError, "Wrong close item type."
115
response = ldtp.waittillguinotexist(self.name, '', 20)
117
raise ldtp.LdtpExecutionError, "Mmm, something went wrong when closing the application."
118
except ldtp.LdtpExecutionError, msg:
119
raise ldtp.LdtpExecutionError, "Mmm, something went wrong when closing the application: " + str(msg)
105
if self.close_type == 'menu':
106
close_widget.selectmenuitem()
107
elif self.close_type == 'button':
110
raise ldtp.LdtpExecutionError, "Wrong close item type."
112
response = ldtp.waittillguinotexist(self.name, '', 20)
114
raise ldtp.LdtpExecutionError, "Mmm, something went wrong when closing the application."
121
116
def save(self, save_menu=_('mnuSave')):
126
121
@type save_menu: string
127
122
@param save_menu: The name of the Save menu of the application. If not mentioned the default will be used ("Save").
130
app = ooldtp.context(self.name)
132
actualMenu = app.getchild(save_menu)
133
except ldtp.LdtpExecutionError:
134
raise ldtp.LdtpExecutionError, "The " + save_menu + " menu was not found."
124
app = ooldtp.context(self.name)
125
actualMenu = app.getchild(save_menu)
136
actualMenu.selectmenuitem()
137
except ldtp.LdtpExecutionError:
138
raise ldtp.LdtpExecutionError, "Mmm, something went wrong when saving the current document."
127
actualMenu.selectmenuitem()
140
129
def write_text(self, text, txt_field=''):
144
133
app = ooldtp.context(self.name)
146
135
if txt_field == '':
148
ldtp.enterstring(text)
149
except ldtp.LdtpExecutionError:
150
raise ldtp.LdtpExecutionError, "We couldn't write text."
136
ldtp.enterstring(text)
153
app_txt_fields = app.getchild(txt_field, "text")
154
except ldtp.LdtpExecutionError:
155
raise ldtp.LdtpExecutionError, "The " + txt_field + " text field was not found."
157
for field in app_txt_fields:
158
field.settextvalue(text)
159
except ldtp.LdtpExecutionError:
160
raise ldtp.LdtpExecutionError, "We couldn't write text."
138
app_txt_fields = app.getchild(txt_field, "text")
139
for field in app_txt_fields:
140
field.settextvalue(text)
162
142
def _enable_a11y(self, enable):
163
143
os.environ['NO_GAIL'] = str(int(not enable))