bump product version to 5.0.4.1
[LibreOffice.git] / qadevOOo / tests / java / mod / _sc / ScStyleFamiliesObj.java
blob126d35e4e831b5d34d2fe6edad3f0930d56110b3
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.sheet.XSpreadsheetDocument;
32 import com.sun.star.style.XStyleFamiliesSupplier;
33 import com.sun.star.uno.UnoRuntime;
35 /**
36 * Test for object which is represented by service
37 * <code>com.sun.star.style.StyleFamilies</code>. <p>
38 * Object implements the following interfaces :
39 * <ul>
40 * <li> <code>com::sun::star::container::XNameAccess</code></li>
41 * <li> <code>com::sun::star::container::XElementAccess</code></li>
42 * <li> <code>com::sun::star::container::XIndexAccess</code></li>
43 * </ul>
44 * @see com.sun.star.style.StyleFamilies
45 * @see com.sun.star.container.XNameAccess
46 * @see com.sun.star.container.XElementAccess
47 * @see com.sun.star.container.XIndexAccess
48 * @see ifc.container._XNameAccess
49 * @see ifc.container._XElementAccess
50 * @see ifc.container._XIndexAccess
52 public class ScStyleFamiliesObj extends TestCase {
53 private XSpreadsheetDocument xSpreadsheetDoc = null;
55 /**
56 * Creates Spreadsheet document.
58 @Override
59 protected void initialize( TestParameters tParam, PrintWriter log ) {
60 SOfficeFactory SOF = SOfficeFactory.getFactory( 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 @Override
76 protected void cleanup( TestParameters tParam, PrintWriter log ) {
77 log.println( " disposing xSheetDoc " );
78 XComponent oComp = UnoRuntime.queryInterface (XComponent.class, xSpreadsheetDoc) ;
79 util.DesktopTools.closeDoc(oComp);
82 /**
83 * Creating a Testenvironment for the interfaces to be tested.
84 * Retrieves the collection of style families from the document
85 * using the interface <code>XStyleFamiliesSupplier</code>.
86 * This collection is the instance of the service
87 * <code>com.sun.star.style.StyleFamilies</code>.
88 * @see com.sun.star.style.StyleFamilies
89 * @see com.sun.star.style.XStyleFamiliesSupplier
91 @Override
92 public TestEnvironment createTestEnvironment(
93 TestParameters tParam, PrintWriter log) throws StatusException {
95 // creation of testobject here
96 // first we write what we are intend to do to log file
97 log.println( "creating a test environment" );
99 XNameAccess oStyleFamilies=null;
100 // create testobject here
101 log.println("getting style families");
102 XStyleFamiliesSupplier oStyleFamiliesSupplier =UnoRuntime.queryInterface(
103 XStyleFamiliesSupplier.class, xSpreadsheetDoc);
105 oStyleFamilies = oStyleFamiliesSupplier.getStyleFamilies();
107 TestEnvironment tEnv = new TestEnvironment(oStyleFamilies);
108 return tEnv;
110 } // finish method getTestEnvironment
111 } // finish class ScStyleFamiliesObj