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 2000, 2010 Oracle and/or its affiliates.
7 ' OpenOffice.org - a multi-platform office productivity suite
9 ' This file is part of OpenOffice.org.
11 ' OpenOffice.org is free software: you can redistribute it and/or modify
12 ' it under the terms of the GNU Lesser General Public License version 3
13 ' only, as published by the Free Software Foundation.
15 ' OpenOffice.org is distributed in the hope that it will be useful,
16 ' but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ' GNU Lesser General Public License version 3 for more details
19 ' (a copy is included in the LICENSE file that accompanied this code).
21 ' You should have received a copy of the GNU Lesser General Public License
22 ' version 3 along with OpenOffice.org. If not, see
23 ' <http://www.openoffice.org/license.html>
24 ' for a copy of the LGPLv3 License.
26 '/************************************************************************
28 ' ** owner : gregor.hartmann@oracle.com
30 ' ** short description : check macro-dialogs / BASIC-IDE ( 1. part )
32 '\******************************************************************************
35 testcase tMakro_In_All_Apps
37 printlog( "Attach a macro to all application types" )
41 const CMACRO = "AppMakro"
42 const DIALOG_TIMEOUT = 2
46 printlog( hNumericDoctype( iApp ) )
48 printlog( "Open a new document" )
51 if ( hInitBasicIde( CMACRO ) ) then
52 printlog "Close the BASIC-IDE"
55 printlog( "Close the navigator (Master-doc)" )
57 hCloseDialog( Navigator, "close,optional" )
59 printlog( "Close the document" )
60 hUseAsyncSlot( "FileClose" )
62 printlog( "Close the messagebox (document changed)" )
64 if ( MessageBox.Exists( DIALOG_TIMEOUT ) ) then
65 printlog( "MessageBox: " & MessageBox.getText() )
66 hCloseDialog( Messagebox, "no" )
68 warnlog( "No warning for changed document" )
71 warnlog( "Could not open the BASIC Macro Organizer, aborting" )
78 '*******************************************************************************
80 testcase tMakro_Dialog
82 printlog( "Update test for the BASIC organizer - libraries, modules and dialogs" )
84 const CFN = "tMakro_Dialog::"
85 const CMACRO = "MacroDlg"
87 const DIALOG_TIMEOUT = 2
90 const TAB_LIBRARIES = 3
91 const REFERENCE_LIBRARY = "AppLibrary1"
93 dim iLibraryItemCount as integer
94 dim iCurrentLibrary as Integer
96 XLBFILE = gTesttoolPath & "framework\optional\input\AppLibrary1\script.xlb"
97 XLBFILE = convertpath( XLBFILE )
99 gApplication = "WRITER"
101 printlog( "Open a new document" )
104 printlog( "Create a new library, a new module, open Basic-Ide" )
105 if ( not hInitBasicIde( CMACRO ) ) then
106 warnlog( CFN & "Could not open BASIC-IDE, aborting" )
110 printlog( "Close the Basic-Ide" )
114 printlog( "Open the Basic Macro Organizer" )
118 if ( Makro.exists( DIALOG_TIMEOUT ) ) then
120 printlog( "Select the last Module for the current document" )
121 hSelectTheLastNode( MakroAus )
123 printlog( "Click Organize..." )
126 printlog( "Select Modules-tab" )
127 hSelectBasicObjectOrganizerTab( TAB_MODULES )
129 printlog( "Press 'new module'" )
134 printlog( "Cancel the dialog" )
137 hSelectBasicObjectOrganizerTab( TAB_DIALOGS )
140 printlog( "Press 'new dialog'" )
143 printlog( "Cancel the dialog" )
144 kontext "neuerdialog"
148 printlog( "Select the libraries Tab" )
149 hSelectBasicObjectOrganizerTab( TAB_LIBRARIES )
152 printlog( "Press 'New' on the libraries tab" )
153 kontext "tabbibliotheken"
156 kontext "neuebibliothek"
157 if ( NeueBibliothek.exists( DIALOG_TIMEOUT ) ) then
158 printlog( "Close the dialog with 'OK'" )
159 Call DialogTest( NeueBibliothek )
160 hCloseDialog( NeueBibliothek, "ok" )
163 printlog( "Delete 'Library1'" )
164 kontext "tabbibliotheken"
167 printlog( "Close the warning" )
169 if ( Active.Exists( DIALOG_TIMEOUT ) ) then
170 printlog( "MessageBox: " & active.getText() )
173 warnlog( "Deletion warning is missing" )
176 printlog( "Check the number of libraries in list" )
177 kontext "tabbibliotheken"
178 iLibraryItemCount = Bibliotheksliste.getItemCount()
179 if ( iLibraryItemCount <> 1 ) then
180 if ( iLibraryItemCount = 11 ) then
181 warnlog( "#i87457# Macros moved from 'OpenOffice.org Macros' to 'My Macros'" )
183 warnlog( "Incorrect item count. Should be 1, is: " & iLibraryItemCount )
187 printlog( "Append a xlb-file" )
188 kontext "tabbibliotheken"
191 printlog( "Select 'AppLibrary1/script.xlb' from the files list"
193 Dateiname.SetText( XLBFILE )
196 kontext "AppendLibraries"
197 if ( AppendLibraries.exists( DIALOG_TIMEOUT ) ) then
198 printlog( "<Append libraries> dialog is open, good" )
201 ' If the .xlb file cannot be found the test cannot continue. Warn and cleanup.
203 if ( Active.exists() ) then
205 warnlog( "Unexpected messagebox, the script appears to be missing" )
206 printlog( Active.getText() )
209 hCloseDialog( Active, "ok" )
212 hCloseDialog( OeffnenDlg, "cancel,optional" )
214 kontext "TabBibliotheken"
215 hCloseDialog( TabBibliotheken, "close,optional" )
218 hCloseDialog( Makro, "close,optional" )
220 printlog( "Exiting test" )
226 printlog( "Ensure 'Insert as Reference' is unchecked" )
227 kontext "appendlibraries"
228 InsertAsReference.UnCheck()
230 printlog( "Check 'Replace existing library'" )
231 ReplaceExistingLibraries.Check()
233 printlog( "Press 'OK' to append the library" )
234 kontext "appendlibraries"
236 hCloseDialog( AppendLibraries, "ok" )
238 printlog( "Check the number of libraries in list (should be two)" )
239 kontext "tabbibliotheken"
240 iLibraryItemCount = Bibliotheksliste.getItemCount()
241 if ( iLibraryItemCount <> 2 ) then
242 qaerrorlog( "#i87457# Two entries in list expected, found " & iLibraryItemCount )
245 printlog( "Select the first item" )
246 Bibliotheksliste.TypeKeys( "<HOME>" )
247 for iCurrentLibrary = 1 to iLibraryItemCount
248 if ( Bibliotheksliste.getSelText() = REFERENCE_LIBRARY ) then
249 printlog( "Found " & REFERENCE_LIBRARY )
252 printlog( "This was not " & REFERENCE_LIBRARY & ", trying again" )
253 Bibliotheksliste.Typekeys( "<DOWN>" )
256 printlog( "Set a password for " & REFERENCE_LIBRARY )
257 kontext "tabbibliotheken"
258 if ( hClickButton( Passwort ) <> RC_TIMEOUT ) then
260 hCloseDialog( PasswdDLG, "cancel" )
262 warnlog( "Password is disabled for " & REFERENCE_LIBRARY )
265 printlog( "Delete " & REFERENCE_LIBRARY )
266 kontext "tabbibliotheken"
269 printlog( "Close the warning with YES" )
271 if ( Active.Exists() ) then
272 printlog( "MessageBox: " & active.getText() )
275 warnlog( "Expected confirmation dialog for delete" )
278 kontext "tabbibliotheken"
279 printlog( "Press 'edit' on 'Libraries'-tab" )
283 if ( BasicIDE.Exists( DIALOG_TIMEOUT ) ) then
287 printlog( "Close the basic-document" )
291 if ( Active.Exists ( DIALOG_TIMEOUT ) ) then
292 warnlog( "Unexpected MessageBox: " & active.getText() )
297 warnlog("#i38978# The Macro-Document is not open, aborting test")
298 call hDestroyDocument()
302 printlog( "Open the BASIC Macro Organizer" )
305 printlog( "Select the last macro from the list" )
307 if ( Makro.exists( DIALOG_TIMEOUT ) ) then
308 hSelectTheLastNode( MakroAus )
310 printlog( "Assign the macro, Tools/customize dialog should open" )
311 if ( hClickButton( Zuordnen ) = RC_TIMEOUT ) then
312 warnlog( "#i106853# Assign-Button is disabled or macro is missing" )
315 printlog( "Activate all tapages and cancel the Tools/Customize dialog" )
316 if ( not hToolsCustomizeSelectTab( "keyboard" ) ) then
317 qaerrorlog( "#i61765# Keyboard tab missing when called via Tools/Macros->Assign" )
319 hToolsCustomizeSelectTab( "events" )
320 hToolsCustomizeSelectTab( "toolbars" )
322 printlog( "Cancel Tools/Customize dialog -> Macro Organizer should be open" )
323 kontext "TabCustomizeToolbars"
324 hCloseDialog( TabCustomizeToolbars, "cancel" )
327 printlog "Click to run macro"
329 if ( hClickButton( Ausfuehren ) = RC_TIMEOUT ) then
330 warnlog( "Unable to run macro, button is not enabled" )
332 hCloseDialog( Makro, "close" )
336 if ( active.exists() ) then
337 if ( active.getText() = "TTMacro3" ) then
338 printlog( "The correct macro has been executed" )
340 warnlog( "Unknown Messagebox: " & active.getText() )
345 warnlog( "Macro Organizer did not open" )
348 printlog( "Open macro organizer from the current document" )
349 ToolsMacro_uno : WaitSlot()
351 printlog( "Select the last item in the treelist" )
353 hSelectTheLastNode( MakroAus )
355 printlog( "Delete the new module" )
358 printlog( "Close the deletion warning" )
360 if ( active.exists() ) then
361 printlog( "MessageBox: " & active.getText() )
364 warnlog( "No confirmation dialog for delete" )
367 printlog( "Close the macro organizer" )
371 warnlog( "Makro Organizer did not open" )
374 printlog( "Close the document" )
375 Call hDestroyDocument()