Branch libreoffice-5-0-4
[LibreOffice.git] / qadevOOo / tests / java / mod / _sw / SwXTextDefaults.java
blobb2c4013d12c58f02c31a84fbec8e5ed9b35bbe8f
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 //API Interfaces
22 import java.io.PrintWriter;
24 import lib.StatusException;
25 import lib.TestCase;
26 import lib.TestEnvironment;
27 import lib.TestParameters;
28 import util.SOfficeFactory;
30 import com.sun.star.lang.XMultiServiceFactory;
31 import com.sun.star.text.XTextDocument;
32 import com.sun.star.uno.UnoRuntime;
33 import com.sun.star.uno.XInterface;
35 /**
36 * Test for object which is represented by service
37 * <code>com.sun.star.text.Defaults</code> created by a writer
38 * document's <code>XMultiServiceFactory</code>. <p>
40 * Object implements the following interfaces :
41 * <ul>
42 * <li> <code>com::sun::star::style::ParagraphProperties</code></li>
43 * <li> <code>com::sun::star::style::CharacterPropertiesComplex</code></li>
44 * <li> <code>com::sun::star::style::CharacterPropertiesAsian</code></li>
45 * <li> <code>com::sun::star::text::Defaults</code></li>
46 * <li> <code>com::sun::star::style::CharacterProperties</code></li>
47 * <li> <code>com::sun::star::beans::XPropertySet</code></li>
48 * <li> <code>com::sun::star::style::ParagraphPropertiesComplex</code></li>
49 * </ul> <p>
51 * @see com.sun.star.style.ParagraphProperties
52 * @see com.sun.star.style.CharacterPropertiesComplex
53 * @see com.sun.star.style.CharacterPropertiesAsian
54 * @see com.sun.star.text.Defaults
55 * @see com.sun.star.style.CharacterProperties
56 * @see com.sun.star.beans.XPropertySet
57 * @see com.sun.star.style.ParagraphPropertiesComplex
58 * @see ifc.style._ParagraphProperties
59 * @see ifc.style._CharacterPropertiesComplex
60 * @see ifc.style._CharacterPropertiesAsian
61 * @see ifc.text._Defaults
62 * @see ifc.style._CharacterProperties
63 * @see ifc.beans._XPropertySet
64 * @see ifc.style._ParagraphPropertiesComplex
66 public class SwXTextDefaults extends TestCase {
68 XTextDocument xTextDoc;
70 /**
71 * Creates the service <code>com.sun.star.text.Defaults</code>
73 @Override
74 protected TestEnvironment createTestEnvironment(
75 TestParameters tParam, PrintWriter log) {
77 XInterface oObj = null;
79 XMultiServiceFactory docMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class,xTextDoc);
81 try {
82 oObj = (XInterface)
83 docMSF.createInstance("com.sun.star.text.Defaults");
84 } catch (com.sun.star.uno.Exception e) {
85 throw new StatusException("Couldn't create Object",e);
88 TestEnvironment tEnv = new TestEnvironment(oObj);
90 return tEnv;
93 /**
94 * Creates text document.
96 @Override
97 protected void initialize( TestParameters tParam, PrintWriter log ) {
98 SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF() );
99 try {
100 log.println( "creating a textdocument" );
101 xTextDoc = SOF.createTextDoc( null );
102 } catch ( com.sun.star.uno.Exception e ) {
103 e.printStackTrace( log );
104 throw new StatusException( "Couldn't create document", e );
109 * Disposes text document.
111 @Override
112 protected void cleanup( TestParameters tParam, PrintWriter log ) {
113 log.println( " disposing xTextDoc " );
114 util.DesktopTools.closeDoc(xTextDoc);