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 : Export BASIC libraries as package
32 '\******************************************************************************
34 testcase tBasicPackageExport
36 ' Assumption: All actions take place in the user/work directory
37 printlog( "Export BASIC libraries as package/extension" )
39 const PACKAGE_NAME = "tBasicExport.oxt"
40 const LIBRARY_NAME = "tBasicExport"
41 const DOCUMENT_POSITION = 4
42 const PACKAGE_SIZE = 1325
44 const LIBRARIES_TAB = 3
48 dim cDocumentName as string
49 dim cLibraryName as string
51 dim iNodeCount as integer
52 dim iCurrentLib as integer
54 dim cFile as string : cFile = hGetWorkPath() & PACKAGE_NAME
55 dim cPackageFileName as string
58 printlog( "Delete potential leftovers from prior test run" )
60 hExtensionRemoveGUI( PACKAGE_NAME )
62 printlog( "Open one single writer document, modify it" )
66 printlog( "Open another document, we want to have two to see that they both " & _
67 "appear in the BASIC organizer" )
68 gApplication = "WRITER"
71 printlog( "Open BASIC organizer" )
74 printlog( "Select the second document" )
76 if ( Makro.exists( SHORT_WAIT ) ) then
77 iNodeCount = hGetNodeCount( MakroAus )
78 cDocumentName = hSelectNode( MakroAus, iNodeCount )
80 printlog( "Click <Manage...>" )
83 printlog( "Go to the libraries tabpage" )
84 hSelectBasicObjectOrganizerTab( LIBRARIES_TAB )
86 kontext "TabBibliotheken"
87 printlog( "Select the document at pos. " & DOCUMENT_POSITION )
88 Bibliothek.select( DOCUMENT_POSITION )
90 printlog( "Verify that the correct document has been selected" )
91 if ( Bibliothek.getSelText() <> cDocumentName ) then
92 warnlog( "Incorrect document selected on libraries tab, aborting test" )
96 printlog( "Click <New...>" )
99 kontext "NeueBibliothek"
100 if ( NeueBibliothek.exists( SHORT_WAIT ) ) then
101 printlog( "Name the new library: " & LIBRARY_NAME )
102 BibliotheksName.setText( LIBRARY_NAME )
105 warnlog( "Dialog <NeueBibliothek> did not open" )
109 kontext "TabBibliotheken"
110 cLibraryName = BibliotheksListe.getSelText()
111 if ( cLibraryName <> LIBRARY_NAME ) then
112 warnlog( "The new library is not selected in the libraries list" )
114 printlog( "The correct library is selected in the libraries list" )
117 printlog( "Click <Edit...>" )
120 printlog( "Insert a test macro (something simple, e.g. a messagebox" )
121 hInsertMacroFromFile( LIBRARY_NAME )
123 printlog( "Close the BASIC IDE" )
126 warnlog( "Dialog <Makro> did not open, aborting test" )
130 printlog( "Open the BASIC organizer" )
133 printlog( "Select the work document" )
135 if ( Makro.exists( SHORT_WAIT ) ) then
136 iNodeCount = hGetNodeCount( MakroAus )
137 hSelectNode( MakroAus, iNodeCount )
139 printlog( "Manage..." )
142 printlog( "Libraries tab" )
143 hSelectBasicObjectOrganizerTab( LIBRARIES_TAB )
145 kontext "TabBibliotheken"
146 if ( TabBibliotheken.exists( SHORT_WAIT ) and TabBibliotheken.isVisible() ) then
147 Bibliothek.select( DOCUMENT_POSITION )
149 printlog( "Select the new library" )
150 kontext "TabBibliotheken"
151 for iCurrentLib = 1 to Bibliotheksliste.getItemCount()
152 Bibliotheksliste.select( iCurrentLib )
153 if ( Bibliotheksliste.getSelText() = LIBRARY_NAME ) then
158 kontext "TabBibliotheken"
159 printlog( "Export the package, close the document afterwards" )
162 kontext "ExportBasicLibraryDlg"
163 if ( ExportBasicLibraryDlg.exists( LONG_WAIT ) ) then
164 printlog( "Select to export as extension" )
165 ExportAsPackage.check()
166 hCloseDialog( ExportBasicLibraryDlg, "ok" )
168 kontext "SpeichernDlg"
169 if ( SpeichernDlg.exists( LONG_WAIT ) ) then
170 printlog( "Save the file, suffix will be added automatically." )
171 DateiName.setText( hGetWorkPath() & LIBRARY_NAME )
173 Speichern.notExists( SHORT_WAIT )
175 warnlog( "Dialog <File Save> did not open" )
178 warnlog( "Dialog <Export Basic Library> did not open" )
181 kontext "TabBibliotheken"
182 printlog( "Close libraires tabpage" )
183 hCloseDialog( TabBibliotheken, "cancel" )
185 warnlog( "Dialog <TabBibliotheken> is not available" )
189 printlog( "Close BASIC organizer" )
190 hCloseDialog( Makro, "cancel" )
192 warnlog( "Dialog <Makro> did not open" )
195 printlog( "Close all files" )
198 printlog( "Verify automatic filename extension (dialog should append .oxt)" )
199 printlog( "Checking for file: " & cFile )
200 if ( FileExists( cFile ) ) then
201 printlog( "The test-package was saved with .oxt extension, good." )
202 cPackageFileName = cFile
204 if ( FileExists( hGetWorkPath() & LIBRARY_NAME ) ) then
205 warnlog( "The test-package was saved without .oxt filename extension" )
206 cPackageFileName = hGetWorkPath() & LIBRARY_NAME
208 warnlog( "The test extension was not saved to the users workdirectory" )
213 printlog( "Verify file size" )
214 if ( FileLen( cPackageFileName ) <> PACKAGE_SIZE ) then
215 warnlog( "#i105719# - The exported test-package has an incorrect file size." )
217 printlog( "File has correct size." )