1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir package ifc.sheet; 29*cdf0e10cSrcweir 30*cdf0e10cSrcweir import lib.MultiMethodTest; 31*cdf0e10cSrcweir import util.ValueChanger; 32*cdf0e10cSrcweir 33*cdf0e10cSrcweir import com.sun.star.sheet.ConditionOperator; 34*cdf0e10cSrcweir import com.sun.star.sheet.XSheetCondition; 35*cdf0e10cSrcweir import com.sun.star.table.CellAddress; 36*cdf0e10cSrcweir 37*cdf0e10cSrcweir /** 38*cdf0e10cSrcweir * Testing <code>com.sun.star.sheet.XSheetCondition</code> 39*cdf0e10cSrcweir * interface methods : 40*cdf0e10cSrcweir * <ul> 41*cdf0e10cSrcweir * <li><code> getOperator()</code></li> 42*cdf0e10cSrcweir * <li><code> setOperator()</code></li> 43*cdf0e10cSrcweir * <li><code> getFormula1()</code></li> 44*cdf0e10cSrcweir * <li><code> setFormula1()</code></li> 45*cdf0e10cSrcweir * <li><code> getFormula2()</code></li> 46*cdf0e10cSrcweir * <li><code> setFormula2()</code></li> 47*cdf0e10cSrcweir * <li><code> getSourcePosition()</code></li> 48*cdf0e10cSrcweir * <li><code> setSourcePosition()</code></li> 49*cdf0e10cSrcweir * </ul> <p> 50*cdf0e10cSrcweir * @see com.sun.star.sheet.XSheetCondition 51*cdf0e10cSrcweir */ 52*cdf0e10cSrcweir public class _XSheetCondition extends MultiMethodTest { 53*cdf0e10cSrcweir public XSheetCondition oObj = null; 54*cdf0e10cSrcweir public String Formula1 = null; 55*cdf0e10cSrcweir public String Formula2 = null; 56*cdf0e10cSrcweir public ConditionOperator Operator = null; 57*cdf0e10cSrcweir public CellAddress SourcePosition = null; 58*cdf0e10cSrcweir 59*cdf0e10cSrcweir /** 60*cdf0e10cSrcweir * Test calls the method, checks and stores returned value. <p> 61*cdf0e10cSrcweir * Has <b> OK </b> status if returned vakue isn't null. <p> 62*cdf0e10cSrcweir */ 63*cdf0e10cSrcweir public void _getFormula1() { 64*cdf0e10cSrcweir Formula1 = oObj.getFormula1(); 65*cdf0e10cSrcweir tRes.tested("getFormula1()", Formula1 != null); 66*cdf0e10cSrcweir } 67*cdf0e10cSrcweir 68*cdf0e10cSrcweir /** 69*cdf0e10cSrcweir * Test calls the method, checks and stores returned value. <p> 70*cdf0e10cSrcweir * Has <b> OK </b> status if returned vakue isn't null. <p> 71*cdf0e10cSrcweir */ 72*cdf0e10cSrcweir public void _getFormula2() { 73*cdf0e10cSrcweir Formula2 = oObj.getFormula2(); 74*cdf0e10cSrcweir tRes.tested("getFormula2()", Formula2 != null); 75*cdf0e10cSrcweir } 76*cdf0e10cSrcweir 77*cdf0e10cSrcweir /** 78*cdf0e10cSrcweir * Test calls the method, checks and stores returned value. <p> 79*cdf0e10cSrcweir * Has <b> OK </b> status if returned vakue isn't null. <p> 80*cdf0e10cSrcweir */ 81*cdf0e10cSrcweir public void _getOperator() { 82*cdf0e10cSrcweir Operator = oObj.getOperator(); 83*cdf0e10cSrcweir tRes.tested("getOperator()", Operator != null); 84*cdf0e10cSrcweir } 85*cdf0e10cSrcweir 86*cdf0e10cSrcweir /** 87*cdf0e10cSrcweir * Test calls the method, checks and stores returned value. <p> 88*cdf0e10cSrcweir * Has <b> OK </b> status if returned vakue isn't null. <p> 89*cdf0e10cSrcweir */ 90*cdf0e10cSrcweir public void _getSourcePosition() { 91*cdf0e10cSrcweir SourcePosition = oObj.getSourcePosition(); 92*cdf0e10cSrcweir tRes.tested("getSourcePosition()", SourcePosition != null); 93*cdf0e10cSrcweir } 94*cdf0e10cSrcweir 95*cdf0e10cSrcweir /** 96*cdf0e10cSrcweir * Test sets new value of formula1, gets formula1 again and compares 97*cdf0e10cSrcweir * returned value with value that was stored by method 98*cdf0e10cSrcweir * <code>getFormula1()</code>. <p> 99*cdf0e10cSrcweir * Has <b> OK </b> status if values aren't equal. <p> 100*cdf0e10cSrcweir * The following method tests are to be completed successfully before : 101*cdf0e10cSrcweir * <ul> 102*cdf0e10cSrcweir * <li> <code> getFormula1() </code> : to have value of 'Formula1' </li> 103*cdf0e10cSrcweir * </ul> 104*cdf0e10cSrcweir */ 105*cdf0e10cSrcweir public void _setFormula1() { 106*cdf0e10cSrcweir requiredMethod("getFormula1()"); 107*cdf0e10cSrcweir oObj.setFormula1("$Sheet1.$C$" + Thread.activeCount()); 108*cdf0e10cSrcweir tRes.tested("setFormula1()", !Formula1.equals( oObj.getFormula1() ) ); 109*cdf0e10cSrcweir } 110*cdf0e10cSrcweir 111*cdf0e10cSrcweir /** 112*cdf0e10cSrcweir * Test sets new value of formula2, gets formula2 again and compares 113*cdf0e10cSrcweir * returned value with value that was stored by method 114*cdf0e10cSrcweir * <code>getFormula2()</code>. <p> 115*cdf0e10cSrcweir * Has <b> OK </b> status if values aren't equal. <p> 116*cdf0e10cSrcweir * The following method tests are to be completed successfully before : 117*cdf0e10cSrcweir * <ul> 118*cdf0e10cSrcweir * <li> <code> getFormula2() </code> : to have value of 'Formula2' </li> 119*cdf0e10cSrcweir * </ul> 120*cdf0e10cSrcweir */ 121*cdf0e10cSrcweir public void _setFormula2() { 122*cdf0e10cSrcweir requiredMethod("getFormula2()"); 123*cdf0e10cSrcweir oObj.setFormula2("$Sheet1.$A$" + Thread.activeCount()); 124*cdf0e10cSrcweir tRes.tested("setFormula2()", !Formula2.equals( oObj.getFormula2() ) ); 125*cdf0e10cSrcweir } 126*cdf0e10cSrcweir 127*cdf0e10cSrcweir /** 128*cdf0e10cSrcweir * Test sets new value of operator, gets operator and compares 129*cdf0e10cSrcweir * returned value with value that was set. <p> 130*cdf0e10cSrcweir * Has <b> OK </b> status if values aren't equal. <p> 131*cdf0e10cSrcweir */ 132*cdf0e10cSrcweir public void _setOperator() { 133*cdf0e10cSrcweir oObj.setOperator(ConditionOperator.BETWEEN); 134*cdf0e10cSrcweir tRes.tested("setOperator()", !Operator.equals( oObj.getOperator() ) ); 135*cdf0e10cSrcweir } 136*cdf0e10cSrcweir 137*cdf0e10cSrcweir /** 138*cdf0e10cSrcweir * Test change value that was stored by method 139*cdf0e10cSrcweir * <code>getSourcePosition()</code>, sets this new value, gets source 140*cdf0e10cSrcweir * position again and compares returned value with value that was set. <p> 141*cdf0e10cSrcweir * Has <b> OK </b> status if values aren't equal. <p> 142*cdf0e10cSrcweir * The following method tests are to be completed successfully before : 143*cdf0e10cSrcweir * <ul> 144*cdf0e10cSrcweir * <li> <code> getSourcePosition() </code> : to have value of source 145*cdf0e10cSrcweir * position </li> 146*cdf0e10cSrcweir * </ul> 147*cdf0e10cSrcweir */ 148*cdf0e10cSrcweir public void _setSourcePosition() { 149*cdf0e10cSrcweir requiredMethod("getSourcePosition()"); 150*cdf0e10cSrcweir oObj.setSourcePosition( 151*cdf0e10cSrcweir (CellAddress)ValueChanger.changePValue(SourcePosition)); 152*cdf0e10cSrcweir tRes.tested( 153*cdf0e10cSrcweir "setSourcePosition()", 154*cdf0e10cSrcweir !SourcePosition.equals( oObj.getSourcePosition() ) ); 155*cdf0e10cSrcweir } 156*cdf0e10cSrcweir 157*cdf0e10cSrcweir } // finish class _XSheetCondition 158*cdf0e10cSrcweir 159