1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: _XDDELink.java,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
33 import lib
.MultiMethodTest
;
35 import lib
.StatusException
;
37 import com
.sun
.star
.sheet
.XDDELink
;
40 * Testing <code>com.sun.star.sheet.XDDELink</code>
43 * <li><code> getApplication()</code></li>
44 * <li><code> getTopic()</code></li>
45 * <li><code> getItem()</code></li>
47 * This test needs the following object relations :
49 * <li> <code>'APPLICATION'</code> (of type <code>String</code>):
50 * to have application name </li>
51 * <li> <code>'ITEM'</code> (of type <code>String</code>):
52 * to have DDE item </li>
53 * <li> <code>'TOPIC'</code> (of type <code>String</code>):
54 * to have DDE topic </li>
56 * @see com.sun.star.sheet.XDDELink
58 public class _XDDELink
extends MultiMethodTest
{
59 public XDDELink oObj
= null;
62 * Test calls the method and compares returned value to value obtained by
63 * relation <code>'APPLICATION'</code>. <p>
64 * Has <b> OK </b> status if values are equal. <p>
66 public void _getApplication(){
67 log
.println("testing getApplication()");
68 boolean bResult
= false;
70 String oAppl
= (String
)tEnv
.getObjRelation("APPLICATION");
71 if (oAppl
== null) throw new StatusException(Status
.failed
72 ("Relation 'APPLICATION' not found"));
74 bResult
= oAppl
.equals(oObj
.getApplication());
75 tRes
.tested("getApplication()", bResult
) ;
79 * Test calls the method and compares returned value to value obtained by
80 * relation <code>'ITEM'</code>. <p>
81 * Has <b> OK </b> status if values are equal. <p>
83 public void _getItem(){
84 log
.println("testing getItem()");
85 boolean bResult
= false;
86 String sItem
= oObj
.getItem();
88 String oItem
= (String
)tEnv
.getObjRelation("ITEM");
89 if (oItem
== null) throw new StatusException(Status
.failed
90 ("Relation 'ITEM' not found"));
92 bResult
= oItem
.equals(sItem
);
93 tRes
.tested("getItem()", bResult
) ;
97 * Test calls the method and compares returned value to value obtained by
98 * relation <code>'TOPIC'</code>. <p>
99 * Has <b> OK </b> status if values are equal. <p>
101 public void _getTopic(){
102 log
.println("testing getTopic()");
103 boolean bResult
= false;
104 String sTopic
= oObj
.getTopic();
106 String oTopic
= (String
)tEnv
.getObjRelation("TOPIC");
107 if (oTopic
== null) throw new StatusException(Status
.failed
108 ("Relation 'TOPIC' not found"));
110 bResult
= oTopic
.equals(sTopic
);
111 tRes
.tested("getTopic()", bResult
) ;