2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 import lib
.MultiMethodTest
;
22 import util
.ValueComparer
;
24 import com
.sun
.star
.sheet
.XCellRangeData
;
26 public class _XCellRangeData
extends MultiMethodTest
{
28 public XCellRangeData oObj
= null;
29 private Object
[][] maCRData
= null;
32 * Test calls the method
33 * state is OK if the resulting Object array
36 public void _getDataArray() {
37 maCRData
= oObj
.getDataArray();
38 boolean bResult
= (maCRData
.length
> 0);
39 tRes
.tested("getDataArray()", bResult
);
43 * Test creates an Array and calls the method
44 * with this Array as argument
45 * Then the method getDataArray is called
46 * and the resulting Array is compared with the
49 public void _setDataArray() {
50 Object
[][] newData
= (Object
[][]) tEnv
.getObjRelation("NewData");
51 if (newData
== null) {
52 newData
= new Object
[maCRData
.length
][maCRData
[0].length
];
53 for (int i
=0; i
<newData
.length
; i
++) {
54 for (int j
=0; j
<newData
[i
].length
; j
++) {
55 newData
[i
][j
] = Double
.valueOf(10*i
+j
);
59 oObj
.setDataArray(newData
);
60 Object
[][] oCRData
= oObj
.getDataArray();
61 boolean res
= ValueComparer
.equalValue(oCRData
[0][0],newData
[0][0]);
62 res
&= ValueComparer
.equalValue(oCRData
[0][1],newData
[0][1]);
63 res
&= ValueComparer
.equalValue(oCRData
[1][0],newData
[1][0]);
64 res
&= ValueComparer
.equalValue(oCRData
[1][1],newData
[1][1]);
66 Object
[][] emptyData
= new Object
[newData
.length
][newData
[0].length
];
67 for (int i
=0; i
<emptyData
.length
; i
++) {
68 for (int j
=0; j
<emptyData
[i
].length
; j
++) {
72 oObj
.setDataArray(emptyData
);
73 tRes
.tested("setDataArray()", res
);