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 .
21 import lib
.MultiMethodTest
;
23 import com
.sun
.star
.sheet
.XLabelRanges
;
24 import com
.sun
.star
.table
.CellRangeAddress
;
27 * Testing <code>com.sun.star.sheet.XLabelRanges</code>
30 * <li><code> addNew()</code></li>
31 * <li><code> removeByIndex()</code></li>
33 * @see com.sun.star.sheet.XLabelRanges
35 public class _XLabelRanges
extends MultiMethodTest
{
37 public XLabelRanges oObj
= null;
40 * Test calls the method and compares number of label range before method
42 * Has <b>OK</b> status if number of label range before method call is less
43 * than after and no exceptions were thrown. <p>
45 public void _addNew() {
46 int anz
= oObj
.getCount();
48 new CellRangeAddress((short)0, 1, 0, 1, 0),
49 new CellRangeAddress((short)0, 1, 1, 1, 6) );
50 tRes
.tested("addNew()", anz
< oObj
.getCount());
54 * Test removes an existent label range first and tries to remove
55 * non-existent label range. <p>
56 * Has <b> OK </b> status if number of range decreased by one after first
57 * call and exception was thrown in second. <p>
58 * The following method tests are to be completed successfully before :
60 * <li> <code> addNew() </code> : to have one label range at least </li>
63 public void _removeByIndex() {
64 requiredMethod("addNew()");
65 int anz
= oObj
.getCount();
66 log
.println("First remove an existent LabelRange");
68 oObj
.removeByIndex(anz
- 1);
69 boolean result
= (anz
- 1 == oObj
.getCount());
71 log
.println("Remove a nonexistent LabelRange");
73 oObj
.removeByIndex(anz
);
74 log
.println("No Exception thrown while removing nonexisting "+
77 } catch (com
.sun
.star
.uno
.RuntimeException e
) {
78 log
.println("Expected exception thrown while removing "+
79 "nonexisting LabelRange: "+e
);
83 tRes
.tested("removeByIndex()", result
);
86 } // finish class _XLabelRanges