1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 package mod._sw;
25 
26 import java.io.PrintWriter;
27 
28 import lib.StatusException;
29 import lib.TestCase;
30 import lib.TestEnvironment;
31 import lib.TestParameters;
32 
33 import com.sun.star.lang.XMultiServiceFactory;
34 import com.sun.star.text.XAutoTextContainer;
35 import com.sun.star.uno.UnoRuntime;
36 
37 /**
38 * Test for object which is represented by service
39 * <code>com.sun.star.text.AutoTextContainer</code>.<p>
40 * Object implements the following interfaces :
41 * <ul>
42 *  <li> <code>com::sun::star::container::XNameAccess</code></li>
43 *  <li> <code>com::sun::star::container::XElementAccess</code></li>
44 *  <li> <code>com::sun::star::text::XAutoTextContainer</code></li>
45 * </ul>
46 * @see com.sun.star.container.XNameAccess
47 * @see com.sun.star.container.XElementAccess
48 * @see com.sun.star.text.XAutoTextContainer
49 * @see com.sun.star.text.AutoTextContainer
50 * @see ifc.container._XNameAccess
51 * @see ifc.container._XElementAccess
52 * @see ifc.text._XAutoTextContainer
53 */
54 public class SwXAutoTextContainer extends TestCase {
55 
56     /**
57     * Creating a Testenvironment for the interfaces to be tested.
58     * Creates an instance of the service
59     * <code>com.sun.star.text.AutoTextContainer</code>.<p>
60     */
createTestEnvironment( TestParameters Param, PrintWriter log )61     public synchronized TestEnvironment createTestEnvironment(
62             TestParameters Param, PrintWriter log ) throws StatusException {
63         XAutoTextContainer  oContainer = null;
64 
65         // creation of testobject here
66         // first we write what we are intend to do to log file
67         log.println("creating a AutoTextContainer");
68         try {
69             XMultiServiceFactory myMSF = (XMultiServiceFactory)Param.getMSF();
70             Object oInst = myMSF.createInstance
71                 ("com.sun.star.text.AutoTextContainer");
72             oContainer = (XAutoTextContainer)UnoRuntime.queryInterface
73                 (XAutoTextContainer.class,oInst);
74         } catch (com.sun.star.uno.Exception e) {
75             e.printStackTrace(log);
76             throw new StatusException("Couldn't create AutoTextContainer", e);
77         }
78 
79         TestEnvironment tEnv = new TestEnvironment(oContainer);
80 
81         return tEnv;
82     }
83 
84 }    // finish class SwXAutoTextcontainer
85 
86