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