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 ifc.sheet;
25 
26 import lib.MultiMethodTest;
27 import lib.Status;
28 import lib.StatusException;
29 
30 import com.sun.star.sheet.XDDELink;
31 
32 /**
33 * Testing <code>com.sun.star.sheet.XDDELink</code>
34 * interface methods :
35 * <ul>
36 *  <li><code> getApplication()</code></li>
37 *  <li><code> getTopic()</code></li>
38 *  <li><code> getItem()</code></li>
39 * </ul> <p>
40 * This test needs the following object relations :
41 * <ul>
42 *  <li> <code>'APPLICATION'</code> (of type <code>String</code>):
43 *   to have application name </li>
44 *  <li> <code>'ITEM'</code> (of type <code>String</code>):
45 *   to have DDE item </li>
46 *  <li> <code>'TOPIC'</code> (of type <code>String</code>):
47 *   to have DDE topic </li>
48 * <ul> <p>
49 * @see com.sun.star.sheet.XDDELink
50 */
51 public class _XDDELink extends MultiMethodTest {
52     public XDDELink oObj = null;
53 
54     /**
55     * Test calls the method and compares returned value to value obtained by
56     * relation <code>'APPLICATION'</code>. <p>
57     * Has <b> OK </b> status if values are equal. <p>
58     */
_getApplication()59     public void _getApplication(){
60         log.println("testing getApplication()");
61         boolean bResult = false;
62 
63         String oAppl = (String)tEnv.getObjRelation("APPLICATION");
64         if (oAppl == null) throw new StatusException(Status.failed
65             ("Relation 'APPLICATION' not found"));
66 
67         bResult = oAppl.equals(oObj.getApplication());
68         tRes.tested("getApplication()", bResult) ;
69     }
70 
71     /**
72     * Test calls the method and compares returned value to value obtained by
73     * relation <code>'ITEM'</code>. <p>
74     * Has <b> OK </b> status if values are equal. <p>
75     */
_getItem()76     public void _getItem(){
77         log.println("testing getItem()");
78         boolean bResult = false;
79         String sItem = oObj.getItem();
80 
81         String oItem = (String)tEnv.getObjRelation("ITEM");
82         if (oItem == null) throw new StatusException(Status.failed
83             ("Relation 'ITEM' not found"));
84 
85         bResult = oItem.equals(sItem);
86         tRes.tested("getItem()", bResult) ;
87     }
88 
89     /**
90     * Test calls the method and compares returned value to value obtained by
91     * relation <code>'TOPIC'</code>. <p>
92     * Has <b> OK </b> status if values are equal. <p>
93     */
_getTopic()94     public void _getTopic(){
95         log.println("testing getTopic()");
96         boolean bResult = false;
97         String sTopic = oObj.getTopic();
98 
99         String oTopic = (String)tEnv.getObjRelation("TOPIC");
100         if (oTopic == null) throw new StatusException(Status.failed
101             ("Relation 'TOPIC' not found"));
102 
103         bResult = oTopic.equals(sTopic);
104         tRes.tested("getTopic()", bResult) ;
105     }
106 }
107 
108