1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
30 import lib
.MultiMethodTest
;
32 import com
.sun
.star
.container
.XEnumeration
;
33 import com
.sun
.star
.sheet
.XSheetCellRanges
;
34 import com
.sun
.star
.table
.CellRangeAddress
;
37 * Testing <code>com.sun.star.sheet.XSheetCellRanges</code>
40 * <li><code> getCells()</code></li>
41 * <li><code> getRangeAddressesAsString()</code></li>
42 * <li><code> getRangeAddresses()</code></li>
44 * @see com.sun.star.sheet.XSheetCellRanges
46 public class _XSheetCellRanges
extends MultiMethodTest
{
48 public XSheetCellRanges oObj
= null;
51 * Test calls the method, creates enumeration of returned value
52 * and checks that the enumeration has elements. <p>
53 * Has <b> OK </b> status if gained enumeration has elements. <p>
55 public void _getCells() {
56 log
.println("Testing getCells ...");
58 XEnumeration oEnum
= oObj
.getCells().createEnumeration();
59 boolean res
= oEnum
.hasMoreElements();
62 "The Enumeration gained via getCells() has no Elements");
64 tRes
.tested("getCells()", res
);
68 * Test calls the method and checks length of returned array. <p>
69 * Has <b> OK </b> status if length of returned array is greater than 2.<p>
71 public void _getRangeAddresses() {
72 log
.println("Testing getRangeAddresses ...");
73 CellRangeAddress
[] oRanges
= oObj
.getRangeAddresses();
74 int howmuch
= oRanges
.length
;
75 tRes
.tested("getRangeAddresses()", (howmuch
> 2) );
79 * Test calls the method and checks returned string. <p>
80 * Has <b> OK </b> status if returned string starts from 'Sheet'.<p>
82 public void _getRangeAddressesAsString() {
83 log
.println("Testing getRangeAddressesAsString ...");
84 String oRanges
= oObj
.getRangeAddressesAsString();
85 tRes
.tested("getRangeAddressesAsString()",oRanges
.indexOf("C1:D4")>0);
88 } // finished class _XSheetCellRanges