bump product version to 5.0.4.1
[LibreOffice.git] / qadevOOo / tests / java / mod / _sw / SwXPropertySetInfo.java
blob0eeebc95a1583b503cf8f8cc181f9849abe14f1c
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._sw;
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.beans.XPropertySet;
30 import com.sun.star.text.XTextDocument;
31 import com.sun.star.uno.UnoRuntime;
32 import com.sun.star.uno.XInterface;
34 /**
35 * Test for object which is represented by PropertySetInfo of
36 * text document.<p>
37 * Object implements the following interfaces :
38 * <ul>
39 * <li> <code>com::sun::star::beans::XPropertySetInfo</code></li>
40 * </ul> <p>
41 * This object test <b> is NOT </b> designed to be run in several
42 * threads concurently.
43 * @see com.sun.star.beans.XPropertySetInfo
44 * @see ifc.beans._XPropertySetInfo
46 public class SwXPropertySetInfo extends TestCase {
47 XTextDocument xTextDoc;
49 /**
50 * Disposes text document.
52 @Override
53 protected void cleanup( TestParameters Param, PrintWriter log) {
54 log.println( " disposing xTextDoc " );
55 util.DesktopTools.closeDoc(xTextDoc);
58 /**
59 * Creating a Testenvironment for the interfaces to be tested. Method
60 * creates text document, then obtains PropertySetInfo of created text
61 * document using <code>XPropertySet</code> interface.
63 @Override
64 public synchronized TestEnvironment createTestEnvironment(
65 TestParameters Param, PrintWriter log ) throws StatusException {
66 XInterface oObj = null;
68 log.println( "creating a test environment" );
69 SOfficeFactory SOF = SOfficeFactory.getFactory( Param.getMSF() );
70 try {
71 log.println( "creating a textdocument" );
72 xTextDoc = SOF.createTextDoc( null );
73 } catch ( com.sun.star.uno.Exception e ) {
74 e.printStackTrace( log );
75 throw new StatusException( "Couldn't create document", e );
78 log.println( " getting the XPropertySetInfo" );
79 XPropertySet xProp = UnoRuntime.queryInterface(XPropertySet.class, xTextDoc);
80 oObj = xProp.getPropertySetInfo();
81 log.println( " creating a new environment for PropertySetInfo object" );
83 TestEnvironment tEnv = new TestEnvironment( oObj );
84 return tEnv;
85 } // finish method getTestEnvironment
87 } // finish class SwXPropertySetInfo