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 import util.ValueComparer; 28 29 import com.sun.star.sheet.XCellRangeData; 30 31 public class _XCellRangeData extends MultiMethodTest { 32 33 public XCellRangeData oObj = null; 34 private Object[][] maCRData = null; 35 36 /** 37 * Test calls the method 38 * state is OK if the resulting Object array 39 * isn't empty 40 */ _getDataArray()41 public void _getDataArray() { 42 maCRData = oObj.getDataArray(); 43 boolean bResult = (maCRData.length > 0); 44 tRes.tested("getDataArray()", bResult); 45 } 46 47 /** 48 * Test creates an Array and calls the method 49 * with this Array as argument 50 * Then the method getDataArray is called 51 * and the resulting Array is compared with the 52 * one formerly set. 53 */ _setDataArray()54 public void _setDataArray() { 55 Object[][] newData = (Object[][]) tEnv.getObjRelation("NewData"); 56 if (newData == null) { 57 newData = new Object[maCRData.length][maCRData[0].length]; 58 for (int i=0; i<newData.length; i++) { 59 for (int j=0; j<newData[i].length; j++) { 60 newData[i][j] = new Double(10*i +j); 61 } 62 } 63 } 64 oObj.setDataArray(newData); 65 Object[][] oCRData = oObj.getDataArray(); 66 boolean res = ValueComparer.equalValue(oCRData[0][0],newData[0][0]); 67 res &= ValueComparer.equalValue(oCRData[0][1],newData[0][1]); 68 res &= ValueComparer.equalValue(oCRData[1][0],newData[1][0]); 69 res &= ValueComparer.equalValue(oCRData[1][1],newData[1][1]); 70 // delete values 71 Object[][] emptyData = new Object[newData.length][newData[0].length]; 72 for (int i=0; i<emptyData.length; i++) { 73 for (int j=0; j<emptyData[i].length; j++) { 74 emptyData[i][j] = new String(); 75 } 76 } 77 oObj.setDataArray(emptyData); 78 tRes.tested("setDataArray()", res); 79 } 80 } 81 82