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 library (flat)
32 '\******************************************************************************
34 testcase tBasicLibraryExport
36 printlog( "Export a basic script as library (flat format)" )
38 ' Assumption: All actions take place in the user/work directory
39 ' macro taken from framework/tools/input/macros.txt::tBasicLibraryExport
41 ' For test specific global constants (UPPERCASE) see .BAS-file
43 const LIBRARIES_TAB = 3
45 dim cDocumentName as string
46 dim cLibraryName as string
47 dim iNodeCount as integer
49 dim cFile as string : cFile = hGetWorkPath() & LIBRARY_NAME
53 dim iCurrentLib as integer
55 printlog( "Delete potential leftovers from prior test run" )
56 if ( dir( cFile ) <> "" ) then
57 QAErrorLog( "Files from prior test run exist: " & cFile )
58 hDeleteFile( hGetWorkPath() & LIBRARY_NAME & gPathSigne & "dialog.xlb" )
59 hDeleteFile( hGetWorkPath() & LIBRARY_NAME & gPathSigne & "Module1.xba" )
60 hDeleteFile( hGetWorkPath() & LIBRARY_NAME & gPathSigne & "script.xlb" )
61 rmdir( hGetWorkPath() & LIBRARY_NAME ) : printlog( "Remove directory" )
64 printlog( "Open a new text document" )
68 printlog( "Open another text document" )
69 gApplication = "WRITER"
72 printlog( "Open the BASIC organizer (Tools/Macros/BASIC)" )
76 printlog( "Select the document" )
77 iNodeCount = hGetNodeCount( MakroAus )
78 cDocumentName = hSelectNode( MakroAus, iNodeCount )
80 printlog( "Click <Manage...>" )
83 printlog( "Open the Libraries tabpage" )
84 hSelectBasicObjectOrganizerTab( 3 )
86 kontext "TabBibliotheken"
87 printlog( "Select document Untitled2" )
88 Bibliothek.select( DOCUMENT_POSITION )
90 ' verify that the correct document is selected
91 if ( Bibliothek.getSelText() <> cDocumentName ) then
92 warnlog( "Incorrect document selected on libraries tab, aborting" )
96 printlog( "Click <New>" )
99 kontext "NeueBibliothek"
100 printlog( "Name the library: " & LIBRARY_NAME )
101 BibliotheksName.setText( LIBRARY_NAME )
104 kontext "TabBibliotheken"
105 printlog( "Verify that the new library is selected in the libraries list" )
106 cLibraryName = BibliotheksListe.getSelText()
108 printlog( "Click <Edit>" )
111 printlog( "Insert a macro" )
112 hInsertMacroFromFile( LIBRARY_NAME )
114 printlog( "Close the BASIC IDE" )
117 printlog( "Open the BASIC macro organizer" )
121 printlog( "Select the work document" )
122 iNodeCount = hGetNodeCount( MakroAus )
123 hSelectNode( MakroAus, iNodeCount )
125 printlog( "Click <Manage...>" )
128 printlog( "Go to the libraries-tab" )
129 hSelectBasicObjectOrganizerTab( LIBRARIES_TAB )
131 kontext "TabBibliotheken"
132 printlog( "Select the document at pos. " & DOCUMENT_POSITION )
133 Bibliothek.select( DOCUMENT_POSITION )
135 printlog( "Verify that the correct document is selected" )
136 if ( Bibliothek.getSelText() <> cDocumentName ) then
137 warnlog( "Incorrect document selected on libraries tab, aborting" )
141 printlog( "Select the new library" )
142 kontext "TabBibliotheken"
143 for iCurrentLib = 1 to Bibliotheksliste.getItemCount()
144 Bibliotheksliste.select( iCurrentLib )
145 if ( Bibliotheksliste.getSelText = LIBRARY_NAME ) then
150 printlog( "Click export" )
153 kontext "ExportBasicLibraryDlg"
154 if ( ExportBasicLibraryDlg.exists( 2 ) ) then
156 printlog( "Export as library" )
157 ExportAsLibrary.check()
158 ExportBasicLibraryDlg.ok()
161 printlog( "Check for non existing directory warning" )
162 ' Note: Querying for an Active will also find the Libraries tabpage.
163 ' So we need to check which active we've got. RT = 373 is the tabcontrol.
164 if ( Active.exists( 1 ) ) then
165 if ( Active.getRT() <> 373 ) then
166 warnlog( "Unexpected messagebox: " & Active.getText() )
169 printlog( "Back on tab-control, good." )
172 printlog( "No warning for non-existing directory, good." )
176 if ( Oeffnendlg.exists( 1 ) ) then
179 warnlog( "File Open dialog not displayed" )
183 warnlog( "The ""Export Library"" dialog was not displayed" )
186 kontext "TabBibliotheken"
187 printlog( "Close the macro/libraries organizer" )
188 if ( TabBibliotheken.exists( 1 ) ) then
189 TabBibliotheken.cancel()
192 printlog( "Cancel macro organizer" )
197 warnlog( "Dialog <TabBibliotheken> could not be accessed" )
198 call exitRestartTheOffice()