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_library_export.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 : Export BASIC library (flat)
38 '\******************************************************************************
40 testcase tBasicLibraryExport
42 printlog( "Export a basic script as library (flat format)" )
44 ' Assumption: All actions take place in the user/work directory
45 ' macro taken from framework/tools/input/macros.txt::tBasicLibraryExport
47 ' For constants (UPPERCASE) see .BAS-file
49 dim cDocumentName as string
50 dim cLibraryName as string
51 dim iNodeCount as integer
53 dim cFile as string : cFile = hGetWorkPath() & LIBRARY_NAME
57 dim iCurrentLib as integer
59 if ( dir( cFile ) <> "" ) then
60 QAErrorLog( "Files from prior test run exist: " & cFile )
61 hDeleteFile( hGetWorkPath() & LIBRARY_NAME & gPathSigne & "dialog.xlb" )
62 hDeleteFile( hGetWorkPath() & LIBRARY_NAME & gPathSigne & "Module1.xba" )
63 hDeleteFile( hGetWorkPath() & LIBRARY_NAME & gPathSigne & "script.xlb" )
64 rmdir( hGetWorkPath() & LIBRARY_NAME ) : printlog( "Remove directory" )
70 gApplication = "WRITER"
76 iNodeCount = hGetNodeCount( MakroAus )
77 cDocumentName = hSelectNode( MakroAus, iNodeCount )
81 hSelectBasicObjectOrganizerTab( 3 )
83 printlog( "Select document Untitled2" )
84 kontext "TabBibliotheken"
85 Bibliothek.select( DOCUMENT_POSITION )
87 ' verify that the correct document is selected
88 if ( Bibliothek.getSelText() <> cDocumentName ) then
89 warnlog( "Incorrect document selected on libraries tab, aborting" )
95 kontext "NeueBibliothek"
96 BibliotheksName.setText( LIBRARY_NAME )
99 kontext "TabBibliotheken"
100 cLibraryName = BibliotheksListe.getSelText()
104 hInsertMacroFromFile( LIBRARY_NAME )
111 iNodeCount = hGetNodeCount( MakroAus )
112 hSelectNode( MakroAus, iNodeCount )
116 hSelectBasicObjectOrganizerTab( 3 )
118 kontext "TabBibliotheken"
119 Bibliothek.select( DOCUMENT_POSITION )
121 ' verify that the correct document is selected
122 if ( Bibliothek.getSelText() <> cDocumentName ) then
123 warnlog( "Incorrect document selected on libraries tab, aborting" )
127 printlog( "Select the new library" )
128 kontext "TabBibliotheken"
129 for iCurrentLib = 1 to Bibliotheksliste.getItemCount()
130 Bibliotheksliste.select( iCurrentLib )
131 if ( Bibliotheksliste.getSelText = LIBRARY_NAME ) then
136 printlog( "Click export" )
139 printlog( "Export as library" )
140 kontext "ExportBasicLibraryDlg"
141 if ( ExportBasicLibraryDlg.exists( 2 ) ) then
143 ExportAsLibrary.check()
144 ExportBasicLibraryDlg.ok()
146 printlog( "Use default path (=workdir)" )
148 if ( Oeffnendlg.exists( 2 ) ) then
152 if ( active.exists() ) then
153 cMsg = active.getText()
154 cMsg = hRemoveLineBreaks( cMsg )
155 warnlog( "Unexpected messagebox: " & cMsg )
161 warnlog( "The ""Export Library"" dialog was not displayed" )
164 printlog( "Close the macro/libraries organizer" )
165 kontext "TabBibliotheken"
166 if ( TabBibliotheken.exists( 1 ) ) then
167 TabBibliotheken.cancel()
169 printlog( "Cancel macro organizer" )
173 while( getDocumentCount > 0 )
177 warnlog( "Dialog <TabBibliotheken> could not be accessed" )
178 call exitRestartTheOffice()