Update ooo320-m1
[ooovba.git] / qadevOOo / tests / java / ifc / sheet / _XCellRangeData.java
blob095d45d8543e12621bb6edb1b68506dcf26880dc
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: _XCellRangeData.java,v $
10 * $Revision: 1.5 $
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;
34 import util.ValueComparer;
36 import com.sun.star.sheet.XCellRangeData;
38 public class _XCellRangeData extends MultiMethodTest {
40 public XCellRangeData oObj = null;
41 private Object[][] maCRData = null;
43 /**
44 * Test calls the method
45 * state is OK if the resulting Object array
46 * isn't empty
48 public void _getDataArray() {
49 maCRData = oObj.getDataArray();
50 boolean bResult = (maCRData.length > 0);
51 tRes.tested("getDataArray()", bResult);
54 /**
55 * Test creates an Array and calls the method
56 * with this Array as argument
57 * Then the method getDataArray is called
58 * and the resulting Array is compared with the
59 * one formerly set.
61 public void _setDataArray() {
62 Object[][] newData = (Object[][]) tEnv.getObjRelation("NewData");
63 if (newData == null) {
64 newData = new Object[maCRData.length][maCRData[0].length];
65 for (int i=0; i<newData.length; i++) {
66 for (int j=0; j<newData[i].length; j++) {
67 newData[i][j] = new Double(10*i +j);
71 oObj.setDataArray(newData);
72 Object[][] oCRData = oObj.getDataArray();
73 boolean res = ValueComparer.equalValue(oCRData[0][0],newData[0][0]);
74 res &= ValueComparer.equalValue(oCRData[0][1],newData[0][1]);
75 res &= ValueComparer.equalValue(oCRData[1][0],newData[1][0]);
76 res &= ValueComparer.equalValue(oCRData[1][1],newData[1][1]);
77 // delete values
78 Object[][] emptyData = new Object[newData.length][newData[0].length];
79 for (int i=0; i<emptyData.length; i++) {
80 for (int j=0; j<emptyData[i].length; j++) {
81 emptyData[i][j] = new String();
84 oObj.setDataArray(emptyData);
85 tRes.tested("setDataArray()", res);