summaryrefslogtreecommitdiff
path: root/qadevOOo/tests/java/ifc/linguistic2
diff options
context:
space:
mode:
Diffstat (limited to 'qadevOOo/tests/java/ifc/linguistic2')
-rw-r--r--qadevOOo/tests/java/ifc/linguistic2/_LinguProperties.java61
-rw-r--r--qadevOOo/tests/java/ifc/linguistic2/_XAvailableLocales.java58
-rw-r--r--qadevOOo/tests/java/ifc/linguistic2/_XDictionaryList.java295
-rw-r--r--qadevOOo/tests/java/ifc/linguistic2/_XHyphenator.java111
-rw-r--r--qadevOOo/tests/java/ifc/linguistic2/_XLinguServiceEventBroadcaster.java94
-rw-r--r--qadevOOo/tests/java/ifc/linguistic2/_XLinguServiceManager.java185
-rw-r--r--qadevOOo/tests/java/ifc/linguistic2/_XSearchableDictionaryList.java73
-rw-r--r--qadevOOo/tests/java/ifc/linguistic2/_XSpellChecker.java116
-rw-r--r--qadevOOo/tests/java/ifc/linguistic2/_XSupportedLocales.java89
-rw-r--r--qadevOOo/tests/java/ifc/linguistic2/_XThesaurus.java72
10 files changed, 1154 insertions, 0 deletions
diff --git a/qadevOOo/tests/java/ifc/linguistic2/_LinguProperties.java b/qadevOOo/tests/java/ifc/linguistic2/_LinguProperties.java
new file mode 100644
index 000000000000..2e533e449eac
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/linguistic2/_LinguProperties.java
@@ -0,0 +1,61 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package ifc.linguistic2;
+
+import lib.MultiPropertyTest;
+
+/**
+* Testing <code>com.sun.star.linguistic2.LinguProperties</code>
+* service properties:
+* <ul>
+* <li><code>'IsGermanPreReform'</code></li>
+* <li><code>'IsUseDictionaryList'</code></li>
+* <li><code>'IsIgnoreControlCharacters'</code></li>
+* <li><code>'IsSpellUpperCase'</code></li>
+* <li><code>'IsSpellWithDigits'</code></li>
+* <li><code>'IsSpellCapitalization'</code></li>
+* <li><code>'HyphMinLeading'</code></li>
+* <li><code>'HyphMinTrailing'</code></li>
+* <li><code>'HyphMinWordLength'</code></li>
+* <li><code>'DefaultLocale'</code></li>
+* <li><code>'IsHyphAuto'</code></li>
+* <li><code>'IsHyphSpecial'</code></li>
+* <li><code>'IsSpellAuto'</code></li>
+* <li><code>'IsSpellHide'</code></li>
+* <li><code>'IsSpellInAllLanguages'</code></li>
+* <li><code>'IsSpellSpecial'</code></li>
+* <li><code>'IsWrapReverse'</code></li>
+* <li><code>'DefaultLocale_CJK'</code></li>
+* <li><code>'DefaultLocale_CTL'</code></li>
+* </ul>
+* @see com.sun.star.linguistic2.LinguProperties
+*/
+public class _LinguProperties extends MultiPropertyTest {
+} // finish class _LinguProperties
+
+
diff --git a/qadevOOo/tests/java/ifc/linguistic2/_XAvailableLocales.java b/qadevOOo/tests/java/ifc/linguistic2/_XAvailableLocales.java
new file mode 100644
index 000000000000..c8342fe1ecbd
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/linguistic2/_XAvailableLocales.java
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package ifc.linguistic2;
+
+import com.sun.star.lang.Locale;
+import com.sun.star.linguistic2.XAvailableLocales;
+import lib.MultiMethodTest;
+
+/**
+* Testing <code>com.sun.star.linguistic2.XAvailableLocales</code>
+* interface methods:
+* <ul>
+* <li><code>getAvailableLocales()</code></li>
+* </ul> <p>
+* @see com.sun.star.linguistic2.XAvailableLocales
+*/
+public class _XAvailableLocales extends MultiMethodTest {
+
+ public XAvailableLocales oObj = null;
+ public static Locale[] locales = new Locale[0];
+
+ /**
+ * Test calls the method, stores returned value and checks it. <p>
+ * Has <b> OK </b> status if length of returned array isn't zero. <p>
+ */
+ public void _getAvailableLocales() {
+ locales = oObj.getAvailableLocales("com.sun.star.linguistic2.Hyphenator");
+ tRes.tested("getAvailableLocales()", locales.length > 0);
+ }
+
+} // finish class XAvailableLocales
+
+
diff --git a/qadevOOo/tests/java/ifc/linguistic2/_XDictionaryList.java b/qadevOOo/tests/java/ifc/linguistic2/_XDictionaryList.java
new file mode 100644
index 000000000000..36850c05364d
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/linguistic2/_XDictionaryList.java
@@ -0,0 +1,295 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package ifc.linguistic2;
+
+import lib.MultiMethodTest;
+
+import com.sun.star.lang.EventObject;
+import com.sun.star.lang.Locale;
+import com.sun.star.linguistic2.DictionaryListEvent;
+import com.sun.star.linguistic2.XDictionary;
+import com.sun.star.linguistic2.XDictionaryList;
+import com.sun.star.linguistic2.XDictionaryListEventListener;
+
+/**
+* Testing <code>com.sun.star.linguistic2.XDictionaryList</code>
+* interface methods:
+* <ul>
+* <li><code>getCount()</code></li>
+* <li><code>getDictionaries()</code></li>
+* <li><code>getDictionaryByName()</code></li>
+* <li><code>addDictionary()</code></li>
+* <li><code>removeDictionary()</code></li>
+* <li><code>addDictionaryListEventListener()</code></li>
+* <li><code>removeDictionaryListEventListener()</code></li>
+* <li><code>beginCollectEvents()</code></li>
+* <li><code>endCollectEvents()</code></li>
+* <li><code>flushEvents()</code></li>
+* <li><code>createDictionary()</code></li>
+* </ul> <p>
+* @see com.sun.star.linguistic2.XDictionaryList
+*/
+public class _XDictionaryList extends MultiMethodTest {
+
+ public XDictionaryList oObj = null;
+ public XDictionary addedDic = null;
+
+ /**
+ * Flag for testing of listeners.
+ */
+ public boolean listenerCalled = false;
+
+ /**
+ * Class implements interface <code>XDictionaryListEventListener</code>
+ * for test method <code>addDictionaryListEventListener</code>.
+ * @see com.sun.star.linguistic2.XDictionaryListEventListener
+ */
+ public class MyDictionaryListEventListener implements
+ XDictionaryListEventListener {
+
+ public void disposing ( EventObject oEvent ) {
+ log.println("Listener has been disposed");
+ }
+ public void processDictionaryListEvent( DictionaryListEvent aDicEvent) {
+ listenerCalled = true;
+ }
+ };
+
+ XDictionaryListEventListener listener = new MyDictionaryListEventListener();
+
+ short count = 0;
+
+ /**
+ * Test calls the method and checks returned value. <p>
+ * Has <b> OK </b> status if returned value is greater than zero. <p>
+ */
+ public void _getCount() {
+ count = oObj.getCount();
+ tRes.tested("getCount()",(count > 0) );
+ }
+
+ /**
+ * Test calls the method and checks number of obtained dictionaries
+ * with value that was returned by method <code>getCount</code>. <p>
+ * Has <b> OK </b> status if values are equal. <p>
+ * The following method tests are to be completed successfully before :
+ * <ul>
+ * <li> <code> getCount() </code> : to have number of dictionaries </li>
+ * </ul>
+ */
+ public void _getDictionaries() {
+ requiredMethod("getCount()");
+
+ XDictionary[] dics = oObj.getDictionaries();
+ boolean res = (dics.length == count);
+ if (!res) {
+ log.println("Expected: " + oObj.getCount());
+ log.println("Gained: " + dics.length);
+ }
+ tRes.tested("getDictionaries()", res);
+ }
+
+ /**
+ * Test calls the method, makes some actions that leads to event
+ * <code>processDictionaryListEvent</code>, removes listener, checks flag
+ * <code>listenerCalled</code> and checks returned value. <p>
+ * Has <b> OK </b> status if returned value is true and value of flag
+ * <code>listenerCallled</code> is true. <p>
+ */
+ public void _addDictionaryListEventListener() {
+ listenerCalled = false;
+
+ XDictionary xDic = oObj.createDictionary("ListenDic",
+ new Locale("en","US","WIN"),
+ com.sun.star.linguistic2.DictionaryType.POSITIVE,"");
+
+ boolean res = oObj.addDictionaryListEventListener(listener, false);
+
+ oObj.flushEvents();
+ oObj.addDictionary(xDic);
+ xDic.add("Positiv", false, "");
+ xDic.setActive(true);
+ oObj.flushEvents();
+ oObj.removeDictionary(xDic);
+
+ oObj.removeDictionaryListEventListener(listener);
+
+ tRes.tested("addDictionaryListEventListener()",listenerCalled && res);
+ }
+
+ /**
+ * Test calls the method, makes some actions that leads to event
+ * <code>processDictionaryListEvent</code>, checks flag
+ * <code>listenerCalled</code> and checks returned value. <p>
+ * Has <b> OK </b> status if returned value is false and value of flag
+ * <code>listenerCallled</code> is false. <p>
+ */
+ public void _removeDictionaryListEventListener() {
+ listenerCalled = false;
+
+ XDictionary xDic = oObj.createDictionary("ListenDic",
+ new Locale("en","US","WIN"),
+ com.sun.star.linguistic2.DictionaryType.POSITIVE,"");
+
+ oObj.addDictionaryListEventListener(listener,false);
+
+ oObj.flushEvents();
+ oObj.addDictionary(xDic);
+ xDic.add("Positiv", false,"");
+ xDic.setActive(true);
+
+ listenerCalled = false;
+ boolean res = oObj.removeDictionaryListEventListener(listener);
+
+ oObj.flushEvents();
+ oObj.removeDictionary(xDic);
+
+ tRes.tested(
+ "removeDictionaryListEventListener()",
+ listenerCalled == false && res == true );
+ }
+
+ /**
+ * Test creates new dictionary, adds the dictionary to list and compares
+ * number of dictionaries after adding with number of dictionaries before.<p>
+ * Has <b> OK </b> status if number of dictionaries after method call is
+ * greater than number of dictionaries before method call. <p>
+ */
+ public void _addDictionary() {
+ short previous = oObj.getCount();
+ addedDic = oObj.createDictionary("AddedDic",new Locale("en","US","WIN"),
+ com.sun.star.linguistic2.DictionaryType.POSITIVE,"");
+ addedDic.add("Positiv",false,"");
+
+ oObj.addDictionary(addedDic);
+
+ short after = oObj.getCount();
+
+ tRes.tested( "addDictionary()", (after > previous) );
+ }
+
+ /**
+ * Test calls the method and compares number of dictionaries
+ * before method call and after. <p>
+ * Has <b> OK </b> status if number of dictionaries before method call is
+ * less than number of dictionaries after method call. <p>
+ */
+ public void _removeDictionary() {
+ short previous = oObj.getCount();
+ oObj.removeDictionary(addedDic);
+ short after = oObj.getCount();
+ tRes.tested("removeDictionary()",(after < previous) );
+ }
+
+ /**
+ * Test calls the method and checks returned value. <p>
+ * Has <b> OK </b> status if returned value isn't null. <p>
+ */
+ public void _getDictionaryByName() {
+ XDictionary getting = oObj.getDictionaryByName("NegativDic");
+ tRes.tested("getDictionaryByName()", getting != null );
+ }
+
+ /**
+ * Test calls the method and checks returned value. <p>
+ * Has <b> OK </b> status if returned value isn't null. <p>
+ */
+ public void _createDictionary() {
+ XDictionary tmpDic = oObj.createDictionary("AddedDic",
+ new Locale("en","US","WIN"),
+ com.sun.star.linguistic2.DictionaryType.POSITIVE,"");
+ tRes.tested("createDictionary()", tmpDic != null );
+ }
+
+ /**
+ * Test creates dictionary, adds dictionary list event listener,
+ * begins collect events, makes some actions that leads to event
+ * <code>processDictionaryListEvent</code>, ends collect events,
+ * removes the listener and checks the flag <code>listenerCalled</code> . <p>
+ * Has <b> OK </b> status if value of the flag is true. <p>
+ */
+ public void _beginCollectEvents() {
+ listenerCalled = false;
+
+ XDictionary xDic = oObj.createDictionary("ListenDic",
+ new Locale("en","US","WIN"),
+ com.sun.star.linguistic2.DictionaryType.POSITIVE,"");
+
+ oObj.addDictionaryListEventListener(listener,false);
+ oObj.beginCollectEvents();
+
+ oObj.addDictionary(xDic);
+ xDic.add("Positiv",false,"");
+ xDic.setActive(true);
+
+ oObj.removeDictionary(xDic);
+ oObj.endCollectEvents();
+
+ oObj.removeDictionaryListEventListener(listener);
+
+ tRes.tested("beginCollectEvents()", listenerCalled );
+ }
+
+ /**
+ * Test does nothing. <p>
+ * Has <b> OK </b> status if method
+ * <code>addDictionaryListEventListener()</code> was completed
+ * successfully. <p>
+ * The following method tests are to be completed successfully before :
+ * <ul>
+ * <li> <code> addDictionaryListEventListener() </code> :
+ * if listener adding worked, flushEvents was already used and worked </li>
+ * </ul>
+ */
+ public void _flushEvents() {
+ requiredMethod("addDictionaryListEventListener()");
+ // if listener adding worked, flushEvents was already used and worked
+ tRes.tested("flushEvents()",true);
+ }
+
+ /**
+ * Test does nothing. <p>
+ * Has <b> OK </b> status if method
+ * <code>beginCollectEvents()</code> was completed successfully. <p>
+ * The following method tests are to be completed successfully before :
+ * <ul>
+ * <li> <code> beginCollectEvents() </code> :
+ * if beginCollectEvents() worked then endCollectEvents was already
+ * used and worked </li>
+ * </ul>
+ */
+ public void _endCollectEvents() {
+ requiredMethod("beginCollectEvents()");
+ // if beginCollectEvents() worked, endCollectEvents
+ // was already used and worked
+ tRes.tested("endCollectEvents()",true);
+ }
+
+} // finish class _XDictionaryList
+
+
diff --git a/qadevOOo/tests/java/ifc/linguistic2/_XHyphenator.java b/qadevOOo/tests/java/ifc/linguistic2/_XHyphenator.java
new file mode 100644
index 000000000000..4752651e71f9
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/linguistic2/_XHyphenator.java
@@ -0,0 +1,111 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package ifc.linguistic2;
+
+import lib.MultiMethodTest;
+
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.lang.Locale;
+import com.sun.star.linguistic2.XHyphenatedWord;
+import com.sun.star.linguistic2.XHyphenator;
+import com.sun.star.linguistic2.XPossibleHyphens;
+
+/**
+* Testing <code>com.sun.star.linguistic2.XHyphenator</code>
+* interface methods:
+* <ul>
+* <li><code>hyphenate()</code></li>
+* <li><code>queryAlternativeSpelling()</code></li>
+* <li><code>createPossibleHyphens()</code></li>
+* </ul><p>
+* @see com.sun.star.linguistic2.XHyphenator
+*/
+public class _XHyphenator extends MultiMethodTest {
+
+ public XHyphenator oObj = null;
+
+ /**
+ * Test calls the method and checks returned value. <p>
+ * Has <b> OK </b> status if returned value isn't null. <p>
+ */
+ public void _hyphenate() {
+ boolean res = true;
+ PropertyValue[] Props = null;
+ try {
+ XHyphenatedWord result = oObj.hyphenate(
+ "wacker",new Locale("de","DE",""),(short)3,Props);
+ res &= (result != null);
+ } catch (com.sun.star.lang.IllegalArgumentException ex) {
+ log.println("Exception while checking 'hyphenate'");
+ res = false;
+ ex.printStackTrace(log);
+ }
+ tRes.tested("hyphenate()",res);
+ }
+
+ /**
+ * Test calls the method and checks returned value. <p>
+ * Has <b> OK </b> status if returned value isn't null. <p>
+ */
+ public void _queryAlternativeSpelling() {
+ boolean res = true;
+ PropertyValue[] Props = null;
+ try {
+ XHyphenatedWord result = oObj.queryAlternativeSpelling(
+ "wacker",new Locale("de","DE",""),(short)2,Props);
+ res &= (result != null);
+ } catch (com.sun.star.lang.IllegalArgumentException ex) {
+ log.println("Exception while checking 'queryAlternativeSpelling'");
+ res = false;
+ ex.printStackTrace(log);
+ }
+ tRes.tested("queryAlternativeSpelling()",res);
+ }
+
+ /**
+ * Test calls the method and checks returned value. <p>
+ * Has <b> OK </b> status if returned value isn't null. <p>
+ */
+ public void _createPossibleHyphens() {
+ boolean res = true;
+ PropertyValue[] Props = null;
+ try {
+ XPossibleHyphens result = oObj.createPossibleHyphens(
+ "wacker",new Locale("de","DE",""),Props);
+ res &= (result != null);
+ } catch (com.sun.star.lang.IllegalArgumentException ex) {
+ log.println("Exception while checking 'createPossibleHyphens'");
+ res = false;
+ ex.printStackTrace(log);
+ }
+ tRes.tested("createPossibleHyphens()",res);
+ }
+
+} // \u0422\u044B finish class XHyphenator
+
+
diff --git a/qadevOOo/tests/java/ifc/linguistic2/_XLinguServiceEventBroadcaster.java b/qadevOOo/tests/java/ifc/linguistic2/_XLinguServiceEventBroadcaster.java
new file mode 100644
index 000000000000..d799299db636
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/linguistic2/_XLinguServiceEventBroadcaster.java
@@ -0,0 +1,94 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package ifc.linguistic2;
+
+import lib.MultiMethodTest;
+
+import com.sun.star.lang.EventObject;
+import com.sun.star.linguistic2.LinguServiceEvent;
+import com.sun.star.linguistic2.XLinguServiceEventBroadcaster;
+import com.sun.star.linguistic2.XLinguServiceEventListener;
+
+/**
+* Testing <code>com.sun.star.linguistic2.XLinguServiceEventBroadcaster</code>
+* interface methods:
+* <ul>
+* <li><code>addLinguServiceEventListener()</code></li>
+* <li><code>removeLinguServiceEventListener()</code></li>
+* </ul><p>
+* @see com.sun.star.linguistic2.XLinguServiceEventBroadcaster
+*/
+public class _XLinguServiceEventBroadcaster extends MultiMethodTest {
+
+ public XLinguServiceEventBroadcaster oObj = null;
+
+ /**
+ * Class implements interface <code>XLinguServiceEventListener</code>
+ * for test method <code>addLinguServiceEventListener</code>.
+ * @see com.sun.star.linguistic2.XLinguServiceEventListener
+ */
+ public class MyLinguServiceEventListener implements
+ XLinguServiceEventListener {
+ public void disposing ( EventObject oEvent ) {
+ log.println("Listener has been disposed");
+ }
+ public void processLinguServiceEvent(LinguServiceEvent aServiceEvent) {
+ log.println("Listener called");
+ }
+
+ };
+
+ XLinguServiceEventListener listener = new MyLinguServiceEventListener();
+
+ /**
+ * Test calls the method and checks returned value. <p>
+ * Has <b> OK </b> status if returned value is true. <p>
+ */
+ public void _addLinguServiceEventListener() {
+ boolean res = true;
+
+ res = oObj.addLinguServiceEventListener(listener);
+
+ tRes.tested("addLinguServiceEventListener()",res);
+ }
+
+ /**
+ * Test calls the method and checks returned value. <p>
+ * Has <b> OK </b> status if returned value is true. <p>
+ */
+ public void _removeLinguServiceEventListener() {
+ boolean res = true;
+
+ res = oObj.removeLinguServiceEventListener(listener);
+
+ tRes.tested("removeLinguServiceEventListener()",res);
+ }
+
+} // finish class XLinguServiceEventBroadcaster
+
+
diff --git a/qadevOOo/tests/java/ifc/linguistic2/_XLinguServiceManager.java b/qadevOOo/tests/java/ifc/linguistic2/_XLinguServiceManager.java
new file mode 100644
index 000000000000..12dd56a3028f
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/linguistic2/_XLinguServiceManager.java
@@ -0,0 +1,185 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package ifc.linguistic2;
+
+import lib.MultiMethodTest;
+
+import com.sun.star.lang.EventObject;
+import com.sun.star.lang.Locale;
+import com.sun.star.linguistic2.LinguServiceEvent;
+import com.sun.star.linguistic2.XHyphenator;
+import com.sun.star.linguistic2.XLinguServiceEventListener;
+import com.sun.star.linguistic2.XLinguServiceManager;
+import com.sun.star.linguistic2.XSpellChecker;
+import com.sun.star.linguistic2.XThesaurus;
+
+/**
+*Testing <code>com.sun.star.linguistic2.XLinguServiceManager</code>
+* interface methods:
+* <ul>
+* <li><code>getSpellChecker()</code></li>
+* <li><code>getHyphenator()</code></li>
+* <li><code>getThesaurus()</code></li>
+* <li><code>addLinguServiceManagerListener()</code></li>
+* <li><code>removeLinguServiceManagerListener()</code></li>
+* <li><code>getAvailableServices()</code></li>
+* <li><code>setConfiguredServices()</code></li>
+* <li><code>getConfiguredServices()</code></li>
+* </ul> <p>
+*@see com.sun.star.linguistic2.XLinguServiceManager
+*/
+public class _XLinguServiceManager extends MultiMethodTest {
+
+ public XLinguServiceManager oObj = null;
+ boolean listenerCalled = false;
+
+ /**
+ * Class implements interface <code>XLinguServiceEventListener</code>
+ * for test method <code>addLinguServiceManagerListener</code>.
+ * @see com.sun.star.linguistic2.XLinguServiceEventListener
+ */
+ public class MyLinguServiceEventListener implements
+ XLinguServiceEventListener {
+ public void disposing ( EventObject oEvent ) {
+ log.println("Listener has been disposed");
+ }
+ public void processLinguServiceEvent(LinguServiceEvent aServiceEvent) {
+ listenerCalled = true;
+ log.println("Listener called");
+ }
+ };
+
+ XLinguServiceEventListener listener = new MyLinguServiceEventListener();
+
+ /**
+ * Test calls the method and checks returned value. <p>
+ * Has <b> OK </b> status if returned value isn't null. <p>
+ */
+ public void _getSpellChecker() {
+ XSpellChecker SC = oObj.getSpellChecker();
+ tRes.tested("getSpellChecker()", SC != null);
+ }
+
+ /**
+ * Test calls the method and checks returned value. <p>
+ * Has <b> OK </b> status if returned value isn't null. <p>
+ */
+ public void _getHyphenator() {
+ XHyphenator HN = oObj.getHyphenator();
+ tRes.tested("getHyphenator()", HN != null);
+ }
+
+ /**
+ * Test calls the method and checks returned value. <p>
+ * Has <b> OK </b> status if returned value isn't null. <p>
+ */
+ public void _getThesaurus() {
+ XThesaurus TS = oObj.getThesaurus();
+ tRes.tested("getThesaurus()", TS != null);
+ }
+
+ /**
+ * Test calls the method and checks returned value. <p>
+ * Has <b> OK </b> status if returned value is equal to true. <p>
+ */
+ public void _addLinguServiceManagerListener() {
+ boolean res = oObj.addLinguServiceManagerListener(listener);
+ tRes.tested("addLinguServiceManagerListener()", res);
+ }
+
+ /**
+ * Test calls the method and checks returned value. <p>
+ * Has <b> OK </b> status if returned value is equal to true. <p>
+ */
+ public void _removeLinguServiceManagerListener() {
+ boolean res = oObj.removeLinguServiceManagerListener(listener);
+ tRes.tested("removeLinguServiceManagerListener()",res);
+ }
+
+ /**
+ * Test calls the method and checks returned value. <p>
+ * Has <b> OK </b> status if length of returned array is
+ * greater than zero.<p>
+ */
+ public void _getAvailableServices() {
+ String[] services = oObj.getAvailableServices(
+ "com.sun.star.linguistic2.Hyphenator",
+ new Locale("en", "US", "") );
+ tRes.tested("getAvailableServices()", services.length > 0);
+ }
+
+ /**
+ * Test calls the method and checks returned value. <p>
+ * Has <b> OK </b> status if length of returned array is
+ * greater than zero.<p>
+ */
+ public void _getConfiguredServices() {
+ String[] services = oObj.getConfiguredServices(
+ "com.sun.star.linguistic2.Hyphenator",
+ new Locale("en", "US", "") );
+ tRes.tested("getConfiguredServices()", services.length > 0);
+ }
+
+ /**
+ * Test sets empty list of service, checks value returned
+ * by method <code>getConfiguredServices()</code> and all services
+ * restored finally. <p>
+ * Has <b> OK </b> status if length of obtained service list equal to zero.
+ * <p>The following method tests are to be completed successfully before :
+ * <ul>
+ * <li> <code> getConfiguredServices() </code></li>
+ * </ul>
+ */
+ public void _setConfiguredServices() {
+ requiredMethod("getConfiguredServices()");
+
+ String[] services = oObj.getConfiguredServices(
+ "com.sun.star.linguistic2.Hyphenator",new Locale("en","US",""));
+
+ String[] empty = new String[0];
+ oObj.setConfiguredServices(
+ "com.sun.star.linguistic2.Hyphenator",
+ new Locale("en", "US", ""),
+ empty );
+
+ String[] get = oObj.getConfiguredServices(
+ "com.sun.star.linguistic2.Hyphenator", new Locale("en","US",""));
+
+ boolean res = (get.length == 0);
+
+ oObj.setConfiguredServices(
+ "com.sun.star.linguistic2.Hyphenator",
+ new Locale("en", "US", ""),
+ services );
+
+ tRes.tested("setConfiguredServices()", res);
+ }
+
+} // finish class _XLinguServiceManager
+
+
diff --git a/qadevOOo/tests/java/ifc/linguistic2/_XSearchableDictionaryList.java b/qadevOOo/tests/java/ifc/linguistic2/_XSearchableDictionaryList.java
new file mode 100644
index 000000000000..ce12dc72522b
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/linguistic2/_XSearchableDictionaryList.java
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package ifc.linguistic2;
+
+import com.sun.star.lang.Locale;
+import com.sun.star.linguistic2.XDictionaryEntry;
+import com.sun.star.linguistic2.XSearchableDictionaryList;
+import lib.MultiMethodTest;
+
+/**
+* Testing <code>com.sun.star.linguistic2.XSearchableDictionaryList</code>
+* interface methods:
+* <ul>
+* <li><code>queryDictionaryEntry()</code></li>
+* </ul> <p>
+* @see com.sun.star.linguistic2.XSearchableDictionaryList
+*/
+public class _XSearchableDictionaryList extends MultiMethodTest {
+
+ public XSearchableDictionaryList oObj = null;
+
+ /**
+ * Test calls the method for negative dictionary and for positive dictionary
+ * and checks returned values. <p>
+ * Has <b> OK </b> status if returned values are not null. <p>
+ */
+ public void _queryDictionaryEntry() {
+ XDictionaryEntry aNegativEntry = oObj.queryDictionaryEntry("Negativ",
+ new Locale("en","US","WIN"),false,true);
+ if (aNegativEntry == null) {
+ log.println("'queryDictionary' didn't work for negative dictionaries");
+ } else {
+ log.println("'queryDictionary' works for negative dictionaries");
+ }
+ XDictionaryEntry aPositivEntry = oObj.queryDictionaryEntry("Positiv",
+ new Locale("en","US","WIN"),true,true);
+ if (aPositivEntry == null) {
+ log.println("'queryDictionary' didn't work for positive dictionaries");
+ } else {
+ log.println("'queryDictionary' works for positive dictionaries");
+ }
+ tRes.tested("queryDictionaryEntry()",(aNegativEntry != null) &&
+ (aPositivEntry != null) );
+ }
+
+} // finish class _XSearchableDictionaryList
+
+
diff --git a/qadevOOo/tests/java/ifc/linguistic2/_XSpellChecker.java b/qadevOOo/tests/java/ifc/linguistic2/_XSpellChecker.java
new file mode 100644
index 000000000000..47ad1d25e836
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/linguistic2/_XSpellChecker.java
@@ -0,0 +1,116 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package ifc.linguistic2;
+
+import lib.MultiMethodTest;
+
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.lang.Locale;
+import com.sun.star.linguistic2.XSpellAlternatives;
+import com.sun.star.linguistic2.XSpellChecker;
+import lib.Status;
+import lib.StatusException;
+
+/**
+* Testing <code>com.sun.star.linguistic2.XSpellChecker</code>
+* interface methods:
+* <ul>
+* <li><code>isValid()</code></li>
+* <li><code>spell()</code></li>
+* </ul><p>
+* @see com.sun.star.linguistic2.XSpellChecker
+*/
+public class _XSpellChecker extends MultiMethodTest {
+
+ public XSpellChecker oObj = null;
+ XSpellChecker alternative = null;
+
+ public void before() {
+ alternative = (XSpellChecker) tEnv.getObjRelation("AlternativeChecker");
+ if (alternative == null) throw new StatusException(Status.failed
+ ("Relation AlternativeChecker not found")) ;
+ }
+
+ /**
+ * Test calls the method for a correctly spelled word and
+ * for a uncorrectly spelled word and checks returned values. <p>
+ * Has <b> OK </b> status if returned value is equal to true in first case,
+ * if returned value is equal to false in second case and no exceptions
+ * were thrown. <p>
+ */
+ public void _isValid() {
+ boolean res = true;
+ try {
+ log.println("Checking 'original' Spellchecker");
+ PropertyValue[] empty = new PropertyValue[0] ;
+ res &= oObj.isValid("Sun", new Locale("en","US",""), empty);
+ res &= !oObj.isValid("Summersun", new Locale("en","US","") ,empty);
+ log.println("Result so far is - "+ (res ? "OK" : "failed"));
+ log.println("Checking alternative Spellchecker");
+ res &= alternative.isValid("Sun", new Locale("en","US",""), empty);
+ res &= !alternative.isValid("Summersun", new Locale("en","US","") ,empty);
+ } catch (com.sun.star.lang.IllegalArgumentException ex) {
+ log.println("Exception while checking 'isValid'");
+ res = false;
+ ex.printStackTrace(log);
+ }
+ tRes.tested("isValid()",res);
+ }
+
+ /**
+ * Test calls the method for a uncorrectly spelled word
+ * and checks returned values. <p>
+ * Has <b> OK </b> status if at least one spell alternative exists
+ * and no exceptions were thrown. <p>
+ */
+ public void _spell() {
+ boolean res = true;
+ try {
+ log.println("Checking 'original' Spellchecker");
+ PropertyValue[] empty = new PropertyValue[0] ;
+ XSpellAlternatives alt = oObj.spell(
+ "Summersun",new Locale("en","US",""),empty);
+ String alternatives = alt.getAlternatives()[0];
+ res = (alternatives != null);
+ log.println("Result so far is - "+ (res ? "OK" : "failed"));
+ log.println("Checking alternative Spellchecker");
+ alt =alternative.spell(
+ "Summersun",new Locale("en","US",""),empty);
+ alternatives = alt.getAlternatives()[0];
+ res &= (alternatives != null);
+ } catch (com.sun.star.lang.IllegalArgumentException ex) {
+ log.println("Exception while checking 'spell'");
+ res = false;
+ ex.printStackTrace(log);
+ }
+ tRes.tested("spell()",res);
+ }
+
+} // finish class MTest
+
+
diff --git a/qadevOOo/tests/java/ifc/linguistic2/_XSupportedLocales.java b/qadevOOo/tests/java/ifc/linguistic2/_XSupportedLocales.java
new file mode 100644
index 000000000000..1457bd76fd39
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/linguistic2/_XSupportedLocales.java
@@ -0,0 +1,89 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package ifc.linguistic2;
+
+import lib.MultiMethodTest;
+
+import com.sun.star.lang.Locale;
+import com.sun.star.linguistic2.XSupportedLocales;
+
+/**
+* Testing <code>com.sun.star.linguistic2.XSupportedLocales</code>
+* interface methods:
+* <ul>
+* <li><code>getLocales()</code></li>
+* <li><code>hasLocale()</code></li>
+* </ul> <p>
+* @see com.sun.star.linguistic2.XSupportedLocales
+*/
+public class _XSupportedLocales extends MultiMethodTest {
+
+ public XSupportedLocales oObj = null;
+ public static Locale[] locales = new Locale[0];
+
+ /**
+ * Test calls the method, stores returned value and checks it. <p>
+ * Has <b> OK </b> status if length of returned array isn't zero. <p>
+ */
+ public void _getLocales() {
+ locales = oObj.getLocales();
+ tRes.tested("getLocales()", locales.length > 0);
+ }
+
+ /**
+ * Test calls the method for every language from list of supported languages,
+ * calls the method for one unsupported language and checks
+ * all returned values. <p>
+ * Has <b> OK </b> status if all returned values for supported languages
+ * are equal to true and if returned value for unsupported language is equal
+ * to false. <p>
+ * The following method tests are to be completed successfully before :
+ * <ul>
+ * <li> <code> getLocales() </code> : to have list of
+ * all supported languages </li>
+ * </ul>
+ */
+ public void _hasLocale() {
+ requiredMethod("getLocales()");
+ boolean res = true;
+
+ // first check all available locales
+ for (int i=0; i< locales.length; i++) {
+ res &= oObj.hasLocale(locales[i]);
+ }
+
+ // now create a invalid locale
+ Locale invalid = new Locale("myLanguage","myCountry","");
+ res &= !oObj.hasLocale(invalid);
+
+ tRes.tested("hasLocale()", res);
+ }
+
+} // finish class XSupportedLocales
+
+
diff --git a/qadevOOo/tests/java/ifc/linguistic2/_XThesaurus.java b/qadevOOo/tests/java/ifc/linguistic2/_XThesaurus.java
new file mode 100644
index 000000000000..c8a9ffbafe8c
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/linguistic2/_XThesaurus.java
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package ifc.linguistic2;
+
+import lib.MultiMethodTest;
+
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.lang.Locale;
+import com.sun.star.linguistic2.XMeaning;
+import com.sun.star.linguistic2.XThesaurus;
+
+/**
+* Testing <code>com.sun.star.linguistic2.XThesaurus</code>
+* interface methods:
+* <ul>
+* <li><code>queryMeanings()</code></li>
+* </ul> <p>
+* @see com.sun.star.linguistic2.XThesaurus
+*/
+public class _XThesaurus extends MultiMethodTest {
+
+ public XThesaurus oObj = null;
+
+ /**
+ * Test calls the method for one of supported language and checks
+ * returned value. <p>
+ * Has <b> OK </b> status if returned array is not empty
+ * and no exceptions were thrown. <p>
+ */
+ public void _queryMeanings() {
+ boolean res = true;
+ try {
+ XMeaning[] mean = oObj.queryMeanings(
+ "survive",new Locale("en","US",""), new PropertyValue[0]);
+ res = (mean.length > 0);
+ } catch (com.sun.star.lang.IllegalArgumentException ex) {
+ log.println("Exception while checking 'queryMeanings'");
+ res = false;
+ ex.printStackTrace(log);
+ }
+ tRes.tested("queryMeanings()",res);
+ }
+
+
+} // finish class
+
+