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 2000, 2010 Oracle and/or its affiliates.
7 ' OpenOffice.org - a multi-platform office productivity suite
9 ' This file is part of OpenOffice.org.
11 ' OpenOffice.org is free software: you can redistribute it and/or modify
12 ' it under the terms of the GNU Lesser General Public License version 3
13 ' only, as published by the Free Software Foundation.
15 ' OpenOffice.org is distributed in the hope that it will be useful,
16 ' but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ' GNU Lesser General Public License version 3 for more details
19 ' (a copy is included in the LICENSE file that accompanied this code).
21 ' You should have received a copy of the GNU Lesser General Public License
22 ' version 3 along with OpenOffice.org. If not, see
23 ' <http://www.openoffice.org/license.html>
24 ' for a copy of the LGPLv3 License.
26 '/************************************************************************
28 '* owner : gregor.hartmann@oracle.com
30 '* short description : BASIC organizers and documents
32 '\******************************************************************************
34 private const IDOCS = 5
36 testcase tBasicDocuments
38 const CFN = "tBasicDocuments::"
40 dim sFileWriter as string
41 dim sFileCalc as string
42 dim iDocumentCount as integer
43 dim cNodeListA( 10 ) as string
44 dim cNodeListB( 10 ) as string
45 dim iSecLevel as integer
46 dim iHitCount as integer
48 ' NOTE: hCreateBasicWorkFiles() creates files of the naming scheme
49 ' basic.odt, ...odc etc. All these files will show up with just "basic"
50 ' in the Macro Organizer
51 const DOC_NAME = "basic"
53 printlog( "Set macro security level to medium" )
54 iSecLevel = hSetMacroSecurityAPI( GC_MACRO_SECURITY_LEVEL_MEDIUM )
56 printlog( "Open one single unchanged Writer document" )
59 kontext "DocumentWriter"
60 DocumentWriter.typeKeys( "tBasicDocuments - initial document - discard after test" )
62 gApplication = "WRITER"
63 printlog( "Create a Writer workfilename (build path and filename)" )
64 hCreateBasicWorkFiles()
65 sFileWriter = hGetBasicWorkFile( "current" )
68 printlog( "Create a Calc workfilename (build path and filename)" )
69 hCreateBasicWorkFiles()
70 sFileCalc = hGetBasicWorkFile( "current" )
72 printlog( "Open the writer file" )
73 hFileOpen( sFileWriter )
74 if ( not hAllowMacroExecution() ) then
75 warnlog( "Missing Macro execution dialog. Please check the file/security settings" )
78 printlog( "Open the Calc file" )
79 hFileOpen( sFileCalc )
80 if ( not hAllowMacroExecution() ) then
81 warnlog( "Missing Macro execution dialog. Please check the file/security settings" )
84 printlog( "Open the BASIC organizer" )
88 printlog( "Retreive the names of all nodes from the treelist" )
90 hGetVisibleNodeNames( MakroAus , cNodeListA() )
92 printlog( "Verify that both documents are listed - one Writer, one Calc with identical names" )
93 iHitCount = hCountMatchesInList( cNodeListA() , DOC_NAME )
94 if ( iHitCount <> 2 ) then
95 warnlog( "There should be two documents with the name " & DOC_NAME & "listed." )
98 printlog( "Click Manage..." )
99 hClickButton( verwalten )
101 printlog( "Get the nodes list from the object organizer tabs - first tab" )
102 hSelectBasicObjectOrganizerTab( 1 )
103 ListAllDelete( cNodeListB() )
104 hGetVisibleNodeNames( ModulListe , cNodeListB() )
106 printlog( "Verify that both documents are listed on both relevant tabpages" )
107 iHitCount = hCountMatchesInList( cNodeListA() , DOC_NAME )
108 if ( iHitCount <> 2 ) then
109 warnlog( "There should be two documents with the name " & DOC_NAME & "listed." )
112 printlog( "Switch to second tab" )
113 hSelectBasicObjectOrganizerTab( 2 )
114 ListAllDelete( cNodeListB() )
115 hGetVisibleNodeNames( ModuleList , cNodeListB() )
116 if ( listcount( cNodeListB() ) <> 5 ) then
117 warnlog( CFN & "#i49239# Incorrect object count in treelist" )
118 hListPrint( cNodeListB() , "List of objects found in treelist" )
122 iHitCount = hCountMatchesInList( cNodeListB() , DOC_NAME )
123 if ( iHitCount <> 2 ) then
124 warnlog( "There should be two documents with the name " & DOC_NAME & "listed." )
127 printlog( "Third tab (should not list the document" )
128 hSelectBasicObjectOrganizerTab( 3 )
129 hTestLibraryListBox( cNodeListA() )
131 printlog( CFN & "Closing dialogs..." )
132 hCloseDialog( TabBibliotheken, "cancel" )
134 printlog( "Cleanup: Close macro organizer" )
136 hCloseDialog( Makro, "cancel" )
138 printlog( "Cleanup: Close all files" )
141 printlog( "Cleanup: Remove workfiles" )
142 hDeleteFile( sFileWriter )
143 hDeleteFile( sFileCalc )
145 printlog( "Rest macro security level" )
146 hSetMacroSecurityAPI( GC_MACRO_SECURITY_LEVEL_DEFAULT )
150 '*******************************************************************************
152 function hTestLibraryListBox( cNodeList() ) as boolean
154 const CFN = "hTestLibraryListBox::"
155 const EXACT_MATCH = 1
157 dim iEntry as integer
161 hTestLibraryListBox() = true
163 if ( bibliothek.getItemCount() <> IDOCS ) then
164 warnlog( CFN & "Incorrect number of items in listbox" )
165 printlog( CFN & "Expected: " & bibliothek.getItemCount() )
166 printlog( CFN & "Found...: " & listcount( cNodeList() ) )
167 hTestLibraryListBox() = false
170 for iEntry = 3 to IDOCS
172 Bibliothek.select( iEntry )
173 cEntry = Bibliothek.getSelText()
175 if ( hCompareSubStrings( cNodeList( iEntry ) , cEntry ) <> EXACT_MATCH ) then
176 warnlog( CFN & "Comparision failed" )
177 printlog( CFN & "Expected: " & cNodeList( iEntry ) & "<>" & cEntry )
178 hTestLibraryListBox() = false
180 printlog( CFN & "Comparision succeeded:" & cEntry )