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_issuezilla_regression.inc,v $
13 '* last change: $Author: vg $ $Date: 2008-08-18 12:34:41 $
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 : Avoid regression (issuezilla tasks)
38 '\***********************************************************************
40 sub w_issuezilla_regression
53 '--------------------------------------------------------------------------
56 Dim PrevMacroSetting as integer
57 Dim sDocName as string, i as integer, j as integer
59 sDocName = ConvertPath(gtesttoolpath & "writer\optional\input\regression\issuezilla\i64991.odt")
60 '/// New writer document
62 '/// Set macro security to 'Medium' to activate Macros
63 PrevMacroSetting = hSetMacroSecurity(1)
64 '/// Open file \\writer\\optional\\input\\regression\\issuezilla\\i64991.odt
65 printlog "- Open file: " & sDocName
66 call hFileOpen (sDocName,false)
67 Kontext "SecurityWarning"
68 if SecurityWarning.Exists(2) then
71 Warnlog "Security Warning not up. Test interrupted!"
76 printlog "Save document to be able to find macro module later"
77 Call hFileSaveAsKill (gOfficepath + "user\work\i64991.odt")
79 printlog "- execute macro"
81 ' Sometimes it lasts long until dialog is shown
84 Kontext "ScriptSelector"
85 if ScriptSelector.Exists then exit for
87 printlog " - select 'i64991' in Library list"
88 Kontext "ScriptSelector"
89 For i = 1 to LibraryTreeList.GetItemCount
90 LibraryTreeList.Select i
91 if InStr(LibraryTreeList.GetSelText,"i64991") then
92 printlog " - open node 'i64991' in Library list"
93 i = LibraryTreeList.GetItemCount + 1
94 LibraryTreeList.TypeKeys "+"
96 printlog " - select 'Standard' in Library list"
97 LibraryTreeList.TypeKeys "<Down>"
99 printlog " - open node 'Standard' in Library list"
100 LibraryTreeList.TypeKeys "+"
102 LibraryTreeList.TypeKeys "<Down>"
103 printlog " - select 'check_page_style' in Library list"
104 if LibraryTreeList.GetSelText <> "check_page_style" then
105 Warnlog "Unable to find macro. Test interrupted!"
106 ScriptSelector.Cancel
110 printlog "- Now select script 'Main'"
111 for j = 1 to ScriptList.GetItemCount
113 if ScriptList.GetSelText = "Main" then
114 printlog " - execute Script 'Main'"
121 Kontext "ScriptSelector"
122 if ScriptSelector.Exists then
123 Warnlog "Something failed executing macro. Test interrupted"
124 ScriptSelector.Cancel
126 '/// check if page layout on first page is landscape
127 printlog "Check layout on first page"
130 Active.Setpage TabSeite
132 if Not Quer.IsChecked then Warnlog "#i64991#Setting a printer make the page styles to be lost"
135 Call wTypeKeys ("<Down>")
137 '/// check if page layout on second page is still portrait
138 printlog "Check layout on second page"
141 Active.Setpage TabSeite
143 if Not Hoch.IsChecked then Warnlog "#i64991#Setting a printer make the page styles to be lost"
147 '/// Set macro setting to previous value
148 Call hSetMacroSecurity(PrevMacroSetting)
154 '--------------------------------------------------------------------------
158 '/// New writer document
160 '/// Open file \\writer\\optional\\input\\regression\\issuezilla\\i65094a.odt
161 printlog "- Open file: i65094a.odt"
162 Call hFileOpen ( gTesttoolPath + "writer\optional\input\regression\issuezilla\i65094a.odt" )
163 Call sMakeReadOnlyDocumentEditable
164 '/// Compare document with other version \\writer\\optional\\input\\regression\\issuezilla\\i65094b.odt
166 printlog "- Compare document with other version"
169 '/// Open document ( i65094b.odt )
170 Dateiname.SetText ConvertPath( gTesttoolPath + "writer\optional\input\regression\issuezilla\i65094b.odt" )
174 Call sMakeReadOnlyDocumentEditable
175 printlog "- Accept all"
176 '/// In Redlining dialog select 'Accept all'
178 if Redlining.exists then
180 AlleAkzeptieren.Click
183 warnlog "accept button is disabled"
185 '/// Close Redlining dialog
187 '/// Save document as "..\user\work\i65094compare.odt
188 Call hFileSaveAsKill (gOfficepath + "user\work\i65094compare.odt")
189 '/// Save document as "..\user\work\i65094compare.odt"
191 printlog "- Compare done and document saved"
193 warnlog "Redlining dialog does not exist"
198 '--------------------------------------------------------------------------
202 '/// New writer document
204 printlog "- Open new dokument, enable redlining and make some changes"
205 '/// Enable redlining
208 Call wTypeKeys "Here are some changes"
209 '/// Save document as "..\user\work\i65094compare.odt and close it
210 Call hFileSaveAsKill (gOfficepath & "user\work\i69045.odt")
212 printlog "- Save, close and load document"
213 '/// Open saved document
214 Call hFileOpen ( gOfficepath & "user\work\i69045.odt" )
217 EditChangesAcceptOrReject
219 warnlog "Redlining has not been saved or does not work"
222 if Redlining.exists then
224 AlleAkzeptieren.Click
226 printlog "- Edit changes has been saved and accepted"
228 warnlog "AcceptAll is not enabled"
230 '/// Close Redlining dialog
236 '--------------------------------------------------------------------------
240 Dim iItems as integer
242 '/// New writer document
244 '/// Load document: \\writer\\optional\\input\\regression\\issuezilla\\i69521.odt
245 Call hFileOpen (gTesttoolpath & "writer\optional\input\regression\issuezilla\i69521.odt")
246 Call sMakeReadOnlyDocumentEditable
247 '/// Loaded document should have 5 EPS Graphics
248 iItems = CountItemsInNavigatorGroup(4)
250 Warnlog "Initially there are not 5 Grahics in document but: " & iItems
255 '/// save document as OfficePath\\user\work\\i96521-1.odt"
256 Call hFileSaveAsKill (gOfficePath & "user\work\i96521-1.odt")
259 '/// reload previous saved document
260 Call hFileOpen (gOfficePath & "user\work\i96521-1.odt")
261 '/// Check if all 5 Graphics are still in document
262 iItems = CountItemsInNavigatorGroup(4)
264 Warnlog "After save and reload there are not 5 Grahics in document but: " & iItems
270 '--------------------------------------------------------------------------
276 Dim sClipBrd() as string
277 Dim bNumberingError as boolean
279 gApplication = "HTML"
280 '/// New HTML Document
282 '/// type 'This<BR>is<BR>a numbering<BR>test'
283 Call wTypeKeys ("This<Return>is<Return>a numbering<Return>test")
284 '/// Select all paragraphs
285 Call wTypeKeys ("<Mod1 A>")
286 '/// Format with simple numbering
287 Kontext "TextObjectbar"
288 if Not TextObjectbar.Exists then Call hToolbarSelect ( "FORMATTING", true )
289 '/// Select 'Numbering' in object bar ///
291 '/// move "is" to numbering level 2
292 '/// move "a numbering" to numbering level 3
293 '/// move "test" to numbering level 4
294 printlog "- create numbering"
295 Call wTypeKeys ("<Mod1 Home>"
297 Call wTypeKeys ("<Down>")
298 Kontext "NumObjectbar"
299 if Not NumObjectbar.Exists then Call hToolbarSelect("BULLETSANDNUMBERING", true)
304 '/// should look like:
309 printlog "- check numbering"
310 Call wTypeKeys ( "<MOD1 A>" )
312 Select Case gPlatGroup
314 sClipBrd() = Split (GetClipboardText, CHR$(10))
316 sClipBrd() = Split (GetClipboardText, CHR$(13) & CHR$(10))
318 if Ubound(sClipBrd()) = 3 then
319 if Left$(sClipBrd(0), 2) <> "1." then bNumberingError = true
320 if Left$(sClipBrd(1), 2) <> "1." then bNumberingError = true
321 if Left$(sClipBrd(2), 2) <> "1." then bNumberingError = true
322 if Left$(sClipBrd(3), 2) <> "1." then bNumberingError = true
324 Warnlog "Error in clipboard content! " & Ubound(sClipBrd())
326 if bNumberingError = true then
327 Warnlog "Seems numbering I. has not been correctly created"
329 bNumberingError = false
330 '/// save as HTML-file i75027.html
331 Call hFileSaveAsKill (gOfficepath & "user\work\i75027.html")
332 '/// Reload previous saved document
334 Call hFileOpen (gOfficepath & "user\work\i75027.html")
335 '/// Check that the numbering is still the same.
336 printlog "- check numbering (previous saved)"
337 Call wTypeKeys ( "<MOD1 A>" )
339 Select Case gPlatGroup
341 sClipBrd() = Split (GetClipboardText, CHR$(10))
343 sClipBrd() = Split (GetClipboardText, CHR$(13) & CHR$(10))
345 if Ubound(sClipBrd()) = 3 then
346 if Left$(sClipBrd(0), 2) <> "1." then bNumberingError = true
347 if Left$(sClipBrd(1), 2) <> "1." then bNumberingError = true
348 if Left$(sClipBrd(2), 2) <> "1." then bNumberingError = true
349 if Left$(sClipBrd(3), 2) <> "1." then bNumberingError = true
351 Warnlog "Error in clipboard content! " & Ubound(sClipBrd())
353 if bNumberingError = true then
354 Warnlog "Seems numbering I. has not been correctly created"
358 gApplication = "WRITER"
361 '--------------------------------------------------------------------------
366 DIM sDocument AS String 'variable for saving the doc
368 gApplication = "WRITER"
371 Call hNewDocument 'NewDocument
372 Kontext "DocumentWriter"
373 printlog "New writer doc"
375 '/// [Insert]-[Envelope]
377 printlog "inserting envelope.."
379 '/// click "New Doc" button in Envelope_Dlg
381 active.SetPage TabEnvelope 'setting correct Tabpage
382 Kontext "TabEnvelope"
383 TabEnvelope.OK 'clicking on NewDoc button, which is OK button with another name
386 sDocument = ConvertPath ( gOfficePath + "user\work\test1.odt")
387 'deleting old Docs in the directory
388 if Dir (sDocument) <> "" then kill sDocument 'deleting old docs
389 Call hFileSaveAsKill (sDocument)
390 printlog "Document saved"
392 '/// click [File]-[Reload]
393 Kontext "DocumentWriter"
395 printlog "reloading ..here the crash happened in i76637."
396 '///crash occured here
402 '--------------------------------------------------------------------------
405 printlog "Test Format - AutoFormat - Apply And Edit Changes."
407 printlog " Open a new writerdocument."
409 printlog "Write the forrlowing text into the document: This is a test-text to be autoformatted."
410 wTypeKeys ("This is a test-text to be autoformatted.")
412 'Without text selected.
413 printlog "Use the menu: Format - Autoformat - Apply and Edit Changes."
414 FormatAutoformatApplyAndEditChanges
417 if active.exists(2) then
418 printlog " In the dialog: choose 'Accept."
422 printlog "Press SHIFT + HOME. To select the text we just wrote."
423 wTypeKeys ("<SHIFT HOME>")
426 printlog "Again, but with the text selected; use the menu: Format - Autoformat - Apply and Edit Changes."
427 FormatAutoformatApplyAndEditChanges
430 if active.exists(3) then
431 printlog " In the dialog: choose 'no'."
436 if active.exists(3) then
437 printlog " In the dialog: choose 'no'."
444 '--------------------------------------------------------------------------
450 printlog "ODF Hyperlinks in TOCs"
452 printlog "- Open test document"
453 Call hFileOpen ( gTesttoolPath + "writer\optional\input\regression\issuezilla\i103265.odt" )
454 printlog "- Update TOC"
455 ToolsUpdateAllIndexes
457 printlog "Check that every hyperlink jumps correctly to its target"
459 ' point cursor to beginning of document
460 Call wTypeKeys "<MOD1 HOME>"
461 ' point cursor to index entry
462 Call wTypeKeys "<DOWN>", 4 + i
465 ' check if it jumps to correct target
466 Call wTypeKeys "<SHIFT END>"
470 if GetClipboardText <> "# 1 Test" then
471 Warnlog "First hyperlink not correctly jumped to. Not '# 1 Test' but " & GetClipboardtext
474 if GetClipboardText <> "1. Test" then
475 Warnlog "First hyperlink not correctly jumped to. Not '# 1. Test' but " & GetClipboardtext
478 if GetClipboardText <> "Test " then
479 Warnlog "First hyperlink not correctly jumped to. Not 'Test' but " & GetClipboardtext
484 printlog "- Save as HTML"
485 gApplication = "HTML"
486 Call hFileSaveAsWithFilterKill ( gOfficePath + "user\work\ODFHyperlinksInTOCs.html", "HTML" )
490 Call hFileOpen ( gOfficePath + "user\work\ODFHyperlinksInTOCs.html" )
491 printlog "Check that every hyperlink jumps correctly to its target"
493 ' point cursor to beginning of document
494 Call wTypeKeys "<MOD1 HOME>"
495 ' point cursor to index entry
496 Call wTypeKeys "<DOWN>", 5 + i
499 ' check if it jumps to correct target
500 Call wTypeKeys "<SHIFT END>"
504 if GetClipboardText <> "# 1 Test" then
505 Warnlog "First hyperlink not correctly jumped to. Not '# 1 Test' but " & GetClipboardtext
508 if GetClipboardText <> "1. Test" then
509 Warnlog "First hyperlink not correctly jumped to. Not '# 1. Test' but " & GetClipboardtext
512 if GetClipboardText <> "1Test " then
513 Warnlog "First hyperlink not correctly jumped to. Not 'Test ' but " & GetClipboardtext