Update ooo320-m1
[ooovba.git] / qadevOOo / tests / java / ifc / sheet / _XLabelRanges.java
blobaacaf279ed7aa64d666ec2c65b25d6dc2dff5ee7
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: _XLabelRanges.java,v $
10 * $Revision: 1.4 $
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 ************************************************************************/
31 package ifc.sheet;
33 import lib.MultiMethodTest;
35 import com.sun.star.sheet.XLabelRanges;
36 import com.sun.star.table.CellRangeAddress;
38 /**
39 * Testing <code>com.sun.star.sheet.XLabelRanges</code>
40 * interface methods :
41 * <ul>
42 * <li><code> addNew()</code></li>
43 * <li><code> removeByIndex()</code></li>
44 * </ul> <p>
45 * @see com.sun.star.sheet.XLabelRanges
47 public class _XLabelRanges extends MultiMethodTest {
49 public XLabelRanges oObj = null;
51 /**
52 * Test calls the method and compares number of label range before method
53 * call and after. <p>
54 * Has <b>OK</b> status if number of label range before method call is less
55 * than after and no exceptions were thrown. <p>
57 public void _addNew() {
58 int anz = oObj.getCount();
59 oObj.addNew(
60 new CellRangeAddress((short)0, 1, 0, 1, 0),
61 new CellRangeAddress((short)0, 1, 1, 1, 6) );
62 tRes.tested("addNew()", anz < oObj.getCount());
65 /**
66 * Test removes an existent label range first and tries to remove
67 * non-existent label range. <p>
68 * Has <b> OK </b> status if number of range decreased by one after first
69 * call and exception was thrown in second. <p>
70 * The following method tests are to be completed successfully before :
71 * <ul>
72 * <li> <code> addNew() </code> : to have one label range at least </li>
73 * </ul>
75 public void _removeByIndex() {
76 requiredMethod("addNew()");
77 int anz = oObj.getCount();
78 log.println("First remove an existent LabelRange");
80 oObj.removeByIndex(anz - 1);
81 boolean result = (anz - 1 == oObj.getCount());
83 log.println("Remove a nonexistent LabelRange");
84 try {
85 oObj.removeByIndex(anz);
86 log.println("No Exception thrown while removing nonexisting "+
87 "LabelRange");
88 result &= false;
89 } catch (com.sun.star.uno.RuntimeException e) {
90 log.println("Expected exception thrown while removing "+
91 "nonexisting LabelRange: "+e);
92 result &= true;
95 tRes.tested("removeByIndex()", result);
98 } // finish class _XLabelRanges