tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / qadevOOo / tests / java / ifc / linguistic2 / _XLinguServiceManager.java
blob2f71ea37216bd5c5b2c42a77d8d5cf383355f3c5
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 ifc.linguistic2;
21 import lib.MultiMethodTest;
23 import com.sun.star.lang.EventObject;
24 import com.sun.star.lang.Locale;
25 import com.sun.star.linguistic2.LinguServiceEvent;
26 import com.sun.star.linguistic2.XHyphenator;
27 import com.sun.star.linguistic2.XLinguServiceEventListener;
28 import com.sun.star.linguistic2.XLinguServiceManager;
29 import com.sun.star.linguistic2.XSpellChecker;
30 import com.sun.star.linguistic2.XThesaurus;
32 /**
33 *Testing <code>com.sun.star.linguistic2.XLinguServiceManager</code>
34 * interface methods:
35 * <ul>
36 * <li><code>getSpellChecker()</code></li>
37 * <li><code>getHyphenator()</code></li>
38 * <li><code>getThesaurus()</code></li>
39 * <li><code>addLinguServiceManagerListener()</code></li>
40 * <li><code>removeLinguServiceManagerListener()</code></li>
41 * <li><code>getAvailableServices()</code></li>
42 * <li><code>setConfiguredServices()</code></li>
43 * <li><code>getConfiguredServices()</code></li>
44 * </ul> <p>
45 *@see com.sun.star.linguistic2.XLinguServiceManager
47 public class _XLinguServiceManager extends MultiMethodTest {
49 public XLinguServiceManager oObj = null;
51 /**
52 * Class implements interface <code>XLinguServiceEventListener</code>
53 * for test method <code>addLinguServiceManagerListener</code>.
54 * @see com.sun.star.linguistic2.XLinguServiceEventListener
56 public class MyLinguServiceEventListener implements
57 XLinguServiceEventListener {
58 public void disposing ( EventObject oEvent ) {
59 log.println("Listener has been disposed");
61 public void processLinguServiceEvent(LinguServiceEvent aServiceEvent) {
62 log.println("Listener called");
66 XLinguServiceEventListener listener = new MyLinguServiceEventListener();
68 /**
69 * Test calls the method and checks returned value. <p>
70 * Has <b> OK </b> status if returned value isn't null. <p>
72 public void _getSpellChecker() {
73 XSpellChecker SC = oObj.getSpellChecker();
74 tRes.tested("getSpellChecker()", SC != null);
77 /**
78 * Test calls the method and checks returned value. <p>
79 * Has <b> OK </b> status if returned value isn't null. <p>
81 public void _getHyphenator() {
82 XHyphenator HN = oObj.getHyphenator();
83 tRes.tested("getHyphenator()", HN != null);
86 /**
87 * Test calls the method and checks returned value. <p>
88 * Has <b> OK </b> status if returned value isn't null. <p>
90 public void _getThesaurus() {
91 XThesaurus TS = oObj.getThesaurus();
92 tRes.tested("getThesaurus()", TS != null);
95 /**
96 * Test calls the method and checks returned value. <p>
97 * Has <b> OK </b> status if returned value is equal to true. <p>
99 public void _addLinguServiceManagerListener() {
100 boolean res = oObj.addLinguServiceManagerListener(listener);
101 tRes.tested("addLinguServiceManagerListener()", res);
105 * Test calls the method and checks returned value. <p>
106 * Has <b> OK </b> status if returned value is equal to true. <p>
108 public void _removeLinguServiceManagerListener() {
109 boolean res = oObj.removeLinguServiceManagerListener(listener);
110 tRes.tested("removeLinguServiceManagerListener()",res);
114 * Test calls the method and checks returned value. <p>
115 * Has <b> OK </b> status if length of returned array is
116 * greater than zero.<p>
118 public void _getAvailableServices() {
119 String[] services = oObj.getAvailableServices(
120 "com.sun.star.linguistic2.Hyphenator",
121 new Locale("en", "US", "") );
122 tRes.tested("getAvailableServices()", services.length > 0);
126 * Test calls the method and checks returned value. <p>
127 * Has <b> OK </b> status if length of returned array is
128 * greater than zero.<p>
130 public void _getConfiguredServices() {
131 String[] services = oObj.getConfiguredServices(
132 "com.sun.star.linguistic2.Hyphenator",
133 new Locale("en", "US", "") );
134 tRes.tested("getConfiguredServices()", services.length > 0);
138 * Test sets empty list of service, checks value returned
139 * by method <code>getConfiguredServices()</code> and all services
140 * restored finally. <p>
141 * Has <b> OK </b> status if length of obtained service list equal to zero.
142 * <p>The following method tests are to be completed successfully before :
143 * <ul>
144 * <li> <code> getConfiguredServices() </code></li>
145 * </ul>
147 public void _setConfiguredServices() {
148 requiredMethod("getConfiguredServices()");
150 String[] services = oObj.getConfiguredServices(
151 "com.sun.star.linguistic2.Hyphenator",new Locale("en","US",""));
153 String[] empty = new String[0];
154 oObj.setConfiguredServices(
155 "com.sun.star.linguistic2.Hyphenator",
156 new Locale("en", "US", ""),
157 empty );
159 String[] get = oObj.getConfiguredServices(
160 "com.sun.star.linguistic2.Hyphenator", new Locale("en","US",""));
162 boolean res = (get.length == 0);
164 oObj.setConfiguredServices(
165 "com.sun.star.linguistic2.Hyphenator",
166 new Locale("en", "US", ""),
167 services );
169 tRes.tested("setConfiguredServices()", res);
172 } // finish class _XLinguServiceManager