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 .
21 import java
.io
.PrintWriter
;
24 import lib
.TestEnvironment
;
25 import lib
.TestParameters
;
27 import com
.sun
.star
.lang
.Locale
;
28 import com
.sun
.star
.lang
.XMultiServiceFactory
;
29 import com
.sun
.star
.linguistic2
.XDictionary
;
30 import com
.sun
.star
.linguistic2
.XDictionaryList
;
31 import com
.sun
.star
.uno
.UnoRuntime
;
32 import com
.sun
.star
.uno
.XInterface
;
35 * Test for object which is represented by service
36 * <code>com.sun.star.lingu2.DicList</code>. <p>
37 * Object implements the following interfaces :
39 * <li> <code>com::sun::star::linguistic2::XSearchableDictionaryList</code></li>
40 * <li> <code>com::sun::star::lang::XComponent</code></li>
41 * <li> <code>com::sun::star::lang::XServiceInfo</code></li>
42 * <li> <code>com::sun::star::linguistic2::XDictionaryList</code></li>
45 * This object test <b> is NOT </b> designed to be run in several
46 * threads concurrently.
48 * @see com.sun.star.linguistic2.XSearchableDictionaryList
49 * @see com.sun.star.lang.XComponent
50 * @see com.sun.star.lang.XServiceInfo
51 * @see com.sun.star.linguistic2.XDictionaryList
52 * @see ifc.linguistic2._XSearchableDictionaryList
53 * @see ifc.lang._XComponent
54 * @see ifc.lang._XServiceInfo
55 * @see ifc.linguistic2._XDictionaryList
57 public class DicList
extends TestCase
{
60 * Creating a TestEnvironment for the interfaces to be tested.
61 * Creates an instance of the service
62 * <code>com.sun.star.lingu2.DicList</code>. Then two dictionaries
63 * are created (positive and negative) and added to the list, one
64 * entry is added to each of dictionaries and they both are activated.
65 * The dictionary list is returned as a component for testing.
68 public TestEnvironment
createTestEnvironment( TestParameters Param
, PrintWriter log
)
71 XMultiServiceFactory xMSF
= Param
.getMSF();
72 XInterface oObj
= (XInterface
)xMSF
.createInstance("com.sun.star.lingu2.DicList");
74 String Iname
= util
.utils
.getImplName(oObj
);
75 log
.println("Implementation Name: "+Iname
);
76 TestEnvironment tEnv
= new TestEnvironment(oObj
);
78 //creating a user defined dictionary for XSearchableDictionaryList
79 XDictionaryList xDicList
= UnoRuntime
.queryInterface(
80 XDictionaryList
.class, oObj
);
81 xDicList
.removeDictionary(xDicList
.getDictionaryByName("MyDictionary"));
82 XDictionary xDic
= xDicList
.createDictionary("NegativDic",new Locale(
83 "en","US","WIN"),com
.sun
.star
.linguistic2
.DictionaryType
.NEGATIVE
,"");
84 XDictionary xDic2
= xDicList
.createDictionary("PositivDic",new Locale(
85 "en","US","WIN"),com
.sun
.star
.linguistic2
.DictionaryType
.POSITIVE
,"");
86 xDic2
.add("Positive",false,"");
87 xDic
.add("Negative",true,"");
88 xDicList
.addDictionary(xDic
);
89 xDicList
.addDictionary(xDic2
);
91 xDic2
.setActive(true);
96 } // finish class DicList