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: _XAreaLinks.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 com
.sun
.star
.sheet
.XAreaLinks
;
34 import com
.sun
.star
.table
.CellAddress
;
35 import lib
.MultiMethodTest
;
38 * Testing <code>com.sun.star.sheet.XAreaLinks</code>
41 * <li><code> insertAtPosition()</code></li>
42 * <li><code> removeByIndex()</code></li>
44 * Test is <b> NOT </b> multithread compilant. <p>
45 * @see com.sun.star.sheet.XAreaLinks
47 public class _XAreaLinks
extends MultiMethodTest
{
49 public XAreaLinks oObj
= null;
52 * Inserts a new link into collection. Checks number of links
53 * before and after method call. <p>
54 * Has <b>OK</b> status if after method call number of
55 * links increased by 1.
57 public void _insertAtPosition(){
58 boolean bResult
= true ;
61 cnt
= oObj
.getCount() ;
62 CellAddress addr
= new CellAddress ((short) 1,2,3) ;
63 String aSourceArea
= util
.utils
.getFullTestURL("calcshapes.sxc");
64 oObj
.insertAtPosition (addr
, aSourceArea
, "a2:b5", "", "") ;
67 int new_cnt
= oObj
.getCount() ;
69 if (cnt
+ 1 != new_cnt
) {
71 log
.println("Number of links before insertAtPosition() call was " + cnt
+
72 ", after call is " + new_cnt
) ;
76 tRes
.tested("insertAtPosition()", bResult
) ;
81 * Removes a link from collection. Checks number of links
82 * before and after method call. <p>
83 * Has <b>OK</b> status if after method call number of
84 * links decreases by 1. <p>
85 * The following method tests are to be completed successfully before :
87 * <li> <code> insertAtPosition </code> : to have at least one link. </li>
90 public void _removeByIndex(){
91 requiredMethod("insertAtPosition()") ;
93 boolean bResult
= true ;
96 lcnt
= oObj
.getCount() ;
97 oObj
.removeByIndex(0) ;
99 int new_lcnt
= oObj
.getCount() ;
100 if (lcnt
- 1 != new_lcnt
) {
102 log
.println(" # Number of links before removeByIndex() call was " +
103 lcnt
+ ", after call is " + new_lcnt
) ;
105 tRes
.tested("removeByIndex()", bResult
) ;