1 '**************************************************************************
2 '* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 '* Copyright 2008 by Sun Microsystems, Inc.
6 '* OpenOffice.org - a multi-platform office productivity suite
8 '* $RCSfile: w_undo1.inc,v $
12 '* last change: $Author: vg $ $Date: 2008-08-18 12:38:44 $
14 '* This file is part of OpenOffice.org.
16 '* OpenOffice.org is free software: you can redistribute it and/or modify
17 '* it under the terms of the GNU Lesser General Public License version 3
18 '* only, as published by the Free Software Foundation.
20 '* OpenOffice.org is distributed in the hope that it will be useful,
21 '* but WITHOUT ANY WARRANTY; without even the implied warranty of
22 '* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 '* GNU Lesser General Public License version 3 for more details
24 '* (a copy is included in the LICENSE file that accompanied this code).
26 '* You should have received a copy of the GNU Lesser General Public License
27 '* version 3 along with OpenOffice.org. If not, see
28 '* <http://www.openoffice.org/license.html>
29 '* for a copy of the LGPLv3 License.
31 '/************************************************************************
33 '* owner : helge.delfs@sun.com
35 '* short description : Writer Undo/Redo - Test
37 '************************************************************************
40 ' #1 tEditUndoTOX ' undo with table of contents
42 '\***********************************************************************
44 testcase tEditUndoRedo
45 '/// Edit / Undo - Redo ///
46 PrintLog "- Edit / Undo - Redo"
47 Printlog " - Set Undobuffer to 2"
48 '/// Call Options and Set Number of steps to 2 ///
50 Call hToolsOptions("StarOffice","Memory")
52 '/// Close Optionsdialog ///
53 Kontext "ExtrasOptionenDlg"
57 '/// Write any text in document and insert a table ///
58 Call wTypeKeys "Clipboard"
59 Call hTabelleEinfuegen
60 Call wTypeKeys "<Down><Down>text"
62 '/// Call Edit / Undo 2 times ///
63 printlog " - Undo 2 times"
68 '/// try Undo more than two 2 times ///
72 Warnlog "Possible to perform Undo more than 2 times!"
77 '/// Check if Undo has been worked correctly ///
78 Call wTypeKeys "<Shift Home>"
80 if GetClipboardText <> "Clipboard" then Warnlog "Undo is not working correct"
81 Call wTypeKeys "<End>"
83 '/// select Redo 2 times ///
84 printlog " - Redo 2 times"
89 '/// try Redo more than 2 times ///
92 Warnlog "Able to perform Redo more than 2 times"
97 if GetClipboardText <> "text" then Warnlog "Redo is not working correct"
98 '/// Close document ///
102 '/// Select Options again and try to set Undobuffer to 0 (min should be 1) ///
103 Printlog " - set Undobuffer to 0"
105 Call hToolsOptions("StarOffice","Memory")
107 if UndoSteps.GetText <> "1" then
108 Warnlog "Undobuffer has not been set to 1!"
110 Printlog " - Undobuffer can only set to 1!"
112 '/// Close Optionsdialog ///
113 Kontext "ExtrasOptionenDlg"
116 '/// New document ///
118 Call wTypeKeys "Don't undo this<Return>Undo this"
119 '/// Insert any text and try to Undo more than 1 time ///
124 Warnlog "More than one Undo could be performed!"
127 Call wTypeKeys "<Shift Home>"
130 if GetClipboardText <> "Undo " then Warnlog "The UndoStep couldn't performed correct!"
132 '/// Close document ///
135 Printlog " - Set Undobuffer to Default ( 20 )"
136 '/// Open options again and set Number of steps for Undo to default (20) ///
138 Call hToolsOptions("StarOffice","Memory")
139 UndoSteps.SetText "20"
141 '/// Close Options ///
142 Kontext "ExtrasOptionenDlg"
146 ' -----------------------------------------------------------------------------------
148 testcase tEditUndoTOX
149 QaErrorLog "tEditUndoTOX outcommented due to makeover."
152 Dim CompareThis as string, Compare1 as string, Compare2 as string, Compare3 as string
153 Dim CompareWith1 as string, CompareWith2 as string, MenuEntryEnabled as boolean
154 ' Strings depends on the language so this testcase has to be adapted for all languages
156 Case 1: Compare1 = "Undo: "
157 Compare2 = "Insert index/table"
158 Compare3 = "Remove index/table"
159 Case 49:Compare1 = "R�ckg�ngig"
160 Compare2 = "Einf�gen Verzeichnis"
161 Compare3 = "Verzeichnis aufheben"
163 QAErrorlog "Please adapt this testcase for this language!"
165 Compare2 = "Insert index/table"
166 Compare3 = "Remove index/table"
168 CompareWith1 = Compare1 & Compare2
169 CompareWith2 = Compare1 & Compare3
171 '/// Open a new writerdocument
174 '/// Insert an index in document
175 printlog "Insert Index"
179 Active.Setpage TabVerzeichnisseVerzeichnis
180 Kontext "TabVerzeichnisseVerzeichnis"
181 Verzeichnistitel.Settext "MyUndoRedoIndex"
182 TabVerzeichnisseVerzeichnis.Ok
184 '/// Check if Edit/Undo menu shows 'Undo: Insert Index'
187 MenuSelect(Menugetitemid(2)) ' Opens the Edit - Menu
188 MenuEntryEnabled = True
190 MenuEntryEnabled = False
192 if MenuEntryEnabled = True then
193 CompareThis = hhEntferneTilde(MenuGetItemText(Menugetitemid(1)))
195 if CompareWith1 > "" then
196 if CompareThis <> CompareWith1 then
197 Warnlog "Edit / Undo entry is wrong: " & CompareThis
199 printlog " - Menu Edit / Undo is ok"
202 QAErrorLog "Use this string in this testcase: " & CompareThis
207 Warnlog "Edit / Undo in menu is disabled !"
210 Kontext "DocumentWriter"
211 DocumentWriter.TypeKeys "<Up><Home>"
213 '/// Check if Undo dropdown-Icon shows: 'Insert index'
214 Select Case CheckUndoEntry ( 1, Compare2 )
215 Case 0: Warnlog " - Undo-dropdown is disabled!"
216 Case 1: Warnlog " - Entry in Undo-dropdown is wrong!"
217 Case 2: printlog " - Entry in Undo-dropdown is ok!"
220 '/// Update index with context menu entry: Update index"
221 Kontext "DocumentWriter"
222 DocumentWriter.OpenContextMenu
223 ' Update Index/table in context menu
224 printlog "Update Index"
225 Call MenuSelect(Menugetitemid(7))
227 '/// Check if Edit/Undo menu shows 'Undo: Insert Index' after index update
230 MenuSelect(Menugetitemid(2)) ' Opens the Edit - Menu
231 MenuEntryEnabled = True
233 MenuEntryEnabled = False
235 if MenuEntryEnabled = True then
236 CompareThis = hhEntferneTilde(MenuGetItemText(Menugetitemid(1)))
238 if CompareWith1 > "" then
239 if CompareThis <> CompareWith1 then
240 Warnlog "Edit / Undo entry is wrong: " & CompareThis
242 printlog " - Menu Edit / Undo is ok"
245 QAErrorLog "Use this string in this testcase: " & CompareThis
250 Warnlog "Edit / Undo in menu is disabled !"
253 Kontext "DocumentWriter"
254 DocumentWriter.TypeKeys "<Up><Home>"
256 '/// Check if Undo dropdown-Icon shows: 'Insert index' after index update
257 Select Case CheckUndoEntry ( 1, Compare2 )
258 Case 0: Warnlog " - Undo-dropdown is disabled!"
259 Case 1: Warnlog " - Entry in Undo-dropdown is wrong!"
260 Case 2: printlog " - Entry in Undo-dropdown is ok!"
263 '/// Delete index with context menu entry: Delete index"
264 Kontext "DocumentWriter"
265 DocumentWriter.OpenContextMenu
266 ' Delete Index/table in context menu
267 printlog "Remove Index"
268 Call MenuSelect(Menugetitemid(9))
270 '/// Check if Edit/Undo menu shows 'Undo: Remove index' after deleting index
273 MenuSelect(Menugetitemid(2)) ' Opens the Edit - Menu
274 MenuEntryEnabled = True
276 MenuEntryEnabled = False
278 if MenuEntryEnabled = True then
279 CompareThis = hhEntferneTilde(MenuGetItemText(Menugetitemid(1)))
281 if CompareWith2 > "" then
282 if CompareThis <> CompareWith2 then
283 Warnlog "Edit / Undo entry is wrong: " & CompareThis
285 printlog " - Menu Edit / Undo is ok"
288 QAErrorLog "Use this string in this testcase: " & CompareThis
293 Warnlog "Edit / Undo in menu is disabled !"
296 Kontext "DocumentWriter"
297 DocumentWriter.TypeKeys "<Up><Home>"
299 '/// Check if Undo dropdown-Icon shows: 'Remove index' after deleting index
300 Select Case CheckUndoEntry ( 1, Compare3 )
301 Case 0: Warnlog " - Undo-dropdown is disabled!"
302 Case 1: Warnlog " - Entry in Undo-dropdown is wrong!"
303 Case 2: printlog " - Entry in Undo-dropdown is ok!"
306 printlog "Working undo"
307 '/// Edit / Undo 1 time -> Index should be restored
310 Call wNavigatorAuswahl ( 10, 1 )
317 Active.Setpage TabVerzeichnisseVerzeichnis
319 Warnlog "Index dialog has not been opened!"
324 Kontext "TabVerzeichnisseVerzeichnis"
325 if Verzeichnistitel.Gettext = "MyUndoRedoIndex" then
326 printlog " - Index has been restored"
327 TabVerzeichnisseVerzeichnis.Cancel
328 '/// Check if Undo dropdown-Icon shows: 'Insert index'
329 Select Case CheckUndoEntry ( 1, Compare2 )
330 Case 0: Warnlog " - Undo-dropdown is disabled!"
331 Case 1: Warnlog " - Entry in Undo-dropdown is wrong!"
332 Case 2: printlog " - Entry in Undo-dropdown is ok!"
335 '/// Check if Redo dropdown-Icon shows: 'Remove index' after deleting index
336 Select Case CheckRedoEntry ( 1, Compare3 )
337 Case 0: Warnlog " - Redo-dropdown is disabled!"
338 Case 1: Warnlog " - Entry in Redo-dropdown is wrong!"
339 Case 2: printlog " - Entry in Redo-dropdown is ok!"
342 '/// Edit / Undo one more time
343 '/// Check if Undo dropdown-Icon is disabled
344 Select Case CheckUndoEntry ( 1, Compare2 )
345 Case 0: printlog " - Undo-dropdown is disabled!"
346 Case 1: Warnlog " - Entry in Undo-dropdown is enabled!"
347 Case 2: Warnlog " - Entry in Undo-dropdown is enabled!"
350 '/// Check if Redo dropdown-Icon shows: 'Insert index' after Undo 2 times
351 Select Case CheckRedoEntry ( 1, Compare2 )
352 Case 0: Warnlog " - Redo-dropdown is disabled!"
353 Case 1: Warnlog " - Entry in Redo-dropdown is wrong!"
354 Case 2: printlog " - Entry in Redo-dropdown is ok!"
358 Warnlog "Index has not been removed!"
359 TabVerzeichnisseVerzeichnis.Cancel