1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: SpellChecker.java,v $
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 ************************************************************************/
33 import java
.io
.PrintWriter
;
35 import lib
.StatusException
;
37 import lib
.TestEnvironment
;
38 import lib
.TestParameters
;
40 import com
.sun
.star
.lang
.XMultiServiceFactory
;
41 import com
.sun
.star
.linguistic2
.XLinguServiceManager
;
42 import com
.sun
.star
.uno
.UnoRuntime
;
43 import com
.sun
.star
.uno
.XInterface
;
46 * Test for object which is represented by service
47 * <code>com.sun.star.linguistic2.SpellChecker</code>. <p>
49 * Object implements the following interfaces :
51 * <li> <code>com::sun::star::lang::XInitialization</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::linguistic2::XSpellChecker</code></li>
56 * <li> <code>com::sun::star::lang::XServiceDisplayName</code></li>
57 * <li> <code>com::sun::star::linguistic2::XLinguServiceEventBroadcaster</code></li>
60 * This object test <b> is NOT </b> designed to be run in several
61 * threads concurently.
63 * @see com.sun.star.lang.XInitialization
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.linguistic2.XSpellChecker
68 * @see com.sun.star.lang.XServiceDisplayName
69 * @see com.sun.star.linguistic2.XLinguServiceEventBroadcaster
70 * @see ifc.lang._XInitialization
71 * @see ifc.lang._XComponent
72 * @see ifc.linguistic2._XSupportedLocales
73 * @see ifc.lang._XServiceInfo
74 * @see ifc.linguistic2._XSpellChecker
75 * @see ifc.lang._XServiceDisplayName
76 * @see ifc.linguistic2._XLinguServiceEventBroadcaster
78 public class SpellChecker
extends TestCase
{
81 * Creating a Testenvironment for the interfaces to be tested.
82 * Creates an instance of the service
83 * <code>com.sun.star.linguistic2.SpellChecker</code>.
85 protected TestEnvironment createTestEnvironment
86 (TestParameters tParam
, PrintWriter log
) {
87 XMultiServiceFactory xMSF
= (XMultiServiceFactory
)tParam
.getMSF();
88 XInterface oObj
= null;
89 Object LinguServiceManager
= null;
92 oObj
= (XInterface
)xMSF
.createInstance
93 ("com.sun.star.lingu2.SpellChecker");
94 LinguServiceManager
= xMSF
.createInstance
95 ("com.sun.star.linguistic2.LinguServiceManager");
96 } catch (com
.sun
.star
.uno
.Exception e
) {
97 e
.printStackTrace(log
);
98 throw new StatusException("Unexpected exception", e
);
101 String Iname
= util
.utils
.getImplName(oObj
);
102 log
.println("Implementation Name: "+Iname
);
103 TestEnvironment tEnv
= new TestEnvironment(oObj
);
105 XLinguServiceManager xLinguServiceManager
= (XLinguServiceManager
) UnoRuntime
.queryInterface(XLinguServiceManager
.class, LinguServiceManager
);
106 tEnv
.addObjRelation("AlternativeChecker",xLinguServiceManager
.getSpellChecker());
111 } // finish class TestCase