1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
|
'**************************************************************************
' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
'
' Copyright 2000, 2010 Oracle and/or its affiliates.
'
' OpenOffice.org - a multi-platform office productivity suite
'
' This file is part of OpenOffice.org.
'
' OpenOffice.org is free software: you can redistribute it and/or modify
' it under the terms of the GNU Lesser General Public License version 3
' only, as published by the Free Software Foundation.
'
' OpenOffice.org is distributed in the hope that it will be useful,
' but WITHOUT ANY WARRANTY; without even the implied warranty of
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' GNU Lesser General Public License version 3 for more details
' (a copy is included in the LICENSE file that accompanied this code).
'
' You should have received a copy of the GNU Lesser General Public License
' version 3 along with OpenOffice.org. If not, see
' <http://www.openoffice.org/license.html>
' for a copy of the LGPLv3 License.
'
'/************************************************************************
'*
'* owner : helge.delfs@oracle.com
'*
'* short description : Writer Undo/Redo - Test
'*
'\***********************************************************************
testcase tEditUndoRedo
'/// Edit / Undo - Redo ///
PrintLog "- Edit / Undo - Redo"
Printlog " - Set Undobuffer to 2"
'/// Call Options and Set Number of steps to 2 ///
ToolsOptions
Call hToolsOptions("StarOffice","Memory")
UndoSteps.SetText "2"
'/// Close Optionsdialog ///
Kontext "ExtrasOptionenDlg"
ExtrasOptionenDlg.OK
'/// New document ///
Call hNewDocument
'/// Write any text in document and insert a table ///
Call wTypeKeys "Clipboard"
Call hTabelleEinfuegen
Call wTypeKeys "<Down><Down>text"
'/// Call Edit / Undo 2 times ///
printlog " - Undo 2 times"
EditUndo
Sleep 1
EditUndo
Sleep 1
'/// try Undo more than two 2 times ///
try
EditUndo
Sleep 1
Warnlog "Possible to perform Undo more than 2 times!"
EditRedo
catch
Sleep 1
endcatch
'/// Check if Undo has been worked correctly ///
Call wTypeKeys "<Shift Home>"
EditCopy
if GetClipboardText <> "Clipboard" then Warnlog "Undo is not working correct"
Call wTypeKeys "<End>"
'/// select Redo 2 times ///
printlog " - Redo 2 times"
EditRedo
Sleep 1
EditRedo
Sleep 1
'/// try Redo more than 2 times ///
try
EditRedo
Warnlog "Able to perform Redo more than 2 times"
catch
Sleep 1
endcatch
EditCopy
if GetClipboardText <> "text" then Warnlog "Redo is not working correct"
'/// Close document ///
Call hCloseDocument
Sleep 2
'/// Select Options again and try to set Undobuffer to 0 (min should be 1) ///
Printlog " - set Undobuffer to 0"
ToolsOptions
Call hToolsOptions("StarOffice","Memory")
UndoSteps.ToMin
if UndoSteps.GetText <> "1" then
Warnlog "Undobuffer has not been set to 1!"
else
Printlog " - Undobuffer can only set to 1!"
end if
'/// Close Optionsdialog ///
Kontext "ExtrasOptionenDlg"
ExtrasOptionenDlg.OK
'/// New document ///
Call hNewDocument
Call wTypeKeys "Don't undo this<Return>Undo this"
'/// Insert any text and try to Undo more than 1 time ///
EditUndo
try
EditUndo
Warnlog "More than one Undo could be performed!"
catch
endcatch
Call wTypeKeys "<Shift Home>"
Wait 500
EditCopy
if GetClipboardText <> "Undo " then Warnlog "The UndoStep couldn't performed correct!"
'/// Close document ///
Call hCloseDocument
Printlog " - Set Undobuffer to Default ( 20 )"
'/// Open options again and set Number of steps for Undo to default (20) ///
ToolsOptions
Call hToolsOptions("StarOffice","Memory")
UndoSteps.SetText "20"
'/// Close Options ///
Kontext "ExtrasOptionenDlg"
ExtrasOptionenDlg.OK
endcase
' -----------------------------------------------------------------------------------
testcase tEditUndoTOX
QaErrorLog "tEditUndoTOX outcommented due to makeover."
goto endsub
Dim CompareThis as string, Compare1 as string, Compare2 as string, Compare3 as string
Dim CompareWith1 as string, CompareWith2 as string, MenuEntryEnabled as boolean
' Strings depends on the language so this testcase has to be adapted for all languages
Select Case iSprache
Case 1: Compare1 = "Undo: "
Compare2 = "Insert index/table"
Compare3 = "Remove index/table"
Case 49:Compare1 = "R�ckg�ngig"
Compare2 = "Einf�gen Verzeichnis"
Compare3 = "Verzeichnis aufheben"
Case else:
QAErrorlog "Please adapt this testcase for this language!"
Compare1 = "Undo: "
Compare2 = "Insert index/table"
Compare3 = "Remove index/table"
end select
CompareWith1 = Compare1 & Compare2
CompareWith2 = Compare1 & Compare3
'/// Open a new writerdocument
Call hNewDocument
'/// Insert an index in document
printlog "Insert Index"
InsertIndexes
Kontext
Active.Setpage TabVerzeichnisseVerzeichnis
Kontext "TabVerzeichnisseVerzeichnis"
Verzeichnistitel.Settext "MyUndoRedoIndex"
TabVerzeichnisseVerzeichnis.Ok
'/// Check if Edit/Undo menu shows 'Undo: Insert Index'
Call hUseMenu()
try
MenuSelect(Menugetitemid(2)) ' Opens the Edit - Menu
MenuEntryEnabled = True
catch
MenuEntryEnabled = False
endcatch
if MenuEntryEnabled = True then
CompareThis = hhEntferneTilde(MenuGetItemText(Menugetitemid(1)))
Call MenuSelect(0)
if CompareWith1 > "" then
if CompareThis <> CompareWith1 then
Warnlog "Edit / Undo entry is wrong: " & CompareThis
else
printlog " - Menu Edit / Undo is ok"
end if
else
QAErrorLog "Use this string in this testcase: " & CompareThis
Call hCloseDocument
goto endsub
end if
else
Warnlog "Edit / Undo in menu is disabled !"
end if
Kontext "DocumentWriter"
DocumentWriter.TypeKeys "<Up><Home>"
Wait 500
'/// Check if Undo dropdown-Icon shows: 'Insert index'
Select Case CheckUndoEntry ( 1, Compare2 )
Case 0: Warnlog " - Undo-dropdown is disabled!"
Case 1: Warnlog " - Entry in Undo-dropdown is wrong!"
Case 2: printlog " - Entry in Undo-dropdown is ok!"
end select
'/// Update index with context menu entry: Update index"
Kontext "DocumentWriter"
DocumentWriter.OpenContextMenu
' Update Index/table in context menu
printlog "Update Index"
Call MenuSelect(Menugetitemid(7))
'/// Check if Edit/Undo menu shows 'Undo: Insert Index' after index update
Call hUseMenu()
try
MenuSelect(Menugetitemid(2)) ' Opens the Edit - Menu
MenuEntryEnabled = True
catch
MenuEntryEnabled = False
endcatch
if MenuEntryEnabled = True then
CompareThis = hhEntferneTilde(MenuGetItemText(Menugetitemid(1)))
Call MenuSelect(0)
if CompareWith1 > "" then
if CompareThis <> CompareWith1 then
Warnlog "Edit / Undo entry is wrong: " & CompareThis
else
printlog " - Menu Edit / Undo is ok"
end if
else
QAErrorLog "Use this string in this testcase: " & CompareThis
Call hCloseDocument
goto endsub
end if
else
Warnlog "Edit / Undo in menu is disabled !"
end if
Kontext "DocumentWriter"
DocumentWriter.TypeKeys "<Up><Home>"
Wait 500
'/// Check if Undo dropdown-Icon shows: 'Insert index' after index update
Select Case CheckUndoEntry ( 1, Compare2 )
Case 0: Warnlog " - Undo-dropdown is disabled!"
Case 1: Warnlog " - Entry in Undo-dropdown is wrong!"
Case 2: printlog " - Entry in Undo-dropdown is ok!"
end select
'/// Delete index with context menu entry: Delete index"
Kontext "DocumentWriter"
DocumentWriter.OpenContextMenu
' Delete Index/table in context menu
printlog "Remove Index"
Call MenuSelect(Menugetitemid(9))
'/// Check if Edit/Undo menu shows 'Undo: Remove index' after deleting index
Call hUseMenu()
try
MenuSelect(Menugetitemid(2)) ' Opens the Edit - Menu
MenuEntryEnabled = True
catch
MenuEntryEnabled = False
endcatch
if MenuEntryEnabled = True then
CompareThis = hhEntferneTilde(MenuGetItemText(Menugetitemid(1)))
Call MenuSelect(0)
if CompareWith2 > "" then
if CompareThis <> CompareWith2 then
Warnlog "Edit / Undo entry is wrong: " & CompareThis
else
printlog " - Menu Edit / Undo is ok"
end if
else
QAErrorLog "Use this string in this testcase: " & CompareThis
Call hCloseDocument
goto endsub
end if
else
Warnlog "Edit / Undo in menu is disabled !"
end if
Kontext "DocumentWriter"
DocumentWriter.TypeKeys "<Up><Home>"
Wait 500
'/// Check if Undo dropdown-Icon shows: 'Remove index' after deleting index
Select Case CheckUndoEntry ( 1, Compare3 )
Case 0: Warnlog " - Undo-dropdown is disabled!"
Case 1: Warnlog " - Entry in Undo-dropdown is wrong!"
Case 2: printlog " - Entry in Undo-dropdown is ok!"
end select
printlog "Working undo"
'/// Edit / Undo 1 time -> Index should be restored
EditUndo
Sleep 1
Call wNavigatorAuswahl ( 10, 1 )
wait 500
InsertIndexes
wait 500
Kontext
try
Active.Setpage TabVerzeichnisseVerzeichnis
catch
Warnlog "Index dialog has not been opened!"
Call hCloseDocument
goto endsub
endcatch
Kontext "TabVerzeichnisseVerzeichnis"
if Verzeichnistitel.Gettext = "MyUndoRedoIndex" then
printlog " - Index has been restored"
TabVerzeichnisseVerzeichnis.Cancel
'/// Check if Undo dropdown-Icon shows: 'Insert index'
Select Case CheckUndoEntry ( 1, Compare2 )
Case 0: Warnlog " - Undo-dropdown is disabled!"
Case 1: Warnlog " - Entry in Undo-dropdown is wrong!"
Case 2: printlog " - Entry in Undo-dropdown is ok!"
end select
'/// Check if Redo dropdown-Icon shows: 'Remove index' after deleting index
Select Case CheckRedoEntry ( 1, Compare3 )
Case 0: Warnlog " - Redo-dropdown is disabled!"
Case 1: Warnlog " - Entry in Redo-dropdown is wrong!"
Case 2: printlog " - Entry in Redo-dropdown is ok!"
end select
'/// Edit / Undo one more time
'/// Check if Undo dropdown-Icon is disabled
Select Case CheckUndoEntry ( 1, Compare2 )
Case 0: printlog " - Undo-dropdown is disabled!"
Case 1: Warnlog " - Entry in Undo-dropdown is enabled!"
Case 2: Warnlog " - Entry in Undo-dropdown is enabled!"
end select
'/// Check if Redo dropdown-Icon shows: 'Insert index' after Undo 2 times
Select Case CheckRedoEntry ( 1, Compare2 )
Case 0: Warnlog " - Redo-dropdown is disabled!"
Case 1: Warnlog " - Entry in Redo-dropdown is wrong!"
Case 2: printlog " - Entry in Redo-dropdown is ok!"
end select
else
Warnlog "Index has not been removed!"
TabVerzeichnisseVerzeichnis.Cancel
end if
Call hCloseDocument
endcase
|