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 complex.imageManager;
25 
26 
27 
28 import com.sun.star.lang.XTypeProvider;
29 import com.sun.star.uno.Type;
30 import lib.TestParameters;
31 
32 /**
33 * Testing <code>com.sun.star.lang.XTypeProvider</code>
34 * interface methods :
35 * <ul>
36 *  <li><code> getTypes()</code></li>
37 *  <li><code> getImplementationId()</code></li>
38 * </ul> <p>
39 * Test is <b> NOT </b> multithread compilant. <p>
40 * @see com.sun.star.lang.XTypeProvider
41 */
42 public class _XTypeProvider {
43 
44 
45     TestParameters tEnv = null;
46     public static XTypeProvider oObj = null;
47     public static Type[] types = null;
48 
_XTypeProvider(TestParameters tEnv, XTypeProvider oObj)49     public _XTypeProvider(TestParameters tEnv, XTypeProvider oObj) {
50 
51         this.tEnv = tEnv;
52         this.oObj = oObj;
53     }
54 
55     /**
56     * Just calls the method.<p>
57     * Has <b>OK</b> status if no runtime exceptions occurred.
58     */
_getImplementationId()59     public boolean _getImplementationId() {
60         boolean result = true;
61         System.out.println("testing getImplementationId() ... ");
62 
63         System.out.println("The ImplementationId is "+oObj.getImplementationId());
64         result = true;
65 
66         return  result;
67 
68     } // end getImplementationId()
69 
70 
71     /**
72     * Calls the method and checks the return value.<p>
73     * Has <b>OK</b> status if one of the return value equals to the
74     * type <code>com.sun.star.lang.XTypeProvider</code>.
75     */
_getTypes()76     public boolean _getTypes() {
77         boolean result = false;
78         System.out.println("getting Types...");
79         types = oObj.getTypes();
80         for (int i=0;i<types.length;i++) {
81             int k = i+1;
82             System.out.println(k+". Type is "+types[i].toString());
83             if (types[i].toString().equals
84                     ("Type[com.sun.star.lang.XTypeProvider]")) {
85                 result = true;
86             }
87         }
88         if (!result) {
89             System.out.println("Component must provide Type "
90                 +"<com.sun.star.lang.XTypeProvider>");
91         }
92 
93         return  result;
94 
95     } // end getTypes()
96 
97 }
98 
99