Avoid potential negative array index access to cached text.
[LibreOffice.git] / qadevOOo / tests / java / mod / _lnn / Hyphenator.java
blob40577a2115b7fde2cdcfca688cb2db604e9a318d
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 mod._lnn;
21 import java.io.PrintWriter;
23 import lib.TestCase;
24 import lib.TestEnvironment;
25 import lib.TestParameters;
27 import com.sun.star.beans.XPropertySet;
28 import com.sun.star.lang.XMultiServiceFactory;
29 import com.sun.star.uno.UnoRuntime;
30 import com.sun.star.uno.XInterface;
32 /**
33 * Test for object which is represented by service
34 * <code>com.sun.star.linguistic2.Hyphenator</code>. <p>
35 * Object implements the following interfaces :
36 * <ul>
37 * <li> <code>com::sun::star::lang::XInitialization</code></li>
38 * <li> <code>com::sun::star::linguistic2::XHyphenator</code></li>
39 * <li> <code>com::sun::star::lang::XComponent</code></li>
40 * <li> <code>com::sun::star::linguistic2::XSupportedLocales</code></li>
41 * <li> <code>com::sun::star::lang::XServiceInfo</code></li>
42 * <li> <code>com::sun::star::lang::XServiceDisplayName</code></li>
43 * <li> <code>com::sun::star::linguistic2::XLinguServiceEventBroadcaster</code></li>
44 * </ul> <p>
46 * This object test <b> is NOT </b> designed to be run in several
47 * threads concurrently.
49 * @see com.sun.star.lang.XInitialization
50 * @see com.sun.star.linguistic2.XHyphenator
51 * @see com.sun.star.lang.XComponent
52 * @see com.sun.star.linguistic2.XSupportedLocales
53 * @see com.sun.star.lang.XServiceInfo
54 * @see com.sun.star.lang.XServiceDisplayName
55 * @see com.sun.star.linguistic2.XLinguServiceEventBroadcaster
56 * @see ifc.lang._XInitialization
57 * @see ifc.linguistic2._XHyphenator
58 * @see ifc.lang._XComponent
59 * @see ifc.linguistic2._XSupportedLocales
60 * @see ifc.lang._XServiceInfo
61 * @see ifc.lang._XServiceDisplayName
62 * @see ifc.linguistic2._XLinguServiceEventBroadcaster
64 public class Hyphenator extends TestCase {
66 /**
67 * Creating a TestEnvironment for the interfaces to be tested.
68 * Creates an instance of the service
69 * <code>com.sun.star.linguistic2.Hyphenator</code>.
70 * Then a property for using new German rules for hyphenation
71 * is set.
73 @Override
74 protected TestEnvironment createTestEnvironment
75 (TestParameters Param, PrintWriter log) throws Exception {
77 XMultiServiceFactory xMSF = Param.getMSF();
78 XInterface oObj = (XInterface)xMSF.createInstance
79 ("com.sun.star.linguistic2.Hyphenator");
80 Object LP = xMSF.createInstance
81 ("com.sun.star.linguistic2.LinguProperties");
82 XPropertySet LProps = UnoRuntime.queryInterface(XPropertySet.class,LP);
83 LProps.setPropertyValue("IsGermanPreReform",Boolean.TRUE);
85 String Iname = util.utils.getImplName(oObj);
86 log.println("Implementation Name: "+Iname);
87 TestEnvironment tEnv = new TestEnvironment(oObj);
89 return tEnv;
93 } // finish class Hyphenator