diff options
Diffstat (limited to 'testautomation/framework/optional/includes/basic_macros.inc')
-rwxr-xr-x[-rw-r--r--] | testautomation/framework/optional/includes/basic_macros.inc | 563 |
1 files changed, 268 insertions, 295 deletions
diff --git a/testautomation/framework/optional/includes/basic_macros.inc b/testautomation/framework/optional/includes/basic_macros.inc index 0d5e2a451d60..17e1b83d5e18 100644..100755 --- a/testautomation/framework/optional/includes/basic_macros.inc +++ b/testautomation/framework/optional/includes/basic_macros.inc @@ -34,51 +34,42 @@ testcase tMakro_In_All_Apps - - dim brc as boolean - dim cApp as string + printlog( "Attach a macro to all application types" ) + dim iApp as Integer - dim bBug as Boolean - dim cMsg as string - bBug = FALSE const CMACRO = "AppMakro" - + const DIALOG_TIMEOUT = 2 for iApp = 1 to 7 - cApp = hNumericDoctype( iApp ) - printlog( cApp ) + printlog( hNumericDoctype( iApp ) ) printlog( "Open a new document" ) - brc = hCreateDocument() + hCreateDocument() - brc = hInitBasicIde( CMACRO ) - if ( not brc ) then + if ( hInitBasicIde( CMACRO ) ) then + printlog "Close the BASIC-IDE" + hCloseBasicIde() + + printlog( "Close the navigator (Master-doc)" ) + kontext "Navigator" + hCloseDialog( Navigator, "close,optional" ) + + printlog( "Close the document" ) + hUseAsyncSlot( "FileClose" ) + + printlog( "Close the messagebox (document changed)" ) + kontext "messagebox" + if ( MessageBox.Exists( DIALOG_TIMEOUT ) ) then + printlog( "MessageBox: " & MessageBox.getText() ) + hCloseDialog( Messagebox, "no" ) + else + warnlog( "No warning for changed document" ) + end if + else warnlog( "Could not open the BASIC Macro Organizer, aborting" ) - call hDestroyDocument() - goto endsub endif - - printlog "Close the BASIC-IDE" - brc = hCloseBasicIde() - - printlog( "Close the navigator (Master-doc)" ) - brc = hCloseNavigator() - - printlog( "Close the document" ) - FileClose - - printlog( "Close the messagebox (document changed)" ) - kontext "messagebox" - if ( MessageBox.Exists( 1 ) ) then - cMsg = MessageBox.getText() - cMsg = hRemoveLineBreaks( cMsg ) - printlog( "MessageBox: " & cMsg ) - MessageBox.No() - else - warnlog( "No warning for changed document" ) - end if next iApp @@ -88,32 +79,30 @@ endcase testcase tMakro_Dialog - if ( gBuild < 9305 ) then - warnlog( "#i87457# - Application macros assigned to userlayer" ) - goto endsub - endif + printlog( "Update test for the BASIC organizer - libraries, modules and dialogs" ) + + const CFN = "tMakro_Dialog::" + const CMACRO = "MacroDlg" + const RC_TIMEOUT = -1 + const DIALOG_TIMEOUT = 2 + const TAB_MODULES = 1 + const TAB_DIALOGS = 2 + const TAB_LIBRARIES = 3 + const REFERENCE_LIBRARY = "AppLibrary1" - - dim brc as boolean - dim cMsg as string - - dim iPos as integer dim iLibraryItemCount as integer - dim iCurrentLibrary as Integer dim XLBFILE as String XLBFILE = gTesttoolPath & "framework\optional\input\AppLibrary1\script.xlb" - const CFN = "tMakro_Dialog::" - const CMACRO = "MacroDlg" - + XLBFILE = convertpath( XLBFILE ) gApplication = "WRITER" + printlog( "Open a new document" ) - brc = hCreateDocument() + hCreateDocument() printlog( "Create a new library, a new module, open Basic-Ide" ) - brc = hInitBasicIde( CMACRO ) - if ( not brc ) then + if ( not hInitBasicIde( CMACRO ) ) then warnlog( CFN & "Could not open BASIC-IDE, aborting" ) goto endsub endif @@ -123,284 +112,268 @@ testcase tMakro_Dialog hCloseBasicIde() printlog( "Open the Basic Macro Organizer" ) - brc = hOpenBasicOrganizerFromDoc() + ToolsMacro_uno - printlog( "Select the last Module for the current document" ) - iPos = hSelectTheLastNode( MakroAus ) - - printlog( "Click Organize..." ) - Verwalten.Click() - - printlog( "Select Modules-tab" ) - brc = hSelectBasicObjectOrganizerTab( 1 ) + kontext "Makro" + if ( Makro.exists( DIALOG_TIMEOUT ) ) then - - printlog( "Press 'new module'" ) - kontext "tabmodule" - NeuesModul.Click() + printlog( "Select the last Module for the current document" ) + hSelectTheLastNode( MakroAus ) - kontext "neuesmodul" - printlog( "Cancel the dialog" ) - NeuesModul.Cancel() + printlog( "Click Organize..." ) + Verwalten.Click() - brc = hSelectBasicObjectOrganizerTab( 2 ) + printlog( "Select Modules-tab" ) + hSelectBasicObjectOrganizerTab( TAB_MODULES ) - kontext "tabdialogs" - printlog( "Press 'new dialog'" ) - NewDialog.Click() - - printlog( "Cancel the dialog" ) - kontext "neuerdialog" - NeuerDialog.Cancel() + printlog( "Press 'new module'" ) + kontext "tabmodule" + NeuesModul.Click() - kontext - printlog( "Select the libraries Tab" ) - brc = hSelectBasicObjectOrganizerTab( 3 ) + kontext "neuesmodul" + printlog( "Cancel the dialog" ) + NeuesModul.Cancel() - - printlog( "Press 'New' on the libraries tab" ) - kontext "tabbibliotheken" - Neu.Click() - - kontext "neuebibliothek" - printlog( "Close the dialog with 'OK'" ) - Call DialogTest( NeueBibliothek ) - NeueBibliothek.OK() - - printlog( "Delete 'Library1'" ) - kontext "tabbibliotheken" - Loeschen.Click() - - printlog( "Close the warning" ) - kontext "active" - if ( Active.Exists() ) then - cMsg = active.getText() - cMsg = hRemoveLineBreaks( cMsg ) - printlog( "MessageBox: " & cMsg ) - Active.Yes() - else - warnlog( "Deletion warning is missing" ) - endif - - printlog( "Check the number of libraries in list" ) - kontext "tabbibliotheken" - iLibraryItemCount = Bibliotheksliste.getItemCount() - if ( iLibraryItemCount <> 1 ) then - if ( iLibraryItemCount = 11 ) then - warnlog( "#i87457# Macros moved from 'OpenOffice.org Macros' to 'My Macros'" ) - else - warnlog( "Incorrect item count. Should be 1, is: " & iLibraryItemCount ) + hSelectBasicObjectOrganizerTab( TAB_DIALOGS ) + + kontext "tabdialogs" + printlog( "Press 'new dialog'" ) + NewDialog.Click() + + printlog( "Cancel the dialog" ) + kontext "neuerdialog" + NeuerDialog.Cancel() + + kontext + printlog( "Select the libraries Tab" ) + hSelectBasicObjectOrganizerTab( TAB_LIBRARIES ) + + + printlog( "Press 'New' on the libraries tab" ) + kontext "tabbibliotheken" + Neu.Click() + + kontext "neuebibliothek" + if ( NeueBibliothek.exists( DIALOG_TIMEOUT ) ) then + printlog( "Close the dialog with 'OK'" ) + Call DialogTest( NeueBibliothek ) + hCloseDialog( NeueBibliothek, "ok" ) endif - endif - printlog( "Append a xlb-file" ) - kontext "tabbibliotheken" - Hinzufuegen.Click() + printlog( "Delete 'Library1'" ) + kontext "tabbibliotheken" + Loeschen.Click() - printlog( "Select 'AppLibrary1/script.xlb' from the files list" - kontext "oeffnendlg" - Dateiname.SetText( ConvertPath ( XLBFILE ) ) - Oeffnen.Click() - - ' If the .xlb file cannot be found the test cannot continue. Warn and cleanup. - kontext "Active" - if ( Active.exists( 1 ) ) then - - try - Active.getButtonCount() - - warnlog( "Script does not exist warning displayed. Aborting test" ) - printlog( Active.getText() ) - active.ok() - - kontext "OeffnenDlg" - if ( OeffnenDlg.exists( 1 ) ) then - printlog( "Closing File Open dialog" ) - OeffnenDlg.cancel() - endif - - kontext "tabbibliotheken" - if ( TabBibliotheken.exists( 1 ) ) then - printlog( "Closing Libaries tab" ) - TabBibliotheken.close() + printlog( "Close the warning" ) + kontext "active" + if ( Active.Exists( DIALOG_TIMEOUT ) ) then + printlog( "MessageBox: " & active.getText() ) + Active.Yes() + else + warnlog( "Deletion warning is missing" ) + endif + + printlog( "Check the number of libraries in list" ) + kontext "tabbibliotheken" + iLibraryItemCount = Bibliotheksliste.getItemCount() + if ( iLibraryItemCount <> 1 ) then + if ( iLibraryItemCount = 11 ) then + warnlog( "#i87457# Macros moved from 'OpenOffice.org Macros' to 'My Macros'" ) + else + warnlog( "Incorrect item count. Should be 1, is: " & iLibraryItemCount ) endif - - kontext "Makro" - if ( Makro.exists( 1 ) ) then - printlog( "Closing Macro organizer" ) - Makro.close() + endif + + printlog( "Append a xlb-file" ) + kontext "tabbibliotheken" + Hinzufuegen.Click() + + printlog( "Select 'AppLibrary1/script.xlb' from the files list" + kontext "oeffnendlg" + Dateiname.SetText( XLBFILE ) + Oeffnen.Click() + + kontext "AppendLibraries" + if ( AppendLibraries.exists( DIALOG_TIMEOUT ) ) then + printlog( "<Append libraries> dialog is open, good" ) + else + + ' If the .xlb file cannot be found the test cannot continue. Warn and cleanup. + kontext "Active" + if ( Active.exists() ) then + + warnlog( "Unexpected messagebox, the script appears to be missing" ) + printlog( Active.getText() ) + + kontext "Active" + hCloseDialog( Active, "ok" ) + + kontext "OeffnenDlg" + hCloseDialog( OeffnenDlg, "cancel,optional" ) + + kontext "TabBibliotheken" + hCloseDialog( TabBibliotheken, "close,optional" ) + + kontext "Makro" + hCloseDialog( Makro, "close,optional" ) + + printlog( "Exiting test" ) + goto endsub + endif - - printlog( "Exiting test" ) - goto endsub - catch - printlog( "Script found and loaded. Good." ) - endcatch - - endif + endif - printlog( "Ensure 'Insert as Reference' is unchecked" ) - kontext "appendlibraries" - InsertAsReference.UnCheck() - - printlog( "Check 'Replace existing library'" ) - ReplaceExistingLibraries.Check() - - printlog( "Press 'OK' to append the library" ) - kontext "appendlibraries" - try - AppendLibraries.OK() - catch - warnlog( "#i85254# Appending libraries leads to crash" ) - endcatch - - printlog( "Check the number of libraries in list (should be two)" ) - kontext "tabbibliotheken" - iLibraryItemCount = Bibliotheksliste.getItemCount() - if ( iLibraryItemCount <> 2 ) then - qaerrorlog( "#i87457# Two entries in list expected, found " & iLibraryItemCount ) - endif + printlog( "Ensure 'Insert as Reference' is unchecked" ) + kontext "appendlibraries" + InsertAsReference.UnCheck() + + printlog( "Check 'Replace existing library'" ) + ReplaceExistingLibraries.Check() + + printlog( "Press 'OK' to append the library" ) + kontext "appendlibraries" + + hCloseDialog( AppendLibraries, "ok" ) - printlog( "Select the first item" ) - Bibliotheksliste.TypeKeys( "<HOME>" ) - for iCurrentLibrary = 1 to iLibraryItemCount - if ( Bibliotheksliste.getSelText() = "AppLibrary1" ) then - printlog( "Found AppLibrary1" ) - exit for + printlog( "Check the number of libraries in list (should be two)" ) + kontext "tabbibliotheken" + iLibraryItemCount = Bibliotheksliste.getItemCount() + if ( iLibraryItemCount <> 2 ) then + qaerrorlog( "#i87457# Two entries in list expected, found " & iLibraryItemCount ) endif - printlog( "This was not AppLibrary1, trying again" ) - Bibliotheksliste.Typekeys( "<DOWN>" ) - next iCurrentLibrary - - printlog( "Set a password for AppLibrary1" ) - kontext "tabbibliotheken" - if ( Passwort.IsEnabled() ) then - Passwort.Click() - kontext "passwddlg" - PasswdDLG.Cancel() - else - warnlog( "Password is disabled for 'AppLibrary1'" ) - endif - printlog( "Delete 'AppLibrary1'" ) - kontext "tabbibliotheken" - Loeschen.Click() - - printlog( "Close the warning with YES" ) - kontext "active" - if ( Active.Exists() ) then - cMsg = active.getText() - cMsg = hRemoveLineBreaks( cMsg ) - printlog( "MessageBox: " & cMsg ) - Active.Yes() - else - warnlog( "Expected confirmation dialog for delete" ) - endif - - kontext "tabbibliotheken" - printlog( "Press 'edit' on 'Libraries'-tab" ) - Bearbeiten.Click() + printlog( "Select the first item" ) + Bibliotheksliste.TypeKeys( "<HOME>" ) + for iCurrentLibrary = 1 to iLibraryItemCount + if ( Bibliotheksliste.getSelText() = REFERENCE_LIBRARY ) then + printlog( "Found " & REFERENCE_LIBRARY ) + exit for + endif + printlog( "This was not " & REFERENCE_LIBRARY & ", trying again" ) + Bibliotheksliste.Typekeys( "<DOWN>" ) + next iCurrentLibrary + + printlog( "Set a password for " & REFERENCE_LIBRARY ) + kontext "tabbibliotheken" + if ( hClickButton( Passwort ) <> RC_TIMEOUT ) then + kontext "passwddlg" + hCloseDialog( PasswdDLG, "cancel" ) + else + warnlog( "Password is disabled for " & REFERENCE_LIBRARY ) + endif - kontext "BasicIDE" - if ( BasicIDE.Exists( 5 ) ) then - - hInsertMacro( 3 ) - - printlog( "Close the basic-document" ) - brc = hCloseBasicIde() + printlog( "Delete " & REFERENCE_LIBRARY ) + kontext "tabbibliotheken" + Loeschen.Click() + printlog( "Close the warning with YES" ) kontext "active" - if ( Active.Exists ( 2 ) ) then - cMsg = active.getText() - cMsg = hRemoveLineBreaks( cMsg ) - warnlog( "Unexpected MessageBox: " & cMsg ) - Active.NO() + if ( Active.Exists() ) then + printlog( "MessageBox: " & active.getText() ) + Active.Yes() + else + warnlog( "Expected confirmation dialog for delete" ) endif - else - warnlog("#i38978# The Macro-Document is not open, aborting test") - call hDestroyDocument() - goto endsub - endif + kontext "tabbibliotheken" + printlog( "Press 'edit' on 'Libraries'-tab" ) + Bearbeiten.Click() - printlog( "Open the BASIC Macro Organizer" ) - brc = hOpenBasicOrganizerFromDoc() - - printlog( "Select the last macro from the list" ) - kontext "makro" - iPos = hSelectTheLastNode( MakroAus ) - - try - printlog( "Assign the macro, Tools/customize dialog should open" ) - Zuordnen.Click () - catch - warnlog( "#i106853# Assign-Button is disabled or macro is missing" ) - endcatch - - printlog( "Activate all tapages and cancel the Tools/Customize dialog" ) - - brc = hToolsCustomizeSelectTab( "menu" ) - brc = hToolsCustomizeSelectTab( "keyboard" - if ( not brc ) then - qaerrorlog( "#i61765# Keyboard tab missing when called via Tools/Macros->Assign" ) - endif - brc = hToolsCustomizeSelectTab( "events" ) - brc = hToolsCustomizeSelectTab( "toolbars" ) + kontext "BasicIDE" + if ( BasicIDE.Exists( DIALOG_TIMEOUT ) ) then - printlog( "Cancel Tools/Customize dialog -> Macro Organizer should be open" ) - brc = hToolsCustomizeClose( 2 ) - - - printlog "Click to run macro" - kontext "makro" - try - Ausfuehren.Click() - catch - warnlog( "Unable to run macro" ) + hInsertMacro( 3 ) + + printlog( "Close the basic-document" ) + hCloseBasicIde() + + kontext "active" + if ( Active.Exists ( DIALOG_TIMEOUT ) ) then + warnlog( "Unexpected MessageBox: " & active.getText() ) + Active.NO() + endif + + else + warnlog("#i38978# The Macro-Document is not open, aborting test") + call hDestroyDocument() + goto endsub + endif + + printlog( "Open the BASIC Macro Organizer" ) + ToolsMacro_uno + + printlog( "Select the last macro from the list" ) + kontext "makro" + if ( Makro.exists( DIALOG_TIMEOUT ) ) then + hSelectTheLastNode( MakroAus ) + + printlog( "Assign the macro, Tools/customize dialog should open" ) + if ( hClickButton( Zuordnen ) = RC_TIMEOUT ) then + warnlog( "#i106853# Assign-Button is disabled or macro is missing" ) + endif + + printlog( "Activate all tapages and cancel the Tools/Customize dialog" ) + if ( not hToolsCustomizeSelectTab( "keyboard" ) ) then + qaerrorlog( "#i61765# Keyboard tab missing when called via Tools/Macros->Assign" ) + endif + hToolsCustomizeSelectTab( "events" ) + hToolsCustomizeSelectTab( "toolbars" ) + + printlog( "Cancel Tools/Customize dialog -> Macro Organizer should be open" ) + kontext "TabCustomizeToolbars" + hCloseDialog( TabCustomizeToolbars, "cancel" ) + + + printlog "Click to run macro" + kontext "makro" + if ( hClickButton( Ausfuehren ) = RC_TIMEOUT ) then + warnlog( "Unable to run macro, button is not enabled" ) + kontext "Makro" + hCloseDialog( Makro, "close" ) + endif + + kontext "active" + if ( active.exists() ) then + if ( active.getText() = "TTMacro3" ) then + printlog( "The correct macro has been executed" ) + else + warnlog( "Unknown Messagebox: " & active.getText() ) + endif + Active.OK() + endif + else + warnlog( "Macro Organizer did not open" ) + endif + + printlog( "Open macro organizer from the current document" ) + ToolsMacro_uno : WaitSlot() + + printlog( "Select the last item in the treelist" ) kontext "Makro" - Makro.close() - endcatch - - kontext "active" - if ( active.exists() ) then - cMsg = active.getText() - cMsg = hRemoveLineBreaks( cMsg ) - if ( cMsg = "TTMacro3" ) then - printlog( "The correct macro has been executed" ) + hSelectTheLastNode( MakroAus ) + + printlog( "Delete the new module" ) + Loeschen.Click() + + printlog( "Close the deletion warning" ) + kontext "active" + if ( active.exists() ) then + printlog( "MessageBox: " & active.getText() ) + Active.Yes() else - warnlog( "Unknown Messagebox: " & cMsg ) + warnlog( "No confirmation dialog for delete" ) endif - Active.OK() - endif - - printlog( "Open macro organizer from the current document" ) - brc = hOpenBasicOrganizerFromDoc() - - printlog( "Select the last item in the treelist" ) - brc = hSelectTheLastNode( MakroAus ) - printlog( "Delete the new module" ) - Loeschen.Click() - - printlog( "Close the deletion warning" ) - kontext "active" - if ( active.exists() ) then - cMsg = active.getText() - cMsg = hRemoveLineBreaks( cMsg ) - printlog( "MessageBox: " & cMsg ) - Active.Yes() + printlog( "Close the macro organizer" ) + kontext "makro" + Makro.Close() else - warnlog( "No confirmation dialog for delete" ) + warnlog( "Makro Organizer did not open" ) endif - printlog( "Close the macro organizer" ) - kontext "makro" - Makro.Close() - printlog( "Close the document" ) Call hDestroyDocument() - endcase |