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 2008 by Sun Microsystems, Inc.
7 '* OpenOffice.org - a multi-platform office productivity suite
9 '* $RCSfile: script_organizers.inc,v $
13 '* last change: $Author: rt $ $Date: 2008-09-04 09:16:12 $
15 '* This file is part of OpenOffice.org.
17 '* OpenOffice.org is free software: you can redistribute it and/or modify
18 '* it under the terms of the GNU Lesser General Public License version 3
19 '* only, as published by the Free Software Foundation.
21 '* OpenOffice.org is distributed in the hope that it will be useful,
22 '* but WITHOUT ANY WARRANTY; without even the implied warranty of
23 '* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 '* GNU Lesser General Public License version 3 for more details
25 '* (a copy is included in the LICENSE file that accompanied this code).
27 '* You should have received a copy of the GNU Lesser General Public License
28 '* version 3 along with OpenOffice.org. If not, see
29 '* <http://www.openoffice.org/license.html>
30 '* for a copy of the LGPLv3 License.
32 '/******************************************************************************
34 '* owner : Joerg.Skottke@Sun.Com
36 '* short description : Verify names of macros and scripts
38 '\******************************************************************************
40 testcase tUpdtScriptCount
42 const SCRIPTING_DIALOGS = 5
43 dim aScriptCount( SCRIPTING_DIALOGS )
44 aScriptCount( 1 ) = 10
45 aScriptCount( 2 ) = 14
46 aScriptCount( 3 ) = 10
47 aScriptCount( 4 ) = 585
48 aScriptCount( 5 ) = 601
50 dim iCurrentDialog as integer
51 dim iCurrentScriptCount as integer
55 do while ( getDocumentCount > 0 )
61 for iCurrentDialog = 1 to SCRIPTING_DIALOGS
64 select case iCurrentDialog
65 case 1: printlog( "JavaScript" )
66 ToolsMacrosOrganizeMacrosJavaScript
67 kontext "ScriptOrganizer"
68 iCurrentScriptCount = hExpandAllNodes( ScriptTreeList )
69 ScriptOrganizer.cancel()
70 case 2: printlog( "BeanShell" )
71 ToolsMacrosOrganizeMacrosBeanShell
72 kontext "ScriptOrganizer"
73 iCurrentScriptCount = hExpandAllNodes( ScriptTreeList )
74 ScriptOrganizer.cancel()
75 case 3: printlog( "Python" )
76 ToolsMacrosOrganizeMacrosPython
77 kontext "ScriptOrganizer"
78 iCurrentScriptCount = hExpandAllNodes( ScriptTreeList )
79 ScriptOrganizer.cancel()
80 case 4: printlog( "Makro Organizer" )
83 hExpandAllNodes( MakroAus )
84 iCurrentScriptCount = hGetScriptCount( MakroAus, MakroListe )
86 case 5: printlog( "Run Macro" )
88 kontext "ScriptSelector"
89 hExpandAllNodes( LibraryTreeList )
90 iCurrentScriptCount = hGetScriptCount( LibraryTreeList, ScriptList )
91 ScriptSelector.cancel()
94 if ( aScriptCount( iCurrentDialog ) <> iCurrentScriptCount ) then
95 warnlog( "Incorrect number of scripts for this dialog: " & iCurrentScriptCount )
97 printlog( "Number of scripts is ok" )
108 '*******************************************************************************
110 function hGetScriptCount( oTree as object, oList as object ) as integer
112 dim iTreeItem as integer
113 dim iScript as integer : iScript = 0
115 for iTreeItem = 1 to oTree.getItemCount()
116 oTree.select( iTreeItem )
117 iScript = iScript + oList.getItemCount()
119 hGetScriptCount() = iScript