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_package_import.inc,v $
13 '* last change: $Author: jsk $ $Date: 2008-06-17 11:42:14 $
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 : Import BASIC library via Package Manager GUI as UNO Package
38 '\******************************************************************************
40 testcase tBasicPackageImport
42 '///<h1>Import BASIC library as UNO package via Package Manager UI</h1>
44 ' Assumption: All actions take place in the user/work directory
45 ' macro taken from global/input/macros.txt::tBasicLibraryExport
47 dim package_name as string
49 ' CWS jl44 introduced .oxt for extensions
50 if ( gBuild < 9075 ) then
51 package_name = "tBasicExport.uno.pkg"
52 qaerrorlog( "Using old extension naming scheme" )
54 package_name = "tBasicExport.oxt"
57 const LIBRARY_NAME = "tBasicExport"
59 dim cDocumentName as string
60 dim cLibraryName as string
62 dim iNodeCount as integer
63 dim iCurrentLib as integer
64 dim iStatus as integer
67 cFile = hGetWorkPath() & package_name
70 gApplication = "WRITER"
72 '///+<li>Open the package manager ui</li>
73 '///+<li>Add a package</li>
74 '///+<li>Select "tBasicLibraryExportAsPackage.oxt", import it</li>
75 '///+<li>Close the package manager ui</li>
76 iStatus = hExtensionAddGUI( cFile, "InstallForUser,NoLicense,NoUpdate" )
78 ' Evaluate the returncode. Anything different from 0 causes the test to end.
79 if ( iStatus <= 0 ) then
80 warnlog( "Error adding extension. Aborting." )
84 '///+<li>Run the macro via Macro Organizer</li>
85 hMacroOrganizerRunMacro( LIBRARY_NAME )
87 '///+<li>The macro triggers a dialog, close it</li>
89 if ( active.exists( 5 ) ) then
92 warnlog( "The macro was not executed" )
95 '///+<li>Go to Tools/Macros/Organize Macros/OpenOffice.org Basic</li>
98 '///+<li>Select the first node (My Macros)</li>
102 '///+<li>Click to open the organizer</li>
105 '///+<li>Switch to the libraries-tab</li>
106 hSelectBasicObjectOrganizerTab( 3 )
108 '///+<li>Select My Macros & Dialogs</li>
109 kontext "TabBibliotheken"
110 Bibliothek.select( 1 )
112 '///+<li>Find the new library, select it</li>
113 printlog( "Select the new library" )
114 kontext "TabBibliotheken"
115 for iCurrentLib = 1 to Bibliotheksliste.getItemCount()
116 Bibliotheksliste.select( iCurrentLib )
117 if ( Bibliotheksliste.getSelText() = LIBRARY_NAME ) then
121 cLibraryName = BibliotheksListe.getSelText()
123 '///+<li>Click to import -> #i64007</li>
127 warnlog( "#i64007 - Office crashes on clicking import button" )
130 '///+<li>Cancel the FileOpen dialog</li>
134 '///+<li>Cleanup: Delete the library</li>
135 printlog( "Cleanup: Delete Library, close dialogs and remove package" )
137 ' Note: It is assumed that the library is selected
138 kontext "TabBibliotheken"
139 cLibraryName = BibliotheksListe.getSelText()
140 if ( cLibraryName <> LIBRARY_NAME ) then
141 warnlog( "Incorrect library is selected" & cLibraryName )
146 if ( active.exists( 1 ) ) then
149 warnlog( "No warning for library deletion" )
154 '///+<li>Cleanup: Close Libraries organizer</li>
155 kontext "TabBibliotheken"
156 TabBibliotheken.cancel()
158 '///+<li>Cleanup: Close Macro Organizer</li>
162 '///+<li>Remove package via package manager</li>
163 hExtensionRemoveGUI( package_name )