2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 import java
.io
.PrintWriter
;
23 import lib
.StatusException
;
25 import lib
.TestEnvironment
;
26 import lib
.TestParameters
;
27 import util
.SOfficeFactory
;
29 import com
.sun
.star
.lang
.XComponent
;
30 import com
.sun
.star
.lang
.XMultiServiceFactory
;
31 import com
.sun
.star
.sheet
.XSpreadsheetDocument
;
32 import com
.sun
.star
.uno
.UnoRuntime
;
33 import com
.sun
.star
.uno
.XInterface
;
36 * Test for object which is represented by service
37 * <code>com.sun.star.sheet.FunctionDescriptions</code>. <p>
38 * Object implements the following interfaces :
40 * <li> <code>com::sun::star::container::XNameAccess</code></li>
41 * <li> <code>com::sun::star::container::XIndexAccess</code></li>
42 * <li> <code>com::sun::star::sheet::XFunctionDescriptions</code></li>
43 * <li> <code>com::sun::star::container::XElementAccess</code></li>
45 * @see com.sun.star.sheet.FunctionDescriptions
46 * @see com.sun.star.container.XNameAccess
47 * @see com.sun.star.container.XIndexAccess
48 * @see com.sun.star.sheet.XFunctionDescriptions
49 * @see com.sun.star.container.XElementAccess
50 * @see ifc.container._XNameAccess
51 * @see ifc.container._XIndexAccess
52 * @see ifc.sheet._XFunctionDescriptions
53 * @see ifc.container._XElementAccess
55 public class ScFunctionListObj
extends TestCase
{
56 private XSpreadsheetDocument xSheetDoc
= null;
59 * Creates Spreadsheet document.
62 protected void initialize( TestParameters tParam
, PrintWriter log
) {
63 SOfficeFactory SOF
= SOfficeFactory
.getFactory( tParam
.getMSF() );
66 log
.println( "creating a Spreadsheet document" );
67 xSheetDoc
= SOF
.createCalcDoc(null);
68 } catch (com
.sun
.star
.uno
.Exception e
) {
69 // Some exception occurs.FAILED
70 e
.printStackTrace( log
);
71 throw new StatusException( "Couldn't create document", e
);
77 * Disposes Spreadsheet document.
80 protected void cleanup( TestParameters tParam
, PrintWriter log
) {
81 log
.println( " disposing xSheetDoc " );
82 XComponent oComp
= UnoRuntime
.queryInterface (XComponent
.class, xSheetDoc
) ;
83 util
.DesktopTools
.closeDoc(oComp
);
87 * Creating a Testenvironment for the interfaces to be tested.
88 * Creates an instance of the service
89 * <code>com.sun.star.sheet.FunctionDescriptions</code>.
90 * @see com.sun.star.sheet.FunctionDescriptions
93 public synchronized TestEnvironment
createTestEnvironment(
94 TestParameters Param
, PrintWriter log
) throws StatusException
{
96 XInterface oObj
= null;
98 // creation of testobject here
99 // first we write what we are intend to do to log file
100 log
.println( "Creating a test environment" );
102 log
.println("Getting test object ") ;
104 XMultiServiceFactory oDocMSF
= Param
.getMSF();
106 oObj
= (XInterface
)oDocMSF
.createInstance(
107 "com.sun.star.sheet.FunctionDescriptions");
108 log
.println("Creating object - " +
109 ((oObj
== null) ?
"FAILED" : "OK"));
110 } catch (com
.sun
.star
.uno
.Exception e
) {
111 e
.printStackTrace(log
) ;
112 throw new StatusException(
113 "Error getting test object from spreadsheet document", e
);
116 TestEnvironment tEnv
= new TestEnvironment( oObj
);