bump product version to 4.2.0.1
[LibreOffice.git] / qadevOOo / tests / java / mod / _sc / ScStyleFamiliesObj.java
blobbc250c38478dd8b467d7163d92f3d93f490c280e
1 /*
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 .
19 package mod._sc;
21 import java.io.PrintWriter;
23 import lib.StatusException;
24 import lib.TestCase;
25 import lib.TestEnvironment;
26 import lib.TestParameters;
27 import util.SOfficeFactory;
29 import com.sun.star.container.XNameAccess;
30 import com.sun.star.lang.XComponent;
31 import com.sun.star.lang.XMultiServiceFactory;
32 import com.sun.star.sheet.XSpreadsheetDocument;
33 import com.sun.star.style.XStyleFamiliesSupplier;
34 import com.sun.star.uno.UnoRuntime;
36 /**
37 * Test for object which is represented by service
38 * <code>com.sun.star.style.StyleFamilies</code>. <p>
39 * Object implements the following interfaces :
40 * <ul>
41 * <li> <code>com::sun::star::container::XNameAccess</code></li>
42 * <li> <code>com::sun::star::container::XElementAccess</code></li>
43 * <li> <code>com::sun::star::container::XIndexAccess</code></li>
44 * </ul>
45 * @see com.sun.star.style.StyleFamilies
46 * @see com.sun.star.container.XNameAccess
47 * @see com.sun.star.container.XElementAccess
48 * @see com.sun.star.container.XIndexAccess
49 * @see ifc.container._XNameAccess
50 * @see ifc.container._XElementAccess
51 * @see ifc.container._XIndexAccess
53 public class ScStyleFamiliesObj extends TestCase {
54 private XSpreadsheetDocument xSpreadsheetDoc = null;
56 /**
57 * Creates Spreadsheet document.
59 protected void initialize( TestParameters tParam, PrintWriter log ) {
60 SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
62 try {
63 log.println( "creating a Spreadsheet document" );
64 xSpreadsheetDoc = SOF.createCalcDoc(null);
65 } catch ( com.sun.star.uno.Exception e ) {
66 // Some exception occurs.FAILED
67 e.printStackTrace( log );
68 throw new StatusException( "Couldn't create document", e );
72 /**
73 * Disposes Spreadsheet document.
75 protected void cleanup( TestParameters tParam, PrintWriter log ) {
76 log.println( " disposing xSheetDoc " );
77 XComponent oComp = UnoRuntime.queryInterface (XComponent.class, xSpreadsheetDoc) ;
78 util.DesktopTools.closeDoc(oComp);
81 /**
82 * Creating a Testenvironment for the interfaces to be tested.
83 * Retrieves the collection of style families from the document
84 * using the interface <code>XStyleFamiliesSupplier</code>.
85 * This collection is the instance of the service
86 * <code>com.sun.star.style.StyleFamilies</code>.
87 * @see com.sun.star.style.StyleFamilies
88 * @see com.sun.star.style.XStyleFamiliesSupplier
90 public TestEnvironment createTestEnvironment(
91 TestParameters tParam, PrintWriter log) throws StatusException {
93 // creation of testobject here
94 // first we write what we are intend to do to log file
95 log.println( "creating a test environment" );
97 XNameAccess oStyleFamilies=null;
98 // create testobject here
99 log.println("getting style families");
100 XStyleFamiliesSupplier oStyleFamiliesSupplier =UnoRuntime.queryInterface(
101 XStyleFamiliesSupplier.class, xSpreadsheetDoc);
103 oStyleFamilies = oStyleFamiliesSupplier.getStyleFamilies();
105 TestEnvironment tEnv = new TestEnvironment(oStyleFamilies);
106 return tEnv;
108 } // finish method getTestEnvironment
109 } // finish class ScStyleFamiliesObj