1 'encoding UTF-8 Do not remove or change this line!
2 '**************************************************************************
3 '* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 '* Copyright 2008 by Sun Microsystems, Inc.
7 '* OpenOffice.org - a multi-platform office productivity suite
9 '* $RCSfile: w_undo_history_2.inc,v $
13 '* last change: $Author: rt $ $Date: 2008-09-04 09:20:32 $
15 '* This file is part of OpenOffice.org.
17 '* OpenOffice.org is free software: you can redistribute it and/or modify
18 '* it under the terms of the GNU Lesser General Public License version 3
19 '* only, as published by the Free Software Foundation.
21 '* OpenOffice.org is distributed in the hope that it will be useful,
22 '* but WITHOUT ANY WARRANTY; without even the implied warranty of
23 '* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 '* GNU Lesser General Public License version 3 for more details
25 '* (a copy is included in the LICENSE file that accompanied this code).
27 '* You should have received a copy of the GNU Lesser General Public License
28 '* version 3 along with OpenOffice.org. If not, see
29 '* <http://www.openoffice.org/license.html>
30 '* for a copy of the LGPLv3 License.
32 '/************************************************************************
34 '* owner : helge.delfs@sun.com
36 '* short description : Writer Undo-History - Test
38 '\***********************************************************************
42 ' a > 20 characters long string
43 Call tUndoOverwriteLong ' Typing & Overwrite
44 Call tUndoFindAndReplaceLong ' Replace
45 Call tUndoDeleteMultiSelection ' Delete a multi-selection
46 Call tUndoParagraph ' Paragraphs
47 Call tUndoClipboard ' Copy/Paste
48 Call tUndoChanges ' Changes accept an reject
49 Call tUndoLineBreak ' Manual breaks - line break
50 Call tUndoColumnBreak ' Manual breaks - column break
51 Call tUndoPageBreak ' Manual breaks - page break
52 Call tUndoFields ' Fields (Insert/Modify / Delete)
53 Call tUndoSpecialCharacter ' Special Character (Insert/ Delete)
54 Call tUndoStyles ' Styles (Apply/Modify/Find&Replace/Promote/Demote)
58 testcase tUndoOverwriteLong
60 '/// <B>Typing & overwrite a > 20 characters long string</B>
63 '/// <U><B>CHECK: Typing</B></U>
65 '/// write a > 20 characters long string: ThisSentenceHasMoreThan20Characters
66 Call wTypeKeys ( "ThisSentenceHasMoreThan20Characters" )
67 '/// string in Undo list has to be: Typing: ThisSente...aracters
68 Call CheckUndoStringInUndoList ( 1, "'ThisSent...racters'" )
70 '/// <U><B>CHECK: Overwrite</B></U>
71 printlog "- OVERWRITE"
73 Call wTypeKeys "<Home>"
75 Call wTypeKeys "<Insert>"
76 '/// write a > 20 characters long string: ThePreviousSentenceHasBeenOverwritten
77 Call wTypeKeys ( "ThePreviousSentenceHasBeenOverwritten" )
78 '/// string in Undo list has to be: Overwrite: ThePrevio...rwritten
79 Call CheckUndoStringInUndoList ( 2, "'ThePrevio...rwritten'" )
86 testcase tUndoFindAndReplaceLong
88 '/// <B>Replace a > 20 characters long string</B>
90 '/// <U><B>CHECK: Replace</B></U>
93 '/// write a > 20 characters long string: ThePreviousSentenceHasBeenOverwritten
94 Call wTypeKeys ( "ThePreviousSentenceHasBeenOverwritten" )
96 Call wTypeKeys ( "<Shift Home>" )
97 '/// Edit / Find and Replace
99 Kontext "FindAndReplace"
100 '/// Type 'ThisIsAboutALongTextThatHadToBeReplaced' in 'Replace with' field
101 ReplaceWith.Settext "ThisIsAboutALongTextThatHadToBeReplaced"
102 '/// Choose Button 'Replace' and close dialog
106 if Active.Exists then
107 if Active.GetRT = 304 then
115 Kontext "FindAndReplace"
117 Kontext "DocumentWriter"
118 '/// string in Undo list has to be: Replace: 'ThePrevio...rwritten' -> 'ThisIsAbo...Replaced'
119 Call CheckUndoStringInUndoList ( 3, "'ThePrevio...rwritten' -> 'ThisIsAbo...Replaced'" )
126 testcase tUndoDeleteMultiSelection
128 '/// <B>Delete a multi-selection</B>
129 printlog "- Delete a multi-selection"
132 '/// write down: the deletion of a multi-selection
133 Call wTypeKeys ( "the deletion of a multi-selection" )
134 '/// with Shift + F8 enter multi-selection mode
135 Call wTypeKeys ( "<SHIFT F8>" )
136 '/// multi-select "the ", " a" and "multi-"
137 Call wTypeKeys ( "<MOD1 Left>" )
138 Call wTypeKeys ( "<MOD1 SHIFT Left>", 2)
139 Call wTypeKeys ( "<Left>" )
140 Call wTypeKeys ( "<SHIFT Left>", 2)
141 Call wTypeKeys ( "<Left>" )
142 Call wTypeKeys ( "<MOD1 Left>", 2)
143 Call wTypeKeys ( "<Left>" )
144 Call wTypeKeys ( "<MOD1 SHIFT Left>")
145 '/// Delete the multi-selection
146 Call wTypeKeys ( "<DELETE>" )
147 '/// string in Undo-list has to be: 'Delete: multi-selection'"
148 Call CheckUndoStringInUndoList ( 4, "Delete multiple selection" )
155 testcase tUndoParagraph
157 '/// <B>Insert and delete a paragraph</B>
158 printlog "- Insert Paragraph"
161 '/// press return to insert a new paragraph
162 Call wTypeKeys ( "<Return>" )
163 '/// string in Undo-list has to be: "New paragraph"
164 Call CheckUndoStringInUndoList ( 8, "New Paragraph" )
165 printlog "- Delete Paragraph"
166 '/// press Backspace to delete paragraph
167 Call wTypeKeys ( "<Backspace>" )
168 '/// string in Undo-list has to be: "Delete paragraph"
169 Call CheckUndoStringInUndoList ( 8, "Delete Paragraph" )
176 testcase tUndoClipboard
179 '/// <B>Copy / Paste</B>
180 printlog "- Copy/Paste"
183 '/// Insert some text in document and copy it
184 Call wTypeKeys ( "CopyAndPasteInUndoList" )
185 Call wTypeKeys ( "<Shift Home>" )
187 Call wTypeKeys ( "<End><Return>" )
188 '/// Paste the text in all available formats
192 EditPasteSpecialWriter
196 Kontext "InhaltEinfuegen"
199 printlog " - Paste as: " + Auswahl.GetSeltext
202 Warnlog "Not 4 but " & Auswahl.GetItemCount & " Clipboard-formats"
205 '/// string in Undo-list has to be: "Paste clipboard"
206 Call CheckUndoStringInUndoList ( 9 )
207 Call wTypeKeys ( "<Return>" )
214 testcase tUndoChanges
216 '/// <B>Changes accept and reject</B>
217 printlog "- Changes accept and reject"
221 '/// Select Edit / Changes / Record
223 '/// Insert a string in document
224 Call wTypeKeys ( "This is a test" )
225 '/// Select Edit / Changes / Accept or Reject
226 EditChangesAcceptOrReject
227 '/// Dialog 'Accept or reject changes' has to come up ///
229 if Redlining.Exists then
230 '/// + Select tabpage 'List'
231 TabControl.SetPage TabListe
232 '/// + Select 'Accept All'
235 '/// + Close Redlining dialog
238 Warnlog "Redlining dialog not up!"
242 '/// string in Undo-list has to be: "Accept change: Insert 'this is a test'")
243 Call CheckUndoStringInUndoList ( 10, "Accept" )
245 '/// Insert a line break in document
246 Call wTypeKeys ( "<Return>" )
247 '/// Insert a string in document
248 Call wTypeKeys ( "This is a test" )
249 '/// Select Edit / Changes / Accept or Reject
250 EditChangesAcceptOrReject
251 '/// Dialog 'Accept or reject changes' has to come up ///
253 if Redlining.Exists then
254 '/// + Select tabpage 'List'
255 TabControl.SetPage TabListe
256 '/// + Select 'Accept All'
258 ListItem.TypeKeys "<Up>"
262 '/// + Close Redlining dialog
265 Warnlog "Redlining dialog not up!"
270 '/// string in Undo-list has to be: "Reject change: Insert 'this is a test'")
271 Call CheckUndoStringInUndoList ( 10, "Reject" )
277 testcase tUndoLineBreak
279 '/// <B>Manual breaks (line breaks)</B>
280 printlog "Manual breaks (line breaks)"
281 printlog "- Insert line break"
284 '/// Insert a line break (Shift return)
285 Call wTypeKeys ( "<SHIFT RETURN>" )
286 '/// string in Undo-list has to be: "Insert line break")
287 Call CheckUndoStringInUndoList ( 10, "InsertLineBreak" )
289 '/// Delete line break
290 printlog "- Delete line break"
291 Call wTypeKeys ( "<SHIFT RETURN><Backspace>" )
292 '/// string in Undo-list has to be: "Delete line break")
293 Call CheckUndoStringInUndoList ( 10, "DeleteLineBreak" )
300 testcase tUndoColumnBreak
302 '/// <B>Column breaks</B>
303 printlog "- Column breaks"
306 '/// Format / Columns
308 Kontext "FormatColumn"
309 '/// set number of columns to 2
312 '/// Insert a column break (Strg+Shift+Return)
313 Call wTypeKeys ( "<Mod1 Shift Return>" )
314 printlog "Insert a column break"
315 '/// string in Undo-list has to be: "Insert column break")
316 Call CheckUndoStringInUndoList ( 10, "InsertColumnBreak" )
318 '/// Delete a column break (Strg+Shift+Return+Backspace)
319 printlog "Delete a column break"
320 Call wTypeKeys ( "<Mod1 Shift Return><Backspace>" )
321 '/// string in Undo-list has to be: "Delete column break")
322 Call CheckUndoStringInUndoList ( 10, "DeleteColumnBreak" )
329 testcase tUndoPageBreak
331 '/// <B>Page breaks</B>
332 printlog "- Page breaks"
335 '/// Format / Columns
337 Kontext "UmbruchEinfuegen"
338 printlog "Insert a page break"
341 '/// string in Undo-list has to be: "Insert page break")
342 Call CheckUndoStringInUndoList ( 10, "InsertPageBreak" )
344 printlog "Delete a page break"
346 Kontext "UmbruchEinfuegen"
347 '/// Insert a page break
350 Call wTypeKeys ( "<Backspace>" )
351 '/// string in Undo-list has to be: "Delete page break")
352 Call CheckUndoStringInUndoList ( 10, "DeletePageBreak" )
361 '/// <B>Fields (Insert/Modify / Delete)</B>
362 printlog "- Fields (Insert)"
365 '/// Insert Field 'Date'
367 '/// string in Undo-list has to be: "Insert field")
368 Call CheckUndoStringInUndoList ( 10, "InsertField" )
370 printlog "- Fields (Modify)"
372 Call wTypeKeys ( "<Home>" )
373 '/// Edit fields and select 4th entry in Format-list
375 Kontext "FeldbefehlBearbeitenDokument"
376 Zahlenformat.Select 4
377 FeldbefehlBearbeitenDokument.Ok
378 '/// string in Undo-list has to be: "Changed field")
379 Call CheckUndoStringInUndoList ( 10, "ChangedField" )
381 printlog "- Fields (Delete)"
382 '/// Press delete-key
383 Call wTypeKeys ( "<Delete>" )
384 '/// string in Undo-list has to be: "Delete field")
385 Call CheckUndoStringInUndoList ( 10, "DeleteField" )
392 testcase tUndoSpecialCharacter
394 '/// <B>Special Character (Insert / Delete )</B>
395 printlog "- Special Character (Insert)"
398 '/// Insert a special Character
399 InsertSpecialCharacterWriter
400 Kontext "Sonderzeichen"
401 SchriftListe.TypeKeys "<Home>"
402 SchriftListe.TypeKeys "<Right>", 3
404 '/// string in Undo-list has to be: "Insert special character")
405 Call CheckUndoStringInUndoList ( 10, "InsertSpecialCharacter" )
407 printlog "- Special Character (Delete)"
408 '/// Delete special character with <Backspace>
409 Call wTypeKeys ("<Backspace>" )
410 Call CheckUndoStringInUndoList ( 10, "DeleteSpecialCharacter" )
418 Dim i as integer, StyleText as string, UndoText as string
419 Dim NewStyle as string
421 '/// <B>Styles (Apply/Modify/Find&Replace/Promote/Demote)</B>
422 printlog "- Styles (Apply)"
426 Call wTypeKeys ( "I have the new style" )
428 Call wTypeKeys ( "<Shift Home>" )
429 '/// Apply Style to a newly created style
430 Call wStyleCreate ( "AUndoHistory", "Paragraph" )
431 '/// string in Undo-list has to be: "Apply styles: AUndoHistory")
432 Call CheckUndoStringInUndoList ( 10, "ApplyStyles" )
434 '/// Modify Style through Stylist
435 if wStyleSelect ( "AUndoHistory" ) = false then
436 Warnlog "Defined style has not been found in Stylist->Test aborted"
441 Vorlagenliste.OpenContextMenu
442 Call hMenuSelectNr(2)
444 Active.Setpage TabFontEffects
445 Kontext "TabFontEffects"
446 FontColor.Select FontColor.GetItemCount
449 '/// string in Undo-list has to be: "Change styles: AUndoHistory")
450 Call CheckUndoStringInUndoList ( 10, "ChangeStyles" )
452 printlog "Styles (Replace)"
453 '/// Edit / Search and Replace
455 kontext "FindAndReplace"
456 if SearchForStyles.IsVisible = False then More.Click
457 SearchForStyles.Check
459 ReplaceWithStyle.Select 4
462 NewStyle = ReplaceWithStyle.GetSelText
464 Case 01: StyleText = "Replace style: AUndoHistory -> " & NewStyle
465 Case 34: StyleText = "Reemplazar estilo: AUndoHistory -> " & NewStyle
466 Case 86: StyleText = "替换样式: AUndoHistory -> " & NewStyle
467 Case else: QAErrorlog "Please adapt test for this language"
471 if Active.Exists then
472 if Active.GetRT = 304 then
480 kontext "FindAndReplace"
481 SearchForStyles.UnCheck
484 '/// string in Undo-list has to be: "Replace Styles: 'AUndoHistory -> ...")
485 Kontext "StandardBar"
488 Kontext "UndoRedoBox"
489 UndoText = UndoRedoList.GetItemText(1)
490 if UndoText <> StyleText then
491 Warnlog "Wrong text in Undo-List: " & UndoText
493 Kontext "StandardBar"
496 Warnlog "Something wrong checking Undo-List!"
499 printlog "Styles (Promote)"
500 '/// point cursor to beginning of document
501 Call wTypeKeys ( "<Mod1 Home>" )
502 ' To promote style it has to be in the heading group
503 ToolsOutlineNumbering
505 Active.SetPage TabKapitelnumerierung
506 Kontext "TabKapitelnumerierung"
507 Absatzvorlage.Select NewStyle
508 TabKapitelnumerierung.Ok
510 Call wNavigatorAuswahl ( 1, 1, true )
511 Kontext "NavigatorWriter"
512 '/// Select Promote in Navigator
515 '/// string in Undo-list has to be: "Demote Outline")
516 Call CheckUndoStringInUndoList ( 10, "DemoteOutline" )
518 Warnlog "Unable to demote outline"
521 '/// Select Demote in Navigator
522 printlog "Styles (Demote)"
523 Kontext "NavigatorWriter"
526 '/// string in Undo-list has to be: "Promote Outline")
527 Call CheckUndoStringInUndoList ( 10, "PromoteOutline" )
529 Warnlog "Unable to promote outline"