merge the formfield patch from ooo-build
[ooovba.git] / qadevOOo / tests / java / ifc / sheet / _XDataPilotTable.java
blobb4c1a1fef904e5e0a5142b5edf0a08b715c650df
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: _XDataPilotTable.java,v $
10 * $Revision: 1.4 $
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 lib.Status;
35 import lib.StatusException;
37 import com.sun.star.sheet.XDataPilotTable;
38 import com.sun.star.table.CellAddress;
39 import com.sun.star.table.CellRangeAddress;
40 import com.sun.star.table.XCell;
42 /**
43 * Testing <code>com.sun.star.sheet.XDataPilotTable</code>
44 * interface methods :
45 * <ul>
46 * <li><code> getOutputRange()</code></li>
47 * <li><code> refresh()</code></li>
48 * </ul> <p>
49 * This test needs the following object relations :
50 * <ul>
51 * <li> <code>'OUTPUTRANGE'</code> (of type <code>CellAddress</code>):
52 * to check value returned by method <code>getOutputRange()</code> </li>
53 * <li> <code>'CELLFORCHANGE'</code> (of type <code>XCell</code>):
54 * to check the method refresh(value of this cell will be changed)</li>
55 * <li> <code>'CELLFORCHECK'</code> (of type <code>XCell</code>):
56 * to check the method refresh (value of this cell must be changed after refresh
57 * call) </li><ul> <p>
58 * @see com.sun.star.sheet.XDataPilotTable
59 * @see com.sun.star.table.CellAddress
61 public class _XDataPilotTable extends MultiMethodTest {
63 public XDataPilotTable oObj = null;
64 XCell xCellForChange = null;
65 XCell xCellForCheck = null;
66 CellAddress OutputRange = null;
68 protected void before() {
69 xCellForChange = (XCell)tEnv.getObjRelation("CELLFORCHANGE");
70 xCellForCheck = (XCell)tEnv.getObjRelation("CELLFORCHECK");
71 OutputRange = (CellAddress)tEnv.getObjRelation("OUTPUTRANGE");
72 if (xCellForChange == null || OutputRange == null ||
73 xCellForCheck == null) {
74 throw new StatusException(Status.failed("Relation not found"));
77 /**
78 * Test calls the method and checks returned value using value obtained by
79 * object relation <code>'OUTPUTRANGE'</code>. <p>
80 * Has <b> OK </b> status if values are equal. <p>
82 public void _getOutputRange(){
83 boolean bResult = true;
84 CellRangeAddress objRange = oObj.getOutputRange();
85 bResult &= OutputRange.Sheet == objRange.Sheet;
86 bResult &= OutputRange.Row == objRange.StartRow;
87 bResult &= OutputRange.Column == objRange.StartColumn;
88 tRes.tested("getOutputRange()", bResult);
91 /**
92 * Test sets new value of the cell obtained by object relation
93 * 'CELLFORCHANGE', and checks value of the cell obtained by object
94 * relation 'CELLFORCHECK'.<p>
95 * Has <b>OK</b> status if value of the cell obtained by object relation
96 * 'CELLFORCHECK' is changed. <p>
98 public void _refresh(){
99 xCellForChange.setValue(5);
100 double oldData = xCellForCheck.getValue();
101 oObj.refresh();
102 double newData = xCellForCheck.getValue();
103 log.println("Old data:" + oldData + "; new data:" + newData);
105 tRes.tested("refresh()", oldData != newData);