1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 package ifc.sheet; 25 26 import lib.MultiMethodTest; 27 import util.ValueChanger; 28 29 import com.sun.star.sheet.ConditionOperator; 30 import com.sun.star.sheet.XSheetCondition; 31 import com.sun.star.table.CellAddress; 32 33 /** 34 * Testing <code>com.sun.star.sheet.XSheetCondition</code> 35 * interface methods : 36 * <ul> 37 * <li><code> getOperator()</code></li> 38 * <li><code> setOperator()</code></li> 39 * <li><code> getFormula1()</code></li> 40 * <li><code> setFormula1()</code></li> 41 * <li><code> getFormula2()</code></li> 42 * <li><code> setFormula2()</code></li> 43 * <li><code> getSourcePosition()</code></li> 44 * <li><code> setSourcePosition()</code></li> 45 * </ul> <p> 46 * @see com.sun.star.sheet.XSheetCondition 47 */ 48 public class _XSheetCondition extends MultiMethodTest { 49 public XSheetCondition oObj = null; 50 public String Formula1 = null; 51 public String Formula2 = null; 52 public ConditionOperator Operator = null; 53 public CellAddress SourcePosition = null; 54 55 /** 56 * Test calls the method, checks and stores returned value. <p> 57 * Has <b> OK </b> status if returned vakue isn't null. <p> 58 */ _getFormula1()59 public void _getFormula1() { 60 Formula1 = oObj.getFormula1(); 61 tRes.tested("getFormula1()", Formula1 != null); 62 } 63 64 /** 65 * Test calls the method, checks and stores returned value. <p> 66 * Has <b> OK </b> status if returned vakue isn't null. <p> 67 */ _getFormula2()68 public void _getFormula2() { 69 Formula2 = oObj.getFormula2(); 70 tRes.tested("getFormula2()", Formula2 != null); 71 } 72 73 /** 74 * Test calls the method, checks and stores returned value. <p> 75 * Has <b> OK </b> status if returned vakue isn't null. <p> 76 */ _getOperator()77 public void _getOperator() { 78 Operator = oObj.getOperator(); 79 tRes.tested("getOperator()", Operator != null); 80 } 81 82 /** 83 * Test calls the method, checks and stores returned value. <p> 84 * Has <b> OK </b> status if returned vakue isn't null. <p> 85 */ _getSourcePosition()86 public void _getSourcePosition() { 87 SourcePosition = oObj.getSourcePosition(); 88 tRes.tested("getSourcePosition()", SourcePosition != null); 89 } 90 91 /** 92 * Test sets new value of formula1, gets formula1 again and compares 93 * returned value with value that was stored by method 94 * <code>getFormula1()</code>. <p> 95 * Has <b> OK </b> status if values aren't equal. <p> 96 * The following method tests are to be completed successfully before : 97 * <ul> 98 * <li> <code> getFormula1() </code> : to have value of 'Formula1' </li> 99 * </ul> 100 */ _setFormula1()101 public void _setFormula1() { 102 requiredMethod("getFormula1()"); 103 oObj.setFormula1("$Sheet1.$C$" + Thread.activeCount()); 104 tRes.tested("setFormula1()", !Formula1.equals( oObj.getFormula1() ) ); 105 } 106 107 /** 108 * Test sets new value of formula2, gets formula2 again and compares 109 * returned value with value that was stored by method 110 * <code>getFormula2()</code>. <p> 111 * Has <b> OK </b> status if values aren't equal. <p> 112 * The following method tests are to be completed successfully before : 113 * <ul> 114 * <li> <code> getFormula2() </code> : to have value of 'Formula2' </li> 115 * </ul> 116 */ _setFormula2()117 public void _setFormula2() { 118 requiredMethod("getFormula2()"); 119 oObj.setFormula2("$Sheet1.$A$" + Thread.activeCount()); 120 tRes.tested("setFormula2()", !Formula2.equals( oObj.getFormula2() ) ); 121 } 122 123 /** 124 * Test sets new value of operator, gets operator and compares 125 * returned value with value that was set. <p> 126 * Has <b> OK </b> status if values aren't equal. <p> 127 */ _setOperator()128 public void _setOperator() { 129 oObj.setOperator(ConditionOperator.BETWEEN); 130 tRes.tested("setOperator()", !Operator.equals( oObj.getOperator() ) ); 131 } 132 133 /** 134 * Test change value that was stored by method 135 * <code>getSourcePosition()</code>, sets this new value, gets source 136 * position again and compares returned value with value that was set. <p> 137 * Has <b> OK </b> status if values aren't equal. <p> 138 * The following method tests are to be completed successfully before : 139 * <ul> 140 * <li> <code> getSourcePosition() </code> : to have value of source 141 * position </li> 142 * </ul> 143 */ _setSourcePosition()144 public void _setSourcePosition() { 145 requiredMethod("getSourcePosition()"); 146 oObj.setSourcePosition( 147 (CellAddress)ValueChanger.changePValue(SourcePosition)); 148 tRes.tested( 149 "setSourcePosition()", 150 !SourcePosition.equals( oObj.getSourcePosition() ) ); 151 } 152 153 } // finish class _XSheetCondition 154 155