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
;
26 //import lib.StatusException;
27 import lib
.TestParameters
;
28 // import share.LogWriter;
31 * Testing <code>com.sun.star.sheet.XDataPilotTable</code>
34 * <li><code> getOutputRange()</code></li>
35 * <li><code> refresh()</code></li>
37 * This test needs the following object relations :
39 * <li> <code>'OUTPUTRANGE'</code> (of type <code>CellAddress</code>):
40 * to check value returned by method <code>getOutputRange()</code> </li>
41 * <li> <code>'CELLFORCHANGE'</code> (of type <code>XCell</code>):
42 * to check the method refresh(value of this cell will be changed)</li>
43 * <li> <code>'CELLFORCHECK'</code> (of type <code>XCell</code>):
44 * to check the method refresh (value of this cell must be changed after refresh
46 * @see com.sun.star.sheet.XDataPilotTable
47 * @see com.sun.star.table.CellAddress
49 public class _XDataPilotTable
{
51 public XDataPilotTable oObj
= null;
52 XCell xCellForChange
= null;
53 XCell xCellForCheck
= null;
54 CellAddress OutputRange
= null;
60 private TestParameters param
= null;
65 // private LogWriter log = null;
68 * Constructor: gets the object to test, a logger and the test parameters
69 * @param xObj The test object
71 * @param param The test parameters
73 public _XDataPilotTable(XDataPilotTable xObj
/*,
74 LogWriter log*/, TestParameters param
) {
80 public boolean before() {
81 xCellForChange
= (XCell
)param
.get("CELLFORCHANGE");
82 xCellForCheck
= (XCell
)param
.get("CELLFORCHECK");
83 OutputRange
= (CellAddress
)param
.get("OUTPUTRANGE");
84 changeValue
= ((Integer
)param
.get("CHANGEVALUE")).intValue();
86 if (xCellForChange
== null || OutputRange
== null ||
87 xCellForCheck
== null) {
88 System
.out
.println("Relation not found");
94 * Test calls the method and checks returned value using value obtained by
95 * object relation <code>'OUTPUTRANGE'</code>. <p>
96 * Has <b> OK </b> status if values are equal. <p>
99 public boolean _getOutputRange(){
100 boolean bResult
= true;
101 CellRangeAddress objRange
= oObj
.getOutputRange();
102 bResult
&= OutputRange
.Sheet
== objRange
.Sheet
;
103 bResult
&= OutputRange
.Row
== objRange
.StartRow
;
104 bResult
&= OutputRange
.Column
== objRange
.StartColumn
;
109 * Test sets new value of the cell obtained by object relation
110 * 'CELLFORCHANGE', and checks value of the cell obtained by object
111 * relation 'CELLFORCHECK'.<p>
112 * Has <b>OK</b> status if value of the cell obtained by object relation
113 * 'CELLFORCHECK' is changed. <p>
116 public boolean _refresh(){
117 xCellForChange
.setValue(changeValue
);
118 double oldData
= xCellForCheck
.getValue();
120 double newData
= xCellForCheck
.getValue();
121 System
.out
.println("Old data:" + oldData
+ "; new data:" + newData
);
123 return oldData
!= newData
;