diff options
Diffstat (limited to 'testautomation/global/tools')
31 files changed, 289 insertions, 278 deletions
diff --git a/testautomation/global/tools/closeoffice.bas b/testautomation/global/tools/closeoffice.bas index da402ecd40f7..da402ecd40f7 100644..100755 --- a/testautomation/global/tools/closeoffice.bas +++ b/testautomation/global/tools/closeoffice.bas diff --git a/testautomation/global/tools/includes/optional/t_accels.inc b/testautomation/global/tools/includes/optional/t_accels.inc index 04718449b13b..c700d887b8d5 100755..100644 --- a/testautomation/global/tools/includes/optional/t_accels.inc +++ b/testautomation/global/tools/includes/optional/t_accels.inc @@ -25,7 +25,7 @@ ' '/************************************************************************ '* -'* owner : joerg.skottke@oracle.com +'* owner : gregor.hartmann@oracle.com '* '* short description : handle accelerators '* diff --git a/testautomation/global/tools/includes/optional/t_basic_ide_tools.inc b/testautomation/global/tools/includes/optional/t_basic_ide_tools.inc index f7537d52700c..536ffb99dda6 100755..100644 --- a/testautomation/global/tools/includes/optional/t_basic_ide_tools.inc +++ b/testautomation/global/tools/includes/optional/t_basic_ide_tools.inc @@ -25,7 +25,7 @@ ' '/************************************************************************ ' ** -' ** owner : joerg.skottke@oracle.com +' ** owner : gregor.hartmann@oracle.com ' ** ' ** short description : tools for the property-browser test ' ** 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 f63d610dbdb8..83c037b83f0e 100755..100644 --- a/testautomation/global/tools/includes/optional/t_basic_organizer_tools.inc +++ b/testautomation/global/tools/includes/optional/t_basic_organizer_tools.inc @@ -25,7 +25,7 @@ ' '/************************************************************************ ' ** -' ** owner : joerg.skottke@oracle.com +' ** owner : gregor.hartmann@oracle.com ' ** ' ** short description : tools for tools/macro test ' ** diff --git a/testautomation/global/tools/includes/optional/t_control_objects.inc b/testautomation/global/tools/includes/optional/t_control_objects.inc index b1da7d7e8d95..266243d93bb1 100755..100644 --- a/testautomation/global/tools/includes/optional/t_control_objects.inc +++ b/testautomation/global/tools/includes/optional/t_control_objects.inc @@ -25,7 +25,7 @@ ' '/************************************************************************ '* -'* owner : joerg.skottke@oracle.com +'* owner : gregor.hartmann@oracle.com '* '* short description : Functions to manipulate controls by accessing them as objects '* @@ -115,7 +115,7 @@ function lb_test( oControl as object, items as integer, preset as integer, issue endif endif - for con_iterator = 1 to items + for con_iterator = 1 to con_items oControl.select( con_iterator ) next con_iterator diff --git a/testautomation/global/tools/includes/optional/t_docfuncs.inc b/testautomation/global/tools/includes/optional/t_docfuncs.inc index 7f43b7211630..5e3e76028e6b 100755..100644 --- a/testautomation/global/tools/includes/optional/t_docfuncs.inc +++ b/testautomation/global/tools/includes/optional/t_docfuncs.inc @@ -25,7 +25,7 @@ ' '/************************************************************************ '* -'* owner : joerg.skottke@oracle.com +'* owner : gregor.hartmann@oracle.com '* '* short description : misc functions to handle documents '* diff --git a/testautomation/global/tools/includes/optional/t_extension_manager_tools.inc b/testautomation/global/tools/includes/optional/t_extension_manager_tools.inc index 654b1b76c515..4b7c481ffe8f 100755..100644 --- a/testautomation/global/tools/includes/optional/t_extension_manager_tools.inc +++ b/testautomation/global/tools/includes/optional/t_extension_manager_tools.inc @@ -25,7 +25,7 @@ ' '/****************************************************************************** '* -'* owner : joerg.skottke@oracle.com +'* owner : gregor.hartmann@oracle.com '* '* short description : Tools to ease working with the extension manager '* diff --git a/testautomation/global/tools/includes/optional/t_filetools.inc b/testautomation/global/tools/includes/optional/t_filetools.inc index 070427ef3c5b..dd8a9affc1be 100755..100644 --- a/testautomation/global/tools/includes/optional/t_filetools.inc +++ b/testautomation/global/tools/includes/optional/t_filetools.inc @@ -25,7 +25,7 @@ ' '/************************************************************************ '* -'* owner : joerg.skottke@oracle.com +'* owner : gregor.hartmann@oracle.com '* '* short description : Functions that work with files like deleting, loading... '* @@ -260,80 +260,6 @@ end function '******************************************************************************* -function hGetWorkPath() as string - - '///<h3>Retrieve the users work directory</h3> - '///<i>Uses: Call to UNO service</i><br> - '///<i>Errorhandling: Fixes "$(user)"-type path (uses fallback)</i><br> - '///<i>Errorhandling: Handles broken UNO connection (uses fallback)</i><br> - '///<u>Input</u>: - '///<ol> - '///+<li>Nothing</li> - '///</ol> - '///<u>Returns</u>: - '///<ol> - '///+<li>Path to local workdir (string)</li> - '///<ul> - '///+<li>Includes trailing slash/backslash</li> - '///</ul> - '///</ol> - '///<u>Description</u>: - '///<ul> - - dim sPath as string - dim sDefaultPath as string - sDefaultPath = convertpath( gOfficePath & "user/work" ) - dim oOfficeConnect as object - dim oOfficeConfig as object - dim bPathIsFromAPI as boolean - - const CFN = "hGetWorkPath::" - - '///+<li>Create an UNO service and ask it for the location of "Work"</li> - try - oOfficeConnect = hGetUnoService( true ) - oOfficeConfig = oOfficeConnect.createInstance( "com.sun.star.util.PathSettings" ) - sPath = convertFromURL( oOfficeConfig.Work ) - bPathIsFromAPI = true - catch - '///+<li>Handle broken UNO connection</li> - printlog( CFN & "Could not access service, connection broken?" ) - sPath = "" - bPathIsFromAPI = false - endcatch - - '///+<li>If the path differs from the default do a warnlog</li> - if ( sPath <> sDefaultPath ) then - printlog( CFN & "Default path is: " & sDefaultPath ) - printlog( CFN & "Workpath is not defaultpath: " & sPath ) - printlog( CFN & "Overriding UNO path" ) - sPath = convertpath( gOfficePath & "user\work" ) - bPathIsFromAPI = false - endif - - '///+<li>Apply fallback in case of broken connection or invalid path</li> - if ( instr( sPath , "$(user)" ) > 0 ) then - printlog( CFN & "sPath has $(user)-type string, using fallback" ) - sPath = sDefaultPath - bPathIsFromAPI = false - endif - - '///+<li>Add trailing pathseparator, do convertpath</li> - sPath = sPath & "/" - sPath = convertpath( sPath ) - - '///+<li>Print info to the log and return the path</li> - if ( GVERBOSE ) then - if ( bPathIsFromAPI ) then - printlog( CFN & "(From API): " & sPath ) - else - qaerrorlog( CFN & "(Junked API-Path): " & sPath ) - endif - endif - hGetWorkPath() = sPath - '///</ul> - -end function '******************************************************************************* @@ -389,24 +315,5 @@ end function '******************************************************************************* -function hGetWorkFile( cFileName as string ) as string - - '///<h3>Returns a fully qualified filename to a workfile</h3> - '///<u>Input</u>: - '///<ol> - '///+<li>Filename without path (string)</li> - '///</ol> - '///<u>Returns</u>: - '///<ol> - '///+<li>Filename including path to user work directory (string)</li> - '///</ol> - '///<u>Description</u>: - '///<ul> - - '///+<li>Concatenate workpath and filename, convertpath</li> - hGetWorkFile() = convertpath( hGetWorkPath() & cFileName ) - '///</ul> - -end function diff --git a/testautomation/global/tools/includes/optional/t_key_tools.inc b/testautomation/global/tools/includes/optional/t_key_tools.inc index 14906c127c68..f32984f963e3 100755..100644 --- a/testautomation/global/tools/includes/optional/t_key_tools.inc +++ b/testautomation/global/tools/includes/optional/t_key_tools.inc @@ -25,7 +25,7 @@ ' '/************************************************************************ '* -'* owner : joerg.skottke@oracle.com +'* owner : gregor.hartmann@oracle.com '* '* short description : tools for evaluation of key=value datalists '* diff --git a/testautomation/global/tools/includes/optional/t_listfuncs.inc b/testautomation/global/tools/includes/optional/t_listfuncs.inc index c90d077db651..cb020d343662 100755..100644 --- a/testautomation/global/tools/includes/optional/t_listfuncs.inc +++ b/testautomation/global/tools/includes/optional/t_listfuncs.inc @@ -25,7 +25,7 @@ ' '/****************************************************************************** '* -'* owner : joerg.skottke@oracle.com +'* owner : gregor.hartmann@oracle.com '* '* short description : Replacements for routines in t_lists.inc adds some '* diff --git a/testautomation/global/tools/includes/optional/t_locale_strings1.inc b/testautomation/global/tools/includes/optional/t_locale_strings1.inc index 29c4bcf3cb6b..29c4bcf3cb6b 100755..100644 --- a/testautomation/global/tools/includes/optional/t_locale_strings1.inc +++ b/testautomation/global/tools/includes/optional/t_locale_strings1.inc diff --git a/testautomation/global/tools/includes/optional/t_macro_tools.inc b/testautomation/global/tools/includes/optional/t_macro_tools.inc index 6c1fcc478e5a..c4b432135739 100755..100644 --- a/testautomation/global/tools/includes/optional/t_macro_tools.inc +++ b/testautomation/global/tools/includes/optional/t_macro_tools.inc @@ -25,7 +25,7 @@ ' '/************************************************************************ ' ** -' ** owner : joerg.skottke@oracle.com +' ** owner : gregor.hartmann@oracle.com ' ** ' ** short description : Helper functions for Macro tests ' ** @@ -172,4 +172,44 @@ function hBasicIDERunMacro( cIdentifier as string ) as boolean hBasicIDERunMacro() = false endif +end function + +'******************************************************************************* + +function hExecMacro( cMacro as string ) as boolean + + const CFN = "global::tools::includes::optional::t_macro_tools.inc::hExecMacro(): " + + dim iCurrentModule as integer + dim iCurrentMacro as integer + hEXECMacro() = FALSE + + ToolsMacro_uno + + kontext "Makro" + if ( Makro.exists( 2 ) ) then + ' Iterate through the left treelist + for iCurrentModule = hExpandAllNodes( MakroAus ) to 1 step -1 + MakroAus.select( iCurrentModule ) + ' Iterate through the Macros list (right pane) + for iCurrentMacro = 1 to MakroListe.getItemCount() + MakroListe.select( iCurrentMacro ) + ' Try to find the macro + if ( cMacro = MakroListe.getSelText() ) then + ' Run the macro + if ( Ausfuehren.isEnabled() ) then + Ausfuehren.click() + hExecMacro() = TRUE + exit function + else + warnlog( CFN & "Macro found but <Ausfuehren> is not enabled" ) + exit function + endif + endif + next iCurrentMacro + next iCurrentModule + else + warnlog( CFN & "Macro Organizer is not open within 2 seconds" ) + endif + end function
\ No newline at end of file diff --git a/testautomation/global/tools/includes/optional/t_ole.inc b/testautomation/global/tools/includes/optional/t_ole.inc index 13138dfc52ab..23b3e02a7ae8 100755..100644 --- a/testautomation/global/tools/includes/optional/t_ole.inc +++ b/testautomation/global/tools/includes/optional/t_ole.inc @@ -25,7 +25,7 @@ ' '/****************************************************************************** '* -'* owner : joerg.skottke@oracle.com +'* owner : gregor.hartmann@oracle.com '* '* short description : Tools for OLE objects '* diff --git a/testautomation/global/tools/includes/optional/t_security_tools.inc b/testautomation/global/tools/includes/optional/t_security_tools.inc index 6952f7ea16b3..b86894a68eb1 100755..100644 --- a/testautomation/global/tools/includes/optional/t_security_tools.inc +++ b/testautomation/global/tools/includes/optional/t_security_tools.inc @@ -25,7 +25,7 @@ ' '/************************************************************************ '* -'* owner : joerg.skottke@oracle.com +'* owner : gregor.hartmann@oracle.com '* '* short description : Tools to ease testing of security related funtionality '* diff --git a/testautomation/global/tools/includes/optional/t_stringtools.inc b/testautomation/global/tools/includes/optional/t_stringtools.inc index 7f946fd3b046..6ffb2f467a1b 100755..100644 --- a/testautomation/global/tools/includes/optional/t_stringtools.inc +++ b/testautomation/global/tools/includes/optional/t_stringtools.inc @@ -25,7 +25,7 @@ ' '/************************************************************************ '* -'* owner : joerg.skottke@oracle.com +'* owner : gregor.hartmann@oracle.com '* '* short description : Functions for manipulation of strings '* diff --git a/testautomation/global/tools/includes/optional/t_treelist_tools.inc b/testautomation/global/tools/includes/optional/t_treelist_tools.inc index e9c254ac07b4..3ce78163d843 100755..100644 --- a/testautomation/global/tools/includes/optional/t_treelist_tools.inc +++ b/testautomation/global/tools/includes/optional/t_treelist_tools.inc @@ -25,7 +25,7 @@ ' '/************************************************************************ '* -'* owner : joerg.skottke@oracle.com +'* owner : gregor.hartmann@oracle.com '* '* short description : Helpers for accessing treelists '* diff --git a/testautomation/global/tools/includes/optional/t_ui_filters.inc b/testautomation/global/tools/includes/optional/t_ui_filters.inc index 7b9dd66e1a40..d4c536b73718 100644 --- a/testautomation/global/tools/includes/optional/t_ui_filters.inc +++ b/testautomation/global/tools/includes/optional/t_ui_filters.inc @@ -25,7 +25,7 @@ ' '/****************************************************************************** '* -'* owner : joerg.skottke@oracle.com +'* owner : gregor.hartmann@oracle.com '* '* short description : Get the UI names for default filters '* diff --git a/testautomation/global/tools/includes/optional/t_user_info.inc b/testautomation/global/tools/includes/optional/t_user_info.inc index d4771be2e3c9..429aad5d2e8e 100644 --- a/testautomation/global/tools/includes/optional/t_user_info.inc +++ b/testautomation/global/tools/includes/optional/t_user_info.inc @@ -25,7 +25,7 @@ ' '/****************************************************************************** '* -'* owner : joerg.skottke@oracle.com +'* owner : gregor.hartmann@oracle.com '* '* short description : Extension Update Test '* diff --git a/testautomation/global/tools/includes/optional/t_xml1.inc b/testautomation/global/tools/includes/optional/t_xml1.inc index 5afd05cbb22f..5afd05cbb22f 100755..100644 --- a/testautomation/global/tools/includes/optional/t_xml1.inc +++ b/testautomation/global/tools/includes/optional/t_xml1.inc diff --git a/testautomation/global/tools/includes/optional/t_xml2.inc b/testautomation/global/tools/includes/optional/t_xml2.inc index 46dc9b350393..46dc9b350393 100755..100644 --- a/testautomation/global/tools/includes/optional/t_xml2.inc +++ b/testautomation/global/tools/includes/optional/t_xml2.inc diff --git a/testautomation/global/tools/includes/required/t_dir.inc b/testautomation/global/tools/includes/required/t_dir.inc index ee673e6b1c47..f5aa59e2d78b 100755..100644 --- a/testautomation/global/tools/includes/required/t_dir.inc +++ b/testautomation/global/tools/includes/required/t_dir.inc @@ -288,4 +288,55 @@ function GetExtention ( Datei as String ) as string next i% GetExtention = Datei end function +' +'------------------------------------------------------------------------------- +' +function hSplitString( sString as string, sSeparator as string, iIndex as integer ) as string + + ' This function wraps around the "split" command and returns one single + ' item by index. Index = 0 means the *LAST* item is returned as this is + ' probably the most commonly used item. If the index is invalid (out of + ' bounds) we print a warning and return an error string. + + const CFN = "global::tools::includes::required::t_dir.inc:hSplitString(): " + const ERROR_MESSAGE = "Array out of bounds for the requested index in string " + const ARRAY_INDEX_CORRECTION = 1 ' The array lower boundary is zero but + ' function starts to count with one. + + ' Split the string into its fragments into an array with dynamic boundaries + dim sArray() as string + dim sReturnString as string : sReturnString = "" + + if ( GVERBOSE ) then + printlog( CFN & "Separator is: " & sSeparator ) + printlog( CFN & "Original string is: " & sString ) + endif + + sArray() = split( sString, sSeparator ) + + if ( GVERBOSE ) then + printlog( CFN & "Number of items found: " & ubound( sArray() ) ) + endif + + ' Special case: Index out of bounds + if ( iIndex > ( ubound( sArray() ) + ARRAY_INDEX_CORRECTION ) or iIndex < 0 ) then + warnlog( CFN & ERROR_MESSAGE & sString ) + hSplitString() = ERROR_MESSAGE & sString + exit function + endif + + ' Special case: Last item requested (this usually is the filename from a path) + if ( iIndex = 0 ) then + sReturnString = sArray( ubound( sArray() ) + if ( GVERBOSE ) then printlog( CFN & sReturnString ) + hSplitString() = sReturnString + exit function + endif + + ' Default is to return the requested item. + sReturnString = sArray( iIndex - ARRAY_INDEX_CORRECTION ) + if ( GVERBOSE ) then printlog( CFN & sReturnString ) + hSplitString() = sReturnString + +end function diff --git a/testautomation/global/tools/includes/required/t_doc1.inc b/testautomation/global/tools/includes/required/t_doc1.inc index ff07554bca35..0ee504c5432e 100755 --- a/testautomation/global/tools/includes/required/t_doc1.inc +++ b/testautomation/global/tools/includes/required/t_doc1.inc @@ -243,20 +243,17 @@ end function ' function hCloseDocument() - '/// Trigger FileClose slot' hUseAsyncSlot( "FileClose") - '/// Accept to lose changes' Kontext "Active" if ( Active.Exists( 2 ) ) then try Active.No catch - Active.Click( 202 ) + Active.click( 202 ) endcatch end if - '/// Wait for FileClose to complete' WaitSlot( 2000 ) end function @@ -357,6 +354,8 @@ end sub ' sub hTypeKeys ( OutputText , optional _iLoop as Integer ) + const CFN = "global::tools::includes::required::t_doc1.inc::hTypeKeys(): " + dim iRepeat as integer dim iLoop as integer dim oDocument as object @@ -371,10 +370,14 @@ sub hTypeKeys ( OutputText , optional _iLoop as Integer ) hSetDocumentContext() ' set kontext to current document type oDocument = hSetDocumentObject() ' Get the document object we want to write to - for iRepeat = 1 to iLoop - oDocument.TypeKeys( OutputText ) - wait( 200 ) - next iRepeat + try + for iRepeat = 1 to iLoop + oDocument.TypeKeys( OutputText ) + wait( 200 ) + next iRepeat + catch + warnlog( CFN & "Failed to send keystroke to given context" ) + endcatch end sub diff --git a/testautomation/global/tools/includes/required/t_doc2.inc b/testautomation/global/tools/includes/required/t_doc2.inc index 4192563b0eba..0e9af93f287c 100755..100644 --- a/testautomation/global/tools/includes/required/t_doc2.inc +++ b/testautomation/global/tools/includes/required/t_doc2.inc @@ -113,135 +113,6 @@ end sub ' '------------------------------------------------------------------------------- ' -function hEnableDocumentEditMode() as boolean - - hEnableDocumentEditMode() = false - - dim iTry as integer - - printlog( "Try to switch document to edit mode" ) - for iTry = 1 to 20 - try - kontext "Standardbar" - if ( Bearbeiten.getState( 2 ) <> 1 ) then - Bearbeiten.click() - - kontext "Active" - if ( Active.exists( 1 ) ) then - printlog( "Handle <Use copy message>" ) - hCloseDialog( Active, "yes" ) - wait( 2000 ) - printlog( "Successfully switched to edit mode" ) - hEnableDocumentEditMode() = true - exit for - endif - endif - catch - wait( 200 ) - endcatch - next iTry - -end function - -'******************************************************************************* - -function sMakeReadOnlyDocumentEditable() as boolean - - sMakeReadOnlyDocumentEditable() = hEnableDocumentEditMode() - exit function - - ' Function returns TRUE if document has been made editable and FALSE if - ' no action was required (that is: Document was not read-only) - - dim iTry as integer - dim iWait as integer - dim rc as integer - const CFN = "sMakeReadOnlyDocumentEditable::" - - if ( GVERBOSE ) then printlog( CFN & "Making document editable (create a copy) if it is readonly" ) - - ' We still run into synchronization problems with the "Make document editable" feature - ' because we do not know when this button becomes available and ready for use: The - ' document has to be loaded, then we have to wait for the toolbar to get populated. - ' One thing appears to work though: Try to execute the slot using hUseAsyncSlot. - ' This is a little bit tricky because the state of the document is altered but if - ' the slot has been executed once we know for sure that the button on the toolbar is - ' available and can check its state and - if need be - chenge the document state back. - - ' ========== Workaround begin ========== - hUseAsyncSlot( "EditDoc" ) - kontext "Active" - if ( Active.exists() ) then - if ( GVERBOSE ) then printlog( "Handling create copy message" ) - Active.yes() - wait( 1000 ) - endif - ' ========== Workaround end ========== - Kontext "Standardbar" - iWait = 0 - Do - if ( Bearbeiten.IsEnabled() ) then - try - if Bearbeiten.getState( 2 ) = 0 then - exit do - endif - catch - if ( GVERBOSE ) then printlog "Attempt " & iWait & " to make document readable failed" - iWait = iWait + 1 - wait ( 1000 ) - endcatch - else - if ( GVERBOSE ) then printlog "Attempt " & iWait & " to make document readable failed" - iWait = iWait + 1 - wait ( 1000 ) - end if - if iWait >= 5 then exit do - Loop - - if ( Bearbeiten.IsEnabled() ) then - - if ( Bearbeiten.getState( 2 ) = 0 ) then - - rc = hUseAsyncSlot("editdoc") - - if ( rc >= 0 ) then - for iTry = 1 to 2 - - - Kontext "Active" - if ( Active.exists( 5 ) ) then - - printlog( CFN & "Messagebox: " & Active.getText() ) - - try - if ( GVERBOSE ) then printlog( CFN & "Document was read-only. A copy will be used." ) - Active.Yes() - if ( GVERBOSE ) then printlog( CFN & "Closed 'use copy' message" ) - catch - if ( GVERBOSE ) then printlog( CFN & "Probing for unexpected messagebox..." ) - active.ok() - qaerrorlog( "#i100701 - Object not found message" ) - endcatch - else - printlog( CFN & "No messagebox informing about a copy being used" ) - endif - sMakeReadOnlyDocumentEditable() = TRUE - next iTry - else - printlog( CFN & "Document appears to be editable" ) - endif - else - if ( GVERBOSE ) then printlog( CFN & "Button <Bearbeiten> is pressed, document is editable" ) - sMakeReadOnlyDocumentEditable() = FALSE - endif - else - if ( GVERBOSE ) then printlog( CFN & "Control <Bearbeiten> is not enabled" ) - endif - -end function -' -'------------------------------------------------------------------------------- -' function fSelectFirstOLE() as integer 'Select first visible OLE object using Navigator 'Returns error-code: diff --git a/testautomation/global/tools/includes/required/t_files.inc b/testautomation/global/tools/includes/required/t_files.inc index 4b0ddd09318b..d734cd3f05a7 100755..100644 --- a/testautomation/global/tools/includes/required/t_files.inc +++ b/testautomation/global/tools/includes/required/t_files.inc @@ -34,7 +34,6 @@ function hGrafikEinfuegen( cFile as string ) as Boolean hGrafikEinfuegen() = hInsertGraphic( cFile, "Static" ) - exit function end function @@ -43,7 +42,6 @@ end function function hGrafikVerknuepftEinfuegen( cFile as string ) as Boolean hGrafikVerknuepftEinfuegen() = hInsertGraphic( cFile, "Linked" ) - exit function end function @@ -103,7 +101,7 @@ end function function hIsNamedDocLoaded( cFileName as string ) as boolean ' Retrieve the current filename from the document properties - which in - ' comparision to the old approach to retrive the name from the file save + ' comparision to the old approach to retrieve the name from the file save ' dialog - gives us the file including its extension. So we only need ' to compare the last characters from a full path to be relatively ' certain that we work with the correct file. There is some small margin of @@ -501,6 +499,167 @@ end function ' '------------------------------------------------------------------------------- ' +function hGetWorkFile( cFileName as string ) as string + hGetWorkFile() = hGetWorkPath() & cFileName +end function +' +'------------------------------------------------------------------------------- +' +function hGetWorkPath() as string + + ' Retrieve the user's work directory using the API (or fallback) + + dim sPath as string : sPath = "" + dim oOfficeConnect as object + dim oOfficeConfig as object + dim bPathIsFromAPI as boolean + + const CFN = "global::tools::includes::required::t_files.inc:hGetWorkPath(): " + + ' Create an UNO service and ask it for the location of Work + try + oOfficeConnect = hGetUnoService( true ) + oOfficeConfig = oOfficeConnect.createInstance( "com.sun.star.util.PathSettings" ) + sPath = convertFromURL( oOfficeConfig.Work ) + bPathIsFromAPI = true + catch + printlog( CFN & "Could not access service, connection broken?" ) + sPath = convertpath( gOfficePath & "user/work" ) + bPathIsFromAPI = false + endcatch + + if ( GVERBOSE ) then + + printlog( CFN & "Path is: " & sPath ) + + ' Check path existence + if ( FileExists( sPath ) ) then + printlog( CFN & "Path exists." ) + else + warnlog( CFN & "Path does not exist." ) + endif + + ' Inform about the location from where the path was taken + if ( bPathIsFromAPI ) then + printlog( CFN & "Path was taken from API" ) + else + warnlog( CFN & "Path was taken from (hardcoded) fallback" ) + endif + + endif + + hGetWorkPath() = sPath & getPathSeparator + +end function +' +'------------------------------------------------------------------------------- +' +function hFileGetLocalPath( sSourcePath as string ) as string + + ' Isolate filename from path, prepend local work directory and return new file path + hFileGetLocalPath() = hGetWorkFile( hSplitString( sSourcePath, getPathSeparator, 0 ) ) + +end function +' +'------------------------------------------------------------------------------- +' +function hFileListCopyLocal( lsSourceList() as string ) as boolean + + ' Copy a list of files from testautomation to the local work directory + + const CFN = "global::tools::includes::required::t_files.inc:hFileListCopyLocal(): " + dim iCurrentPath as integer + dim cTargetPath as string + dim cSourcePath as string + + hFileListCopyLocal() = true + + for iCurrentPath = 1 to listcount( lsSourceList() ) + + cSourcePath = lsSourceList( iCurrentPath ) + cTargetPath = hFileGetLocalPath( cSourcePath ) + + FileCopy( cSourcePath, cTargetPath ) + + ' If any one copy operation fails we + if ( not FileExists( cTargetPath ) ) then + hFileListCopyLocal() = false + warnlog( CFN & "File was not copied: " & cSourcePath ) + endif + + next iCurrentPath + +end function +' +'------------------------------------------------------------------------------- +' +function hFileOpenLocally( byVal sSourcePath as string ) as boolean + + ' Issue #i112208# - implement a function that copies a file from testautomation + ' into the local work directory and opens it from there to avoid that the + ' document gets opened in read-only mode. See details of the implementation + ' in the issue description. + + ' Parameters + ' 1) Path as string, URLs are untested. + ' 2) Separator, usually "getPathSeparator" + ' 3) Item number, 0 = last item which usually is the file name from a path. + ' Begin counting with 1, while the function internally accesses item 0 + ' from the array. + + const CFN = "global::tools::includes::required::t_files.inc:hFileOpenLocally(): " + + dim sTargetPath as string + + sSourcePath = convertpath( sSourcePath ) + + ' If the source file does not exist we quit + if ( not FileExists( sSourcePath ) ) then + warnlog( CFN & "Source path/file does not exist: " & sSourcePath ) + hFileOpenLocally() = false + exit function + endif + + ' Find out what the name of the target file is going to be + sTargetPath = hFileGetLocalPath( sSourcePath ) ' The path + file + + ' For debugging purposes set global variable gVerbose to TRUE + if ( gVerbose ) then + printlog( CFN & "Copying file" ) + printlog( CFN & "From: " & sSourcePath ) + printlog( CFN & "To..: " & sTargetPath ) + endif + + ' Copy the file from anywhere to the local user directory if it does not + ' exist. This behavior was discussed on IRC + if ( FileExists( sTargetPath ) ) then + printlog( CFN & "Re-using existing local copy of workfile" ) + 'warnlog( CFN & "Target file exists, it has not been deleted by prior test" ) + endif + + FileCopy( sSourcePath, sTargetPath ) + + ' Verify that the file has been created. return an empty string and warn + if ( not FileExists( sTargetPath ) ) then + warnlog( CFN & "File was not copied: " & sTargetFile ) + hFileOpenLocally() = false + gLastWorkFile = "" + exit function + endif + + ' This is a hook that allows to access the filename under which the file + ' has been saved. Due to restrictive coding guidelines we cannot return + ' the new filename. + gLastWorkFile = sTargetPath + + ' Finally open the file from the local work directory. It should open + ' ready for editing + hFileOpenLocally() = hFileOpen( gLastWorkFile ) + +end function +' +'------------------------------------------------------------------------------- +' function hFileCloseAll() as integer dim iDocumentCount as integer : iDocumentCount = 0 diff --git a/testautomation/global/tools/includes/required/t_filters.inc b/testautomation/global/tools/includes/required/t_filters.inc index 243483be9e7d..c0a23d56d092 100755..100644 --- a/testautomation/global/tools/includes/required/t_filters.inc +++ b/testautomation/global/tools/includes/required/t_filters.inc @@ -25,7 +25,7 @@ ' '/****************************************************************************** '* -'* owner : joerg.skottke@oracle.com +'* owner : gregor.hartmann@oracle.com '* '* short description : Retrieve and set filternames and suffixes '* diff --git a/testautomation/global/tools/includes/required/t_lists.inc b/testautomation/global/tools/includes/required/t_lists.inc index 9fa2172fbccf..9fa2172fbccf 100755..100644 --- a/testautomation/global/tools/includes/required/t_lists.inc +++ b/testautomation/global/tools/includes/required/t_lists.inc diff --git a/testautomation/global/tools/includes/required/t_menu.inc b/testautomation/global/tools/includes/required/t_menu.inc index 830012cc7dae..b03062b39471 100755..100644 --- a/testautomation/global/tools/includes/required/t_menu.inc +++ b/testautomation/global/tools/includes/required/t_menu.inc @@ -270,6 +270,12 @@ function hMenuFindSelect(MenuID as variant, SelectSlot as Boolean, ExpectedNr as warnlog "The real Position (Separators included) was: " + i endif i = RealEnd + else + if ( i = ExpectedNr ) then + if nID = "" then + warnlog "#i115132#Missing .uno Slots in context menus" + endif + endif endif next i else diff --git a/testautomation/global/tools/includes/required/t_option.inc b/testautomation/global/tools/includes/required/t_option.inc index 4f4467263072..4f4467263072 100755..100644 --- a/testautomation/global/tools/includes/required/t_option.inc +++ b/testautomation/global/tools/includes/required/t_option.inc diff --git a/testautomation/global/tools/includes/required/t_tools1.inc b/testautomation/global/tools/includes/required/t_tools1.inc index 051afec0ad24..837a989678be 100755..100644 --- a/testautomation/global/tools/includes/required/t_tools1.inc +++ b/testautomation/global/tools/includes/required/t_tools1.inc @@ -25,7 +25,7 @@ ' '/****************************************************************************** '* -'* owner : joerg.skottke@oracle.com +'* owner : gregor.hartmann@oracle.com '* '* short description : Tools (1) '* diff --git a/testautomation/global/tools/includes/required/t_tools2.inc b/testautomation/global/tools/includes/required/t_tools2.inc index e4f3bd9842e9..b82b93edba1f 100644 --- a/testautomation/global/tools/includes/required/t_tools2.inc +++ b/testautomation/global/tools/includes/required/t_tools2.inc @@ -226,32 +226,6 @@ end function '------------------------------------------------------------------------- -function GetBuildNumHidLst as String -'/// Get the "BuildId" out of the <i>hid.lst</i>. - Dim FileNum as Integer - Dim xmlZeile as String - dim iIndex as integer - dim sTemp as string - - if Dir (gtHidLstPath + "hid.lst") <> "" then - FileNum = FreeFile - Open (gtHidLstPath + "hid.lst") For Input As #FileNum - do until EOF(#FileNum) = True - line input #FileNum, xmlZeile - iIndex = inStr (1, xmlZeile, "010101010101010", 1) - sTemp = Left (xmlZeile, abs(iIndex - 1)) - ' usually only the first line is read - if (sTemp <> "") then exit do - loop - Close #FileNum - GetBuildNumHidLst = sTemp - else - GetBuildNumHidLst = "" - end if -end function - -'------------------------------------------------------------------------- - function hGetUNOService(optional bSilent as boolean, optional byRef sUnoPortExternal as string) as object '/// Function enables the UNO communication inside the '///+ TestTool to the office application. diff --git a/testautomation/global/tools/includes/required/t_tools3.inc b/testautomation/global/tools/includes/required/t_tools3.inc index 4b29928a1b93..4b29928a1b93 100755..100644 --- a/testautomation/global/tools/includes/required/t_tools3.inc +++ b/testautomation/global/tools/includes/required/t_tools3.inc |