Branch libreoffice-5-0-4
[LibreOffice.git] / qadevOOo / tests / java / ifc / sheet / _XAreaLinks.java
blob07b64b6a0b189575bbc854dc39e4cd7d0e2ef3c8
1 /*
2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 package ifc.sheet;
21 import com.sun.star.sheet.XAreaLinks;
22 import com.sun.star.table.CellAddress;
23 import lib.MultiMethodTest;
25 /**
26 * Testing <code>com.sun.star.sheet.XAreaLinks</code>
27 * interface methods :
28 * <ul>
29 * <li><code> insertAtPosition()</code></li>
30 * <li><code> removeByIndex()</code></li>
31 * </ul> <p>
32 * Test is <b> NOT </b> multithread compliant. <p>
33 * @see com.sun.star.sheet.XAreaLinks
35 public class _XAreaLinks extends MultiMethodTest {
37 public XAreaLinks oObj = null;
39 /**
40 * Inserts a new link into collection. Checks number of links
41 * before and after method call. <p>
42 * Has <b>OK</b> status if after method call number of
43 * links increased by 1.
45 public void _insertAtPosition(){
46 boolean bResult = true ;
47 int cnt = 0;
49 cnt = oObj.getCount() ;
50 CellAddress addr = new CellAddress ((short) 1,2,3) ;
51 String aSourceArea = util.utils.getFullTestURL("calcshapes.sxc");
52 oObj.insertAtPosition (addr, aSourceArea, "a2:b5", "", "") ;
54 if (bResult) {
55 int new_cnt = oObj.getCount() ;
57 if (cnt + 1 != new_cnt) {
58 bResult = false ;
59 log.println("Number of links before insertAtPosition() call was " + cnt +
60 ", after call is " + new_cnt) ;
64 tRes.tested("insertAtPosition()", bResult) ;
68 /**
69 * Removes a link from collection. Checks number of links
70 * before and after method call. <p>
71 * Has <b>OK</b> status if after method call number of
72 * links decreases by 1. <p>
73 * The following method tests are to be completed successfully before :
74 * <ul>
75 * <li> <code> insertAtPosition </code> : to have at least one link. </li>
76 * </ul>
78 public void _removeByIndex(){
79 requiredMethod("insertAtPosition()") ;
81 boolean bResult = true ;
82 int lcnt = 0;
84 lcnt = oObj.getCount() ;
85 oObj.removeByIndex(0) ;
87 int new_lcnt = oObj.getCount() ;
88 if (lcnt - 1 != new_lcnt) {
89 bResult = false ;
90 log.println(" # Number of links before removeByIndex() call was " +
91 lcnt + ", after call is " + new_lcnt) ;
93 tRes.tested("removeByIndex()", bResult) ;
96 } //EOC _XAreaLinks