diff options
Diffstat (limited to 'testautomation/global/tools/includes/optional/t_basic_organizer_tools.inc')
-rwxr-xr-x[-rw-r--r--] | testautomation/global/tools/includes/optional/t_basic_organizer_tools.inc | 266 |
1 files changed, 51 insertions, 215 deletions
diff --git a/testautomation/global/tools/includes/optional/t_basic_organizer_tools.inc b/testautomation/global/tools/includes/optional/t_basic_organizer_tools.inc index cb348d3c1c3f..b813ee2bf706 100644..100755 --- a/testautomation/global/tools/includes/optional/t_basic_organizer_tools.inc +++ b/testautomation/global/tools/includes/optional/t_basic_organizer_tools.inc @@ -70,76 +70,49 @@ end function function hCreateModuleForDoc( optional cName as string ) as boolean - use "global\tools\includes\optional\t_treelist_tools.inc" - use "global\tools\includes\optional\t_stringtools.inc" - '///<h3>Create a new Basic module for the current document</h3> '///<i>Starting point: Basic Macro Organizer is visible and has focus</i> - '///<ul> - const CFN = "hCreateModuleForDoc::" + const DEFAULT_WAIT = 2 + const RETVAL_FAILURE = 0 - dim iWait as integer ' how long we had to wait for the IDE to open - dim iPos as integer - dim brc as boolean ' boolean returncode, a temporary variable - brc = false - dim cMsg as string + if ( isMissing( cName ) ) then cName = "TTModule" - ' make sure that we have a name for the module - if ( isMissing( cName ) ) Then - cName = "TTModule" - endif - - '///+<li>Select the last module (it should belong to the current document)</li> kontext "Makro" - iPos = hSelectTheLastNode( MakroAus ) - - '///+<li>Click the New-Button, name the module</li> - if ( Neu.isEnabled() ) then - 'printlog( CFN & "New-button is enabled" ) - else - warnlog( CFN & "New-button is disabled" ) - hCreateModuleForDoc() = false - exit function - endif - - Neu.Click() - - '///+<li>If the module already exists we end up on the Deletion dialog</li> - kontext "Active" - if ( Active.exists() ) then - cMsg = active.getText() - cMsg = hRemoveLineBreaks( cMsg ) - printlog( "Module seems to exist, deleting Main: " & cMsg ) - Active.Yes() - endif - - Kontext "NeuesModul" - if ( NeuesModul.exists() ) then - Modulname.SetText( cName ) - NeuesModul.OK() + if ( Makro.exists() ) then + if ( hSelectTheLastNode( MakroAus ) > RETVAL_FAILURE ) then + + kontext "Makro" + if ( hClickButton( Neu ) ) then + + Kontext "NeuesModul" + if ( NeuesModul.exists( DEFAULT_WAIT ) ) then + Modulname.SetText( cName ) + hCloseDialog( NeuesModul, "ok" ) + + kontext "BasicIDE" + if ( BasicIde.exists( DEFAULT_WAIT ) ) then + hCreateModuleForDoc() = true + else + printlog( CFN & "BASIC IDE is not open" ) + hCreateModuleForDoc() = false + endif + else + warnlog( CFN & "Dialog <NeuesModul> did not open" ) + hCreateModuleForDoc() = false + endif + else + warnlog( CFN & "Failed to click <Neu> button" ) + hCreateModuleForDoc() = false + endif + else + warnlog( CFN & "Failed to select the last node" ) + hCreateModuleForDoc() = false + endif else - warnlog( CFN & "Failed create a new module, aborting" ) + warnlog( CFN & "Macro organizer is not open" ) hCreateModuleForDoc() = false - kontext "Makro" - Makro.cancel() - exit function endif - - '///+<li>Wait for the BASIC_IDE to open, verify</li> - ' BasicIDE is bad for "Kontexting", using the default toolbar instead - kontext "MacroBar" - if ( MacroBar.exists( 3 ) ) then - printlog( CFN & "Exit: New module: " & cName & ". IDE is open" ) - brc = true - else - warnlog( CFN & "Exit: Failed to create the Module" ) - brc = false - endif - - hCreateModuleForDoc() = brc - '///+<li>Return TRUE on success, FALSE on failure</li> - '///</ul> end function @@ -157,17 +130,12 @@ function hOpenBasicObjectOrganizer( iTabPage as integer ) as boolean ' BASIC-IDE ' NOTE: This is the organizer for libraries, modules and dialogs, ' not the one to run or assign macros! - - dim iMenuSize as integer - dim brc as boolean - '///+<li>Open the context menu of the tabbar</li> kontext "basicide" - Tabbar.OpenContextMenu + Tabbar.OpenContextMenu() '///+<li>Select the last entry of the context menu (dynamic menu!)</li> - iMenuSize = hMenuItemgetCount() - if ( iMenuSize = 2 ) then + if ( hMenuItemGetCount() = 2 ) then printlog( " * short context menu (no edit-window)" ) hMenuSelectNr( 2 ) else @@ -178,13 +146,12 @@ function hOpenBasicObjectOrganizer( iTabPage as integer ) as boolean WaitSlot() '///+<li>On the basic object organizer switch to the Modules tab</li> - brc = hSelectBasicObjectOrganizerTab( 1 ) - if ( not brc ) then + if ( hSelectBasicObjectOrganizerTab( 1 ) ) then + printlog( CFN & "Requested page is open" ) + hOpenBasicObjectOrganizer() = true + else warnlog( CFN & "Failed to open requested Tabpage" ) hOpenBasicObjectOrganizer() = false - else - printlog( CFN & "Requested page is open" ) - hOpenBasicObjectOrganizer = true endif '///+<li>Return TRUE on success, FALSE on failure</li> '///</ul> @@ -194,37 +161,6 @@ end function '******************************************************************************* -function hOpenBasicOrganizerFromDoc() as boolean - - '///<h3>Open the Basic Macro Organizer from a plain document</h3> - '///<i>Starting point: Plain document</i> - '///<ul> - - const CFN = "hOpenBasicOrganizerFromDoc::" - - '///+<li>Use the slot ToolsMacro_uno to open the Basic Macro organizer</li> - ToolsMacro_uno - - '///+<li>Verify that the dialog is open</li> - kontext "Makro" - if ( not Makro.exists() ) then - warnlog( CFN & "Could not open Macro Organizer" ) - hOpenBasicOrganizerFromDoc() = false - exit function - endif - - call dialogtest( Makro ) - - '///+<li>Return TRUE on success, FALSE on failure</li> - printlog( CFN & "Basic Organizer is open" ) - hOpenBasicOrganizerFromDoc() = true - kontext "Makro" - '///</ul> - -end function - -'******************************************************************************* - function hSelectBasicObjectOrganizerTab( iTabPage as integer ) as boolean const CFN = "hSelectBasicObjectOrganizerTab::" @@ -239,13 +175,6 @@ function hSelectBasicObjectOrganizerTab( iTabPage as integer ) as boolean '///Description: '///<ul> - '///+<li>Verify function parameters</li> - if ( ( iTabPage < 1 ) or ( iTabPage > 3 ) ) then - warnlog( CFN & "Illegal argument passed to function: " & iTabPage ) - hSelectBasicObjectOrganizerTab() = false - exit function - endif - '///+<li>Switch between tabpages 1, 2 or 3</li> select case iTabPage case 1 : @@ -295,22 +224,16 @@ function hDeleteLibrary( iLocation as integer, cLibName as string ) as boolean const CFN = "hDeleteLibrary::" const ITABPOS = 3 - '///+<li>Verify function parameters</li> - if ( ( iLocation < 1 ) or ( iLocation > 3 ) ) then - warnlog( CFN & "Invalid parameter passed to function" ) - hDeleteLibrary() = false - endif - dim iObjectCount as integer dim iCurrentObject as integer dim cCurrentObjectName as string '///+<li>Open Macro Organizer</li> - hOpenBasicOrganizerFromDoc() + ToolsMacro_uno '///+<li>Click Manage-button</li> Kontext "Makro" - Verwalten.click() + hClickButton( Verwalten ) '///+<li>Go to the Libraries Tab on the Macro Object Organizer</li> hSelectBasicObjectOrganizerTab( ITABPOS ) @@ -329,7 +252,7 @@ function hDeleteLibrary( iLocation as integer, cLibName as string ) as boolean if ( cCurrentObjectName = cLibName ) then '///+<li>Click Delete</li> - Loeschen.click() + hClickButton( Loeschen ) exit for endif @@ -337,7 +260,7 @@ function hDeleteLibrary( iLocation as integer, cLibName as string ) as boolean '///+<li>Confirm to delete library</li> Kontext "Active" - if ( Active.exists() ) then + if ( Active.exists( 1 ) ) then active.yes() else warnlog( CFN & "No confirmation for delete" ) @@ -354,11 +277,11 @@ function hDeleteLibrary( iLocation as integer, cLibName as string ) as boolean endif '///+<li>Cancel Macro Object Organizer</li> - TabBibliotheken.cancel() + hCloseDialog( TabBibliotheken, "cancel" ) '///+<li>Cancel Basic Macro Organizer</li> Kontext "Makro" - Makro.cancel() + hCloseDialog( Makro, "cancel" ) '///+<li>Return TRUE on success, FALSE on failure</li> '///</ul> @@ -366,84 +289,6 @@ end function '******************************************************************************* -function hIsMacroEditButtonEnabled() as boolean - - '///<h3>Test whether the "Edit..." button is enabled or not</h3> - '///<i>Starting point: Basic Macro Organizer</i> - '///<ul> - - const CFN = "hIsMacroEditButtonEnabled::" - dim brc as boolean - - '///+<li>Check that the macro dialog is open</li> - Kontext "Makro" - if ( not Makro.exists() ) then - warnlog( "Macro organizer is not open, aborting function" ) - hIsMacroEditButtonEnabled() = false - exit function - endif - - '///+<li>Verify that the Edit...-Button exists and is enabled</li> - if ( bearbeiten.exists() ) then - if ( bearbeiten.isEnabled() ) then - printlog( CFN & "Button exists and is enabled" ) - brc = true - else - printlog( CFN & "Button exists but is disabled" ) - brc = false - endif - else - warnlog( CFN & "Button does not exist" ) - brc = false - endif - - '///+<li>Return TRUE if button exists and is enabled</li> - '///</ul> - hIsMacroEditButtonEnabled() = brc - -end function - -'******************************************************************************* - -function hIsMacroNewButtonEnabled() as boolean - - '///<h3>Find out whether the "New..." button is enabled or not</h3> - '///<i>Starting point: Basic Macro Organizer</i> - '///<ul> - - const CFN = "hIsMacroNewButtonEnabled::" - dim brc as boolean - - '///+<li>Check that the macro dialog is open</li> - Kontext "Makro" - if ( not Makro.exists() ) then - warnlog( "Macro organizer is not open, aborting function" ) - hIsMacroNewButtonEnabled() = false - exit function - endif - - '///+<li>Verify that the New...-Button exists and is enabled</li> - if ( neu.exists() ) then - if ( neu.isEnabled() ) then - printlog( CFN & "Button exists and is enabled" ) - brc = true - else - printlog( CFN & "Button exists but is disabled" ) - brc = false - endif - else - warnlog( CFN & "Button does not exist" ) - brc = false - endif - - '///+<li>Return TRUE if button exists and is enabled</li> - '///</ul> - hIsMacroNewButtonEnabled() = brc - -end function - -'******************************************************************************* - function hNameBasicModule( cName as string ) as boolean '///<h3>Name a Basic Module</h3> @@ -466,12 +311,7 @@ function hNameBasicModule( cName as string ) as boolean '///<u>Description</u>: '///<ul> - use "global\tools\includes\optional\t_stringtools.inc" - const CFN = "hNameBasicModule::" - dim brc as boolean - brc = true - dim cMsg as string '///+<li>Verify that the naming dialog is open</li> kontext "NeuesModul" @@ -484,22 +324,20 @@ function hNameBasicModule( cName as string ) as boolean Modulname.SetText( cName ) '///+<li>Accept the name with OK</li> - NeuesModul.OK() + hCloseDialog( NeuesModul, "ok" ) '///+<li>If there is no warning, the name should be valid.</li> kontext "BasicIDE" if ( BasicIde.exists( 2 ) ) then - brc = true + hNameBasicModule() = true printlog( CFN & "Name accepted, Basic-Ide is open" ) else - brc = false + hNameBasicModule() = false '///+<li>Look for invalid name warning, close it</li> kontext "active" if ( active.exists() ) then - cMsg = active.getText() - cMsg = hRemoveLineBreaks( cMsg - printlog( CFN & "Msgbox: " & cMsg ) - active.ok() + printlog( CFN & "Msgbox: " & active.exists() ) + hCloseDialog( active, "ok" ) endif '///+<li>If the name is invalid, get back to the naming-dialog</li> @@ -510,8 +348,6 @@ function hNameBasicModule( cName as string ) as boolean warnlog( CFN & "Naming failed but we are not on the naming dialog" ) endif endif - - hNameBasicModule() = brc '///</ul> end function |