merge the formfield patch from ooo-build
[ooovba.git] / qadevOOo / tests / java / mod / _lnn / Hyphenator.java
blobc1b3009fe5c45f8738bfc6bd8e733ac0d1e7d6d9
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: Hyphenator.java,v $
10 * $Revision: 1.5 $
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._lnn;
33 import java.io.PrintWriter;
35 import lib.StatusException;
36 import lib.TestCase;
37 import lib.TestEnvironment;
38 import lib.TestParameters;
40 import com.sun.star.beans.XPropertySet;
41 import com.sun.star.lang.XMultiServiceFactory;
42 import com.sun.star.uno.UnoRuntime;
43 import com.sun.star.uno.XInterface;
45 /**
46 * Test for object which is represented by service
47 * <code>com.sun.star.linguistic2.Hyphenator</code>. <p>
48 * Object implements the following interfaces :
49 * <ul>
50 * <li> <code>com::sun::star::lang::XInitialization</code></li>
51 * <li> <code>com::sun::star::linguistic2::XHyphenator</code></li>
52 * <li> <code>com::sun::star::lang::XComponent</code></li>
53 * <li> <code>com::sun::star::linguistic2::XSupportedLocales</code></li>
54 * <li> <code>com::sun::star::lang::XServiceInfo</code></li>
55 * <li> <code>com::sun::star::lang::XServiceDisplayName</code></li>
56 * <li> <code>com::sun::star::linguistic2::XLinguServiceEventBroadcaster</code></li>
57 * </ul> <p>
59 * This object test <b> is NOT </b> designed to be run in several
60 * threads concurently.
62 * @see com.sun.star.lang.XInitialization
63 * @see com.sun.star.linguistic2.XHyphenator
64 * @see com.sun.star.lang.XComponent
65 * @see com.sun.star.linguistic2.XSupportedLocales
66 * @see com.sun.star.lang.XServiceInfo
67 * @see com.sun.star.lang.XServiceDisplayName
68 * @see com.sun.star.linguistic2.XLinguServiceEventBroadcaster
69 * @see ifc.lang._XInitialization
70 * @see ifc.linguistic2._XHyphenator
71 * @see ifc.lang._XComponent
72 * @see ifc.linguistic2._XSupportedLocales
73 * @see ifc.lang._XServiceInfo
74 * @see ifc.lang._XServiceDisplayName
75 * @see ifc.linguistic2._XLinguServiceEventBroadcaster
77 public class Hyphenator extends TestCase {
79 /**
80 * Creating a Testenvironment for the interfaces to be tested.
81 * Creates an instance of the service
82 * <code>com.sun.star.linguistic2.Hyphenator</code>.
83 * Then a property for using new German rules for hyphenation
84 * is set.
86 protected synchronized TestEnvironment createTestEnvironment
87 (TestParameters Param, PrintWriter log) {
89 XMultiServiceFactory xMSF = (XMultiServiceFactory)Param.getMSF();
90 XInterface oObj = null;
92 try {
93 oObj = (XInterface)xMSF.createInstance
94 ("com.sun.star.linguistic2.Hyphenator");
95 Object LP = xMSF.createInstance
96 ("com.sun.star.linguistic2.LinguProperties");
97 XPropertySet LProps = (XPropertySet)
98 UnoRuntime.queryInterface(XPropertySet.class,LP);
99 LProps.setPropertyValue("IsGermanPreReform",new Boolean(true));
100 } catch (com.sun.star.uno.Exception e) {
101 e.printStackTrace(log);
102 throw new StatusException("Unexpected exception", e);
105 String Iname = util.utils.getImplName(oObj);
106 log.println("Implementation Name: "+Iname);
107 TestEnvironment tEnv = new TestEnvironment(oObj);
109 return tEnv;
113 } // finish class Hyphenator