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: basic_macros.inc,v $
13 '* last change: $Author: jsi $ $Date: 2008-06-16 12:18:13 $
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 : joerg.skottke@sun.com
36 ' ** short description : check macro-dialogs / BASIC-IDE ( 1. part )
38 '\******************************************************************************
41 testcase tMakro_In_All_Apps
43 '///<h1>Create a module for all applications, open and close Basic-IDE</h1>
52 const CMACRO = "AppMakro"
58 cApp = hNumericDoctype( iApp )
61 '///+<li>Open a new document</li>
62 printlog( "Open a new document" )
63 brc = hCreateDocument()
65 '///+<li>Open the BASIC Macro Organizer</li>
66 '///+<li>Create a new library for the current document</li>
67 '///+<li>Create a new module for the current document<br>
68 '///+ -> The Basic IDE opens</li>
69 brc = hInitBasicIde( CMACRO )
71 warnlog( "Could not open the BASIC Macro Organizer, aborting" )
72 call hDestroyDocument()
76 '///+<li>Close the BASIC-IDE</li>
77 printlog "Close the BASIC-IDE"
78 brc = hCloseBasicIde()
80 '///+<li>Close the navigator (Master-Doc)</li>
81 printlog( "Close the navigator (Master-doc)" )
82 brc = hCloseNavigator()
84 '///+<li>Close the document</li>
85 printlog( "Close the document" )
88 '///+<li>Close the messagebox (document changed)</li>
89 printlog( "Close the messagebox (document changed)" )
91 if ( MessageBox.Exists( 1 ) ) then
92 cMsg = MessageBox.getText()
93 cMsg = hRemoveLineBreaks( cMsg )
94 printlog( "MessageBox: " & cMsg )
97 warnlog( "No warning for changed document" )
105 '*******************************************************************************
107 testcase tMakro_Dialog
109 if ( gBuild < 9305 ) then
110 warnlog( "#i87457# - Application macros assigned to userlayer" )
114 '///<h1>Dialogs: Macro Object Organizer, Tools/Customize</h1>
121 dim iLibraryItemCount as integer
123 dim iCurrentLibrary as Integer
124 dim XLBFILE as String
125 XLBFILE = gTesttoolPath & "framework\optional\input\AppLibrary1\script.xlb"
126 const CFN = "tMakro_Dialog::"
127 const CMACRO = "MacroDlg"
130 gApplication = "WRITER"
131 '///+<li>Open a new document</li>
132 printlog( "Open a new document" )
133 brc = hCreateDocument()
135 '///+<li>Open the basic organizer</li>
136 '///+<li>Create a new library for the current document</li>
137 '///+<li>Create a new module for the current document<br>
138 '///+ -> The Basic-Ide opens</li>
139 printlog( "Create a new library, a new module, open Basic-Ide" )
140 brc = hInitBasicIde( CMACRO )
142 warnlog( CFN & "Could not open BASIC-IDE, aborting" )
146 '///+<li>Close the Basic IDE</li>
147 printlog( "Close the Basic-Ide" )
151 '///+<li>Open the Basic Organizer</li>
152 printlog( "Open the Basic Macro Organizer" )
153 brc = hOpenBasicOrganizerFromDoc()
155 '///+<li>Select the module we created before</li>
156 printlog( "Select the last Module for the current document" )
157 iPos = hSelectTheLastNode( MakroAus )
159 '///+<li>Open the Macro Obkect Organizer (Click Organize...)</li>
160 printlog( "Click Organize..." )
163 '///+<li>Select the Modules-tab</li>
164 printlog( "Select Modules-tab" )
165 brc = hSelectBasicObjectOrganizerTab( 1 )
168 '///+<li>Create a new module</li>
169 printlog( "Press 'new module'" )
174 '///+<li>Cancel the 'New Module' dialog</li>
175 printlog( "Cancel the dialog" )
178 '///+<li>Create a 'New Dialog'</li>
179 brc = hSelectBasicObjectOrganizerTab( 2 )
182 printlog( "Press 'new dialog'" )
185 '///+<li>Cancel the dialog</li>
186 printlog( "Cancel the dialog" )
187 kontext "neuerdialog"
191 '///+<li>Activate TabLibrary on it 'New' / 'Password' / 'Delete' / 'Append' / 'Edit'</li>
192 printlog( "Select the libraries Tab" )
193 brc = hSelectBasicObjectOrganizerTab( 3 )
196 '///+<li>Press 'New' on the libraries tab</li>
197 printlog( "Press 'New' on the libraries tab" )
198 kontext "tabbibliotheken"
201 kontext "neuebibliothek"
202 '///+<li>Close the dialog with 'OK'</li>
203 printlog( "Close the dialog with 'OK'" )
204 Call DialogTest( NeueBibliothek )
207 '///+<li>Delete the new default library</li>
208 printlog( "Delete 'Library1'" )
209 kontext "tabbibliotheken"
212 '///+<li>Close the deletion warning</li>
213 printlog( "Close the warning" )
215 if ( Active.Exists() ) then
216 cMsg = active.getText()
217 cMsg = hRemoveLineBreaks( cMsg )
218 printlog( "MessageBox: " & cMsg )
221 warnlog( "Deletion warning is missing" )
224 '///+<li>Check the number of entries in the Libraries-List, one expected</li>
225 printlog( "Check the number of libraries in list" )
226 kontext "tabbibliotheken"
227 iLibraryItemCount = Bibliotheksliste.getItemCount()
228 if ( iLibraryItemCount <> 1 ) then
229 if ( iLibraryItemCount = 11 ) then
230 warnlog( "#i87457# Macros moved from 'OpenOffice.org Macros' to 'My Macros'" )
232 warnlog( "Incorrect item count. Should be 1, is: " & iLibraryItemCount )
236 '///+<li>Append a library by pressing 'Append'</li>
237 printlog( "Append a xlb-file" )
238 kontext "tabbibliotheken"
241 '///+<li>Select a valid library and open it</li>
242 printlog( "Select 'AppLibrary1/script.xlb' from the files list"
244 Dateiname.SetText( ConvertPath ( XLBFILE ) )
247 ' If the .xlb file cannot be found the test cannot continue. Warn and cleanup.
249 if ( Active.exists( 1 ) ) then
252 Active.getButtonCount()
254 warnlog( "Script does not exist warning displayed. Aborting test" )
255 printlog( Active.getText() )
259 if ( OeffnenDlg.exists( 1 ) ) then
260 printlog( "Closing File Open dialog" )
264 kontext "tabbibliotheken"
265 if ( TabBibliotheken.exists( 1 ) ) then
266 printlog( "Closing Libaries tab" )
267 TabBibliotheken.close()
271 if ( Makro.exists( 1 ) ) then
272 printlog( "Closing Macro organizer" )
276 printlog( "Exiting test" )
279 printlog( "Script found and loaded. Good." )
284 '///+<li>Make sure 'Insert as Reference' is unchecked</li>
285 printlog( "Ensure 'Insert as Reference' is unchecked" )
286 kontext "appendlibraries"
287 InsertAsReference.UnCheck()
289 '///+<li>Check 'Replace Existing Library'</li>
290 printlog( "Check 'Replace existing library'" )
291 ReplaceExistingLibraries.Check()
293 '///+<li>Press 'OK' to append the library</li>
294 printlog( "Press 'OK' to append the library" )
295 kontext "appendlibraries"
299 warnlog( "#i85254# Appending libraries leads to crash" )
302 '///+<li>Check the number of entries in the Libraries-List, two expected</li>
303 printlog( "Check the number of libraries in list (should be two)" )
304 kontext "tabbibliotheken"
305 iLibraryItemCount = Bibliotheksliste.getItemCount()
306 if ( iLibraryItemCount <> 2 ) then
307 qaerrorlog( "#i87457# Two entries in list expected, found " & iLibraryItemCount )
310 '///+<li>Select 'AppLibrary1' and click 'Password'</li>
311 printlog( "Select the first item" )
312 Bibliotheksliste.TypeKeys( "<HOME>" )
313 for iCurrentLibrary = 1 to iLibraryItemCount
314 if ( Bibliotheksliste.getSelText() = "AppLibrary1" ) then
315 printlog( "Found AppLibrary1" )
318 printlog( "This was not AppLibrary1, trying again" )
319 Bibliotheksliste.Typekeys( "<DOWN>" )
322 '///+<li>Click to set a password for AppLibrary1, cancel dialog</li>
323 printlog( "Set a password for AppLibrary1" )
324 kontext "tabbibliotheken"
325 if ( Passwort.IsEnabled() ) then
330 warnlog( "Password is disabled for 'AppLibrary1'" )
333 '///+<li>Delete the inserted library (AppLibrary1)</li>
334 printlog( "Delete 'AppLibrary1'" )
335 kontext "tabbibliotheken"
338 '///+<li>Close the warning with YES</li>
339 printlog( "Close the warning with YES" )
341 if ( Active.Exists() ) then
342 cMsg = active.getText()
343 cMsg = hRemoveLineBreaks( cMsg )
344 printlog( "MessageBox: " & cMsg )
347 warnlog( "Expected confirmation dialog for delete" )
350 '///+<li>Click on the Edit-button -> The Basic-Ide opens</li>
351 kontext "tabbibliotheken"
352 printlog( "Press 'edit' on 'Libraries'-tab" )
355 '///+<li>Close the Basic-Ide</li>
357 if ( BasicIDE.Exists( 5 ) ) then
361 printlog( "Close the basic-document" )
362 brc = hCloseBasicIde()
365 if ( Active.Exists ( 2 ) ) then
366 cMsg = active.getText()
367 cMsg = hRemoveLineBreaks( cMsg )
368 warnlog( "Unexpected MessageBox: " & cMsg )
373 warnlog("#i38978# The Macro-Document is not open, aborting test")
374 call hDestroyDocument()
378 '///+<li>Open the BASIC Macro Organizer from the current document</li>
379 printlog( "Open the BASIC Macro Organizer" )
380 brc = hOpenBasicOrganizerFromDoc()
382 '///+<li>Go to the last macro in the list</li>
383 printlog( "Select the last macro from the list" )
385 iPos = hSelectTheLastNode( MakroAus )
388 '///+<li>Assign the macro by pressing 'Assign' -> Tools/customize opens</li>
389 printlog( "Assign the macro, Tools/customize dialog should open" )
392 warnlog( "#i106853# Assign-Button is disabled or macro is missing" )
395 '///+<li>Activate all tapages and cancel the Tools/Customize dialog</li>
396 printlog( "Activate all tapages and cancel the Tools/Customize dialog" )
398 brc = hToolsCustomizeSelectTab( "menu" )
399 brc = hToolsCustomizeSelectTab( "keyboard"
401 qaerrorlog( "#i61765# Keyboard tab missing when called via Tools/Macros->Assign" )
403 brc = hToolsCustomizeSelectTab( "events" )
404 brc = hToolsCustomizeSelectTab( "toolbars" )
406 '///+<li>Cancel Tools/Customize dialog -> Back to Macro Organizer</li>
407 printlog( "Cancel Tools/Customize dialog -> Macro Organizer should be open" )
408 brc = hToolsCustomizeClose( 2 )
411 '///+<li>Click to run the macro</li>
412 printlog "Click to run macro"
417 warnlog( "Unable to run macro" )
422 '///+<li>The macro thriggers a messagebox, close it</li>
424 if ( active.exists() ) then
425 cMsg = active.getText()
426 cMsg = hRemoveLineBreaks( cMsg )
427 if ( cMsg = "TTMacro3" ) then
428 printlog( "The correct macro has been executed" )
430 warnlog( "Unknown Messagebox: " & cMsg )
435 '///+<li>Open Macro organizer from the current document</li>
436 printlog( "Open macro organizer from the current document" )
437 brc = hOpenBasicOrganizerFromDoc()
439 '///+<li>Select the last item in the treelist</li>
440 printlog( "Select the last item in the treelist" )
441 brc = hSelectTheLastNode( MakroAus )
443 '///+<li>Delete the module we created earlier</li>
444 printlog( "Delete the new module" )
447 '///+<li>Close the deletion warning</li>
448 printlog( "Close the deletion warning" )
450 if ( active.exists() ) then
451 cMsg = active.getText()
452 cMsg = hRemoveLineBreaks( cMsg )
453 printlog( "MessageBox: " & cMsg )
456 warnlog( "No confirmation dialog for delete" )
459 '///+<li>Close the macro organizer</li>
460 printlog( "Close the macro organizer" )
464 '///+<li>Close the document</li>
465 printlog( "Close the document" )
466 Call hDestroyDocument()