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: basic_documents.inc,v $
13 '* last change: $Author: jsi $ $Date: 2008-06-16 12:18:13 $
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 : BASIC organizers and documents
38 '\******************************************************************************
40 private const IDOCS = 5
42 testcase tBasicDocuments
44 qaerrorlog( "#i90435# Untitled documents unnumbered in BASIC organizer" )
47 const CFN = "tBasicDocuments::"
49 '///<H1>Documents in BASIC organizers</H1>
50 '///<i>Compare the names of the documents listed in various treelists
51 '///+ in Basic Organizer and Basic Object Organizer (Manage...)</i>
55 dim sFileWriter as string
56 dim sFileCalc as string
57 dim iDocumentCount as integer
58 dim cNodeListA( 10 ) as string
59 dim cNodeListB( 10 ) as string
60 dim iSecLevel as integer
61 dim iHitCount as integer
63 ' NOTE: hCreateBasicWorkFiles() creates files of the naming scheme
64 ' basic.odt, ...odc etc. All these files will show up with just "basic"
65 ' in the Macro Organizer
66 const DOC_NAME = "basic"
68 '///+<li>Set the Macro Security Level to "Medium"</li>
70 iSecLevel = hSetMacroSecurityAPI( GC_MACRO_SECURITY_LEVEL_MEDIUM )
72 '///+<li>Create one initial document</li>
75 '///+<li>Write identifier string to the document</li>
76 kontext "DocumentWriter"
77 DocumentWriter.typeKeys( "tBasicDocuments - initial document - discard after test" )
79 '///+<li>Create a writer document containing a macro, name it basic.odt</li>
80 gApplication = "WRITER"
82 brc = hCreateBasicWorkFiles()
83 sFileWriter = hGetBasicWorkFile( "current" )
85 '///+<li>Create a calc document containing a macro, name it basic.ods</li>
88 brc = hCreateBasicWorkFiles()
89 sFileCalc = hGetBasicWorkFile( "current" )
91 '///+<li>Reload the files we just created</li>
93 brc = hFileOpen( sFileWriter )
94 brc = hAllowMacroExecution()
96 warnlog( "Missing Macro execution dialog. Please check the file/security settings" )
98 brc = hFileOpen( sFileCalc )
99 brc = hAllowMacroExecution()
101 warnlog( "Missing Macro execution dialog. Please check the file/security settings" )
104 '///+<li>Go to Tools/Macro->Basic Macros</li>
106 brc = hOpenBasicOrganizerFromDoc()
108 '///+<li>Verify that the treelist contains five items</li>
109 hGetVisibleNodeNames( MakroAus , cNodeListA() )
111 '///+<li>Verify the names of the docs: Untitled, basic(odt), basic(ods)</li>
113 iHitCount = hCountMatchesInList( cNodeListA() , DOC_NAME )
114 if ( iHitCount <> 2 ) then
115 warnlog( "There should be two documents with the name " & DOC_NAME & "listed." )
118 '///+<li>Click the <Manage...> button</li>
121 '///+<li>Switch to the modules-Tab (should be open by default)</li>
123 brc = hSelectBasicObjectOrganizerTab( 1 )
124 ListAllDelete( cNodeListB() )
125 hGetVisibleNodeNames( ModulListe , cNodeListB() )
127 '///+<li>Verify that we have two files with the same name in the list</li>
129 iHitCount = hCountMatchesInList( cNodeListA() , DOC_NAME )
130 if ( iHitCount <> 2 ) then
131 warnlog( "There should be two documents with the name " & DOC_NAME & "listed." )
134 '///+<li>Switch to the Dialogs-Tab (the second one)</li>
135 '///+<li>Verify that the treelist contains five items</li>
137 brc = hSelectBasicObjectOrganizerTab( 2 )
138 ListAllDelete( cNodeListB() )
139 hGetVisibleNodeNames( ModuleList , cNodeListB() )
140 if ( listcount( cNodeListB() ) <> 5 ) then
141 warnlog( CFN & "#i49239# Incorrect object count in treelist" )
142 hListPrint( cNodeListB() , "List of objects found in treelist" )
145 '///+<li>Verify that we have two files with the same name in the list</li>
147 iHitCount = hCountMatchesInList( cNodeListB() , DOC_NAME )
148 if ( iHitCount <> 2 ) then
149 warnlog( "There should be two documents with the name " & DOC_NAME & "listed." )
152 '///+<li>Switch to Libraries Tab and look at the entries in the listbox</li>
153 '///+<li>Verify that we have two files with the same name in the list</li>
155 brc = hSelectBasicObjectOrganizerTab( 3 )
156 brc = hTestLibraryListBox( cNodeListA() )
158 '///+<li>Close the Basic Object Organizer</li>
160 printlog( CFN & "Closing dialogs..." )
161 TabBibliotheken.cancel()
163 '///+<li>Close the Macro Organizer</li>
167 '///+<li>Close the two documents we worked with</li>
168 brc = hDestroyDocument()
169 brc = hDestroyDocument()
171 '///+<li>Delete the two workfiles</li>
172 brc = hDeleteFile( sFileWriter )
173 brc = hDeleteFile( sFileCalc )
175 '///+<li>Reset the Macro security level</li>
176 hSetMacroSecurityAPI( GC_MACRO_SECURITY_LEVEL_DEFAULT )
178 '///+<li>Close the initial document</li>
185 '*******************************************************************************
187 function hTestLibraryListBox( cNodeList() ) as boolean
189 const CFN = "hTestLibraryListBox::"
191 '///<h3>Compare library-Listbox with Macro-Organizer listbox</h3>
192 '///<i>Part of: tBasicDocuments</i><br>
195 '///+<li>List of items found in Basic Macro Organizer Treelist (MakroAus)</li>
199 '///+<li>Errorstatus (boolean)</li>
201 '///+<li>TRUE if all items are identical</li>
202 '///+<li>FALSE on any other error</li>
205 '///<u>Description</u>:
209 dim iEntry as integer
216 '///+<li>Check that the number of objects is ok</li>
217 if ( bibliothek.getItemCount() <> IDOCS ) then
218 warnlog( CFN & "Incorrect number of items in listbox" )
219 printlog( CFN & "Expected: " & bibliothek.getItemCount() )
220 printlog( CFN & "Found...: " & listcount( cNodeList() ) )
224 '///+<li>Compare objects 3 -5 (1+2 always differ)</li>
225 for iEntry = 3 to IDOCS
227 Bibliothek.select( iEntry )
228 cEntry = Bibliothek.getSelText()
230 irc = hCompareSubStrings( cNodeList( iEntry ) , cEntry )
232 warnlog( CFN & "Comparision failed" )
233 printlog( CFN & "Expected: " & cNodeList( iEntry ) & "<>" & cEntry )
236 printlog( CFN & "Comparision succeeded:" & cEntry )