summaryrefslogtreecommitdiff
path: root/testautomation/framework/required/includes/script_organizers.inc
diff options
context:
space:
mode:
Diffstat (limited to 'testautomation/framework/required/includes/script_organizers.inc')
-rwxr-xr-xtestautomation/framework/required/includes/script_organizers.inc207
1 files changed, 137 insertions, 70 deletions
diff --git a/testautomation/framework/required/includes/script_organizers.inc b/testautomation/framework/required/includes/script_organizers.inc
index 6082a3313ce0..b9ed8420134e 100755
--- a/testautomation/framework/required/includes/script_organizers.inc
+++ b/testautomation/framework/required/includes/script_organizers.inc
@@ -31,80 +31,118 @@
'*
'\******************************************************************************
-testcase tUpdtScriptCount
- dim sDialog as string
+testcase tUpdtScripts
printlog( "Resource test for macros and scripts / related dialogs" )
- const SCRIPTING_DIALOGS = 5
+ if ( gIsoLang <> "en-US" ) then
+ printlog( "No testing for languages other than en_US" )
+ goto endsub
+ endif
- dim aScriptCount( SCRIPTING_DIALOGS )
+ const SCRIPTING_DIALOGS = 5
- aScriptCount( 1 ) = 10 ' JavaScript
- aScriptCount( 2 ) = 14 ' BeanShell
-
- if ( lcase( gPlatform ) = "osx" ) then
- aScriptCount( 3 ) = 8 ' Python
- aScriptCount( 5 ) = 600 ' Run Macro
- else
- aScriptCount( 3 ) = 10 ' Python
- aScriptCount( 5 ) = 602 ' Run Macro
- endif
+ const DLG_JAVASCRIPT = "JavaScript"
+ const DLG_BEANSHELL = "BeanShell"
+ const DLG_PYTHON = "Python"
+ const DLG_BASIC_ORG = "BasicOrganizer"
+ const DLG_RUN_MACRO = "RunMacro"
- if ( gOOo ) then
- aScriptCount( 4 ) = 585 ' Makro Organizer
- aScriptCount( 5 ) = aScriptCount( 5 ) - 1 ' Run Macro
- else
- ' Makro Organizer
- aScriptCount( 4 ) = 586
- endif
+ ' This is the build specific part of the filename including substrings for
+ ' the productname and language.
+ dim sProductString as string : sProductString = gProductName & "_" & gISOLang & "_"
+
+ ' define platforms that have different scriptcount
+ if ( lcase( gPlatGroup ) = "w95" ) then sProductString = sProductString & "win_"
+ if ( lcase( gPlatform ) = "osx" ) then sProductString = sProductString & "osx_"
+
+ ' replace all blanks
+ sProductString = hStringReplaceChar( sProductString, " ", "-" )
+
+ ' This is where reference file is located, the filename is yet incomplete
+ dim sInputPath as string
+ sInputPath = gTesttoolPath & "framework/required/input/scripts/" & sProductString
+
+ ' This is where we store the reference file if differences are found.
+ dim sOutputPath as string
+ sOutputPath = gOfficePath & "user/work/" & sProductString
+
+ ' These contain the input and output paths (fully qualified)
+ dim sFileIn as string
+ dim sFileOut as string
+
+ ' Array that contains the scriptnames for all organizers
+ dim cScriptNamesList( 1000 ) as string
+ dim sDialog as string
dim iCurrentDialog as integer
- dim iCurrentScriptCount as integer
-
+
+ dim iDiffCount as integer
+
hInitSingleDoc()
for iCurrentDialog = 1 to SCRIPTING_DIALOGS
- printlog( "" )
- select case iCurrentDialog
- case 1: sDialog = "JavaScript"
- ToolsMacrosOrganizeMacrosJavaScript
- kontext "ScriptOrganizer"
- iCurrentScriptCount = hExpandAllNodes( ScriptTreeList )
- ScriptOrganizer.cancel()
- case 2: sDialog = "BeanShell"
- ToolsMacrosOrganizeMacrosBeanShell
- kontext "ScriptOrganizer"
- iCurrentScriptCount = hExpandAllNodes( ScriptTreeList )
- ScriptOrganizer.cancel()
- case 3: sDialog = "Python"
- ToolsMacrosOrganizeMacrosPython
- kontext "ScriptOrganizer"
- iCurrentScriptCount = hExpandAllNodes( ScriptTreeList )
- ScriptOrganizer.cancel()
- case 4: sDialog = "Makro Organizer"
- ToolsMacro_uno
- Kontext "Makro"
- hExpandAllNodes( MakroAus )
- iCurrentScriptCount = hGetScriptCount( MakroAus, MakroListe )
- Makro.close()
- case 5: sDialog = "Run Macro"
- ToolsMacrosRunMacro
- kontext "ScriptSelector"
- hExpandAllNodes( LibraryTreeList )
- iCurrentScriptCount = hGetScriptCount( LibraryTreeList, ScriptList )
- ScriptSelector.cancel()
+ ListAllDelete( cScriptNamesList() )
+
+ ' Build complete filename and identify dialog for logging and case selection
+ select case ( iCurrentDialog )
+ case 1 : sDialog = DLG_JAVASCRIPT
+ case 2 : sDialog = DLG_BEANSHELL
+ case 3 : sDialog = DLG_PYTHON
+ case 4 : sDialog = DLG_BASIC_ORG
+ case 5 : sDialog = DLG_RUN_MACRO
end select
- printlog( sDialog )
-
- if ( aScriptCount( iCurrentDialog ) <> iCurrentScriptCount ) then
- warnlog( "Incorrect number of scripts for this dialog: '" + sDialog + "' expected:" + aScriptCount( iCurrentDialog ) + ", but is:" & iCurrentScriptCount )
- else
- printlog( "Number of scripts is ok" )
- endif
+ printlog( "" )
+ sFileIn = convertpath( sInputPath & sDialog & ".txt" )
+ sFileOut = convertpath( sOutputPath & sDialog & ".txt" )
+
+ printlog( "Open <" & sDialog & "> and access the treelist object" )
+
+ ' Note: hGetAllNodeNames() is a *global* function defined in t_treelist_tools.inc
+ ' DLG_BASIC_ORG and DLG_RUN_MACRO have - in addition to the treelist -
+ ' a separate script list. To get those scripts a little more effort is
+ ' required which is done in the *local* function hGetScriptNames()
+
+ select case ( sDialog )
+ case DLG_JAVASCRIPT: ToolsMacrosOrganizeMacrosJavaScript
+ kontext "ScriptOrganizer"
+ hGetAllNodeNames( ScriptTreeList, cScriptNamesList() )
+ case DLG_BEANSHELL: ToolsMacrosOrganizeMacrosBeanShell
+ kontext "ScriptOrganizer"
+ hGetAllNodeNames( ScriptTreeList, cScriptNamesList() )
+ case DLG_PYTHON: ToolsMacrosOrganizeMacrosPython
+ kontext "ScriptOrganizer"
+ hGetAllNodeNames( ScriptTreeList, cScriptNamesList() )
+ case DLG_BASIC_ORG: ToolsMacro_uno
+ Kontext "Makro"
+ hGetScriptNames( MakroAus, MakroListe, cScriptNamesList() )
+ case DLG_RUN_MACRO: ToolsMacrosRunMacro
+ kontext "ScriptSelector"
+ hGetScriptNames( LibraryTreeList, ScriptList, cScriptNamesList() )
+ end select
+ printlog( "Compare to reference list, create new one if differences were found" )
+ iDiffCount = hManageComparisionList( sFileIn, sFileOut, cScriptNamesList() )
+
+ if ( iDiffCount <> 0 ) then warnlog( "The number of scripts has changed, please review." )
+
+
+ printlog( "Close <" & sDialog & ">" )
+ select case ( sDialog )
+ case DLG_JAVASCRIPT :
+ ScriptOrganizer.cancel()
+ case DLG_BEANSHELL :
+ ScriptOrganizer.cancel()
+ case DLG_PYTHON :
+ ScriptOrganizer.cancel()
+ case DLG_BASIC_ORG :
+ Makro.close()
+ case DLG_RUN_MACRO :
+ ScriptSelector.cancel()
+ end select
+
next iCurrentDialog
hCloseDocument()
@@ -113,15 +151,44 @@ endcase
'*******************************************************************************
-function hGetScriptCount( oTree as object, oList as object ) as integer
+sub hGetScriptNames( oTreeList as object, oScriptList as object, cItemList() as string )
- dim iCurrentTreeItem as integer
- dim iScriptCount as integer : iScriptCount = 0
-
- for iCurrentTreeItem = 1 to oTree.getItemCount()
- oTree.select( iCurrentTreeItem )
- iScriptCount = iScriptCount + oList.getItemCount()
- next iCurrentTreeItem
- hGetScriptCount() = iScriptCount
-
-end function
+ ' oTreeList is the treelist object (left pane)
+ ' oScriptList is the script list (right pane)
+ ' cScriptList() is filled with the scriptnames of the form
+ ' <module>:<script name> like "CommonLang:LoadLanguages"
+
+ dim iCurrentTreeListItem as integer
+ dim iObjectsInTreelist as integer
+
+ dim cModuleName as string
+ dim cReferenceString as string
+
+ dim iScriptCount as integer
+ dim iCurrentScript as integer
+ dim cScriptList( 1000 ) as string
+
+ ' Get the number of nodes from the modules treelist
+ iObjectsInTreeList = hExpandAllNodes( oTreeList )
+
+ ' For each item in the modules treelist get the number of scripts (right pane)
+ for iCurrentTreeListItem = 1 to iObjectsInTreeList
+
+ ' Get the name of the current treelist node, append it to the list
+ ' (otherwise it does not appear if it has no scripts)
+ cModuleName = hGetNodeName( oTreeList, iCurrentTreeListItem )
+ hListAppend( cModuleName, cItemList() )
+
+ ' Get the number of scripts from the right pane, reset the array in advance
+ ListAllDelete( cScriptList() )
+ iScriptCount = hGetListItems( oScriptList, cScriptList() )
+
+ ' Build the string for the reference list and append it to cScriptList()
+ for iCurrentScript = 1 to iScriptCount
+ cReferenceString = cModuleName & ":" & cScriptList( iCurrentScript )
+ hListAppend( cReferenceString, cItemList() )
+ next iCurrentScript
+
+ next iCurrentTreeListItem
+
+end sub \ No newline at end of file