Avoid potential negative array index access to cached text.
[LibreOffice.git] / sc / qa / complex / dataPilot / _XDataPilotTable.java
blob1c29a0f77cf2cc11158114dee36a3f649c8aa0ab
1 /*
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 .
19 package complex.dataPilot;
21 import com.sun.star.sheet.XDataPilotTable;
22 import com.sun.star.table.CellAddress;
23 import com.sun.star.table.CellRangeAddress;
24 import com.sun.star.table.XCell;
25 import lib.TestParameters;
27 /**
28 * Testing <code>com.sun.star.sheet.XDataPilotTable</code>
29 * interface methods :
30 * <ul>
31 * <li><code> getOutputRange()</code></li>
32 * <li><code> refresh()</code></li>
33 * </ul> <p>
34 * This test needs the following object relations :
35 * <ul>
36 * <li> <code>'OUTPUTRANGE'</code> (of type <code>CellAddress</code>):
37 * to check value returned by method <code>getOutputRange()</code> </li>
38 * <li> <code>'CELLFORCHANGE'</code> (of type <code>XCell</code>):
39 * to check the method refresh(value of this cell will be changed)</li>
40 * <li> <code>'CELLFORCHECK'</code> (of type <code>XCell</code>):
41 * to check the method refresh (value of this cell must be changed after refresh
42 * call) </li><ul> <p>
43 * @see com.sun.star.sheet.XDataPilotTable
44 * @see com.sun.star.table.CellAddress
46 public class _XDataPilotTable {
48 private final XDataPilotTable oObj;
49 private XCell xCellForChange = null;
50 private XCell xCellForCheck = null;
51 private CellAddress OutputRange = null;
53 /**
54 * The test parameters
56 private final TestParameters param;
58 /**
59 * Constructor: gets the object to test, a logger and the test parameters
60 * @param xObj The test object
62 * @param param The test parameters
64 public _XDataPilotTable(XDataPilotTable xObj/*,
65 LogWriter log*/, TestParameters param) {
66 oObj = xObj;
67 this.param = param;
70 public boolean before() {
71 xCellForChange = (XCell)param.get("CELLFORCHANGE");
72 xCellForCheck = (XCell)param.get("CELLFORCHECK");
73 OutputRange = (CellAddress)param.get("OUTPUTRANGE");
75 if (xCellForChange == null || OutputRange == null ||
76 xCellForCheck == null) {
77 System.out.println("Relation not found");
78 return false;
80 return true;
82 /**
83 * Test calls the method and checks returned value using value obtained by
84 * object relation <code>'OUTPUTRANGE'</code>. <p>
85 * Has <b> OK </b> status if values are equal. <p>
87 public boolean _getOutputRange(){
88 boolean bResult = true;
89 CellRangeAddress objRange = oObj.getOutputRange();
90 bResult &= OutputRange.Sheet == objRange.Sheet;
91 bResult &= OutputRange.Row == objRange.StartRow;
92 bResult &= OutputRange.Column == objRange.StartColumn;
93 return bResult;