merge the formfield patch from ooo-build
[ooovba.git] / qadevOOo / tests / java / mod / _sw / SwXTextDefaults.java
blobdb33d31e7b94463fa70a057f4d7dc3843258279c
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: SwXTextDefaults.java,v $
10 * $Revision: 1.7 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 package mod._sw;
33 //API Interfaces
34 import java.io.PrintWriter;
36 import lib.StatusException;
37 import lib.TestCase;
38 import lib.TestEnvironment;
39 import lib.TestParameters;
40 import util.SOfficeFactory;
42 import com.sun.star.lang.XMultiServiceFactory;
43 import com.sun.star.text.XTextDocument;
44 import com.sun.star.uno.UnoRuntime;
45 import com.sun.star.uno.XInterface;
47 /**
48 * Test for object which is represented by service
49 * <code>com.sun.star.text.Defaults</code> created by a writer
50 * document's <code>XMultiServiceFactory</code>. <p>
52 * Object implements the following interfaces :
53 * <ul>
54 * <li> <code>com::sun::star::style::ParagraphProperties</code></li>
55 * <li> <code>com::sun::star::style::CharacterPropertiesComplex</code></li>
56 * <li> <code>com::sun::star::style::CharacterPropertiesAsian</code></li>
57 * <li> <code>com::sun::star::text::Defaults</code></li>
58 * <li> <code>com::sun::star::style::CharacterProperties</code></li>
59 * <li> <code>com::sun::star::beans::XPropertySet</code></li>
60 * <li> <code>com::sun::star::style::ParagraphPropertiesComplex</code></li>
61 * </ul> <p>
63 * @see com.sun.star.style.ParagraphProperties
64 * @see com.sun.star.style.CharacterPropertiesComplex
65 * @see com.sun.star.style.CharacterPropertiesAsian
66 * @see com.sun.star.text.Defaults
67 * @see com.sun.star.style.CharacterProperties
68 * @see com.sun.star.beans.XPropertySet
69 * @see com.sun.star.style.ParagraphPropertiesComplex
70 * @see ifc.style._ParagraphProperties
71 * @see ifc.style._CharacterPropertiesComplex
72 * @see ifc.style._CharacterPropertiesAsian
73 * @see ifc.text._Defaults
74 * @see ifc.style._CharacterProperties
75 * @see ifc.beans._XPropertySet
76 * @see ifc.style._ParagraphPropertiesComplex
78 public class SwXTextDefaults extends TestCase {
80 XTextDocument xTextDoc;
82 /**
83 * Creates the service <code>com.sun.star.text.Defaults</code>
85 protected TestEnvironment createTestEnvironment(
86 TestParameters tParam, PrintWriter log) {
88 XInterface oObj = null;
90 XMultiServiceFactory docMSF = (XMultiServiceFactory)
91 UnoRuntime.queryInterface(XMultiServiceFactory.class,xTextDoc);
93 try {
94 oObj = (XInterface)
95 docMSF.createInstance("com.sun.star.text.Defaults");
96 } catch (com.sun.star.uno.Exception e) {
97 throw new StatusException("Couldn't create Object",e);
100 TestEnvironment tEnv = new TestEnvironment(oObj);
102 return tEnv;
106 * Creates text document.
108 protected void initialize( TestParameters tParam, PrintWriter log ) {
109 SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
110 try {
111 log.println( "creating a textdocument" );
112 xTextDoc = SOF.createTextDoc( null );
113 } catch ( com.sun.star.uno.Exception e ) {
114 e.printStackTrace( log );
115 throw new StatusException( "Couldn't create document", e );
120 * Disposes text document.
122 protected void cleanup( TestParameters tParam, PrintWriter log ) {
123 log.println( " disposing xTextDoc " );
124 util.DesktopTools.closeDoc(xTextDoc);