1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 package ifc.sheet; 25 26 import lib.MultiMethodTest; 27 28 import com.sun.star.container.XEnumeration; 29 import com.sun.star.sheet.XSheetCellRanges; 30 import com.sun.star.table.CellRangeAddress; 31 32 /** 33 * Testing <code>com.sun.star.sheet.XSheetCellRanges</code> 34 * interface methods : 35 * <ul> 36 * <li><code> getCells()</code></li> 37 * <li><code> getRangeAddressesAsString()</code></li> 38 * <li><code> getRangeAddresses()</code></li> 39 * </ul> <p> 40 * @see com.sun.star.sheet.XSheetCellRanges 41 */ 42 public class _XSheetCellRanges extends MultiMethodTest{ 43 44 public XSheetCellRanges oObj = null; 45 46 /** 47 * Test calls the method, creates enumeration of returned value 48 * and checks that the enumeration has elements. <p> 49 * Has <b> OK </b> status if gained enumeration has elements. <p> 50 */ _getCells()51 public void _getCells() { 52 log.println("Testing getCells ..."); 53 54 XEnumeration oEnum = oObj.getCells().createEnumeration(); 55 boolean res = oEnum.hasMoreElements(); 56 if (!res) { 57 log.println( 58 "The Enumeration gained via getCells() has no Elements"); 59 } 60 tRes.tested("getCells()", res); 61 } 62 63 /** 64 * Test calls the method and checks length of returned array. <p> 65 * Has <b> OK </b> status if length of returned array is greater than 2.<p> 66 */ _getRangeAddresses()67 public void _getRangeAddresses() { 68 log.println("Testing getRangeAddresses ..."); 69 CellRangeAddress[] oRanges = oObj.getRangeAddresses(); 70 int howmuch = oRanges.length; 71 tRes.tested("getRangeAddresses()", (howmuch > 2) ); 72 } 73 74 /** 75 * Test calls the method and checks returned string. <p> 76 * Has <b> OK </b> status if returned string starts from 'Sheet'.<p> 77 */ _getRangeAddressesAsString()78 public void _getRangeAddressesAsString() { 79 log.println("Testing getRangeAddressesAsString ..."); 80 String oRanges = oObj.getRangeAddressesAsString(); 81 tRes.tested("getRangeAddressesAsString()",oRanges.indexOf("C1:D4")>0); 82 } 83 84 } // finished class _XSheetCellRanges 85 86