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 .
21 import lib
.MultiMethodTest
;
22 import util
.ValueChanger
;
24 import com
.sun
.star
.sheet
.ConditionOperator
;
25 import com
.sun
.star
.sheet
.XSheetCondition
;
26 import com
.sun
.star
.table
.CellAddress
;
29 * Testing <code>com.sun.star.sheet.XSheetCondition</code>
32 * <li><code> getOperator()</code></li>
33 * <li><code> setOperator()</code></li>
34 * <li><code> getFormula1()</code></li>
35 * <li><code> setFormula1()</code></li>
36 * <li><code> getFormula2()</code></li>
37 * <li><code> setFormula2()</code></li>
38 * <li><code> getSourcePosition()</code></li>
39 * <li><code> setSourcePosition()</code></li>
41 * @see com.sun.star.sheet.XSheetCondition
43 public class _XSheetCondition
extends MultiMethodTest
{
44 public XSheetCondition oObj
= null;
45 public String Formula1
= null;
46 public String Formula2
= null;
47 public ConditionOperator Operator
= null;
48 public CellAddress SourcePosition
= null;
51 * Test calls the method, checks and stores returned value. <p>
52 * Has <b> OK </b> status if returned vakue isn't null. <p>
54 public void _getFormula1() {
55 Formula1
= oObj
.getFormula1();
56 tRes
.tested("getFormula1()", Formula1
!= null);
60 * Test calls the method, checks and stores returned value. <p>
61 * Has <b> OK </b> status if returned vakue isn't null. <p>
63 public void _getFormula2() {
64 Formula2
= oObj
.getFormula2();
65 tRes
.tested("getFormula2()", Formula2
!= null);
69 * Test calls the method, checks and stores returned value. <p>
70 * Has <b> OK </b> status if returned vakue isn't null. <p>
72 public void _getOperator() {
73 Operator
= oObj
.getOperator();
74 tRes
.tested("getOperator()", Operator
!= null);
78 * Test calls the method, checks and stores returned value. <p>
79 * Has <b> OK </b> status if returned vakue isn't null. <p>
81 public void _getSourcePosition() {
82 SourcePosition
= oObj
.getSourcePosition();
83 tRes
.tested("getSourcePosition()", SourcePosition
!= null);
87 * Test sets new value of formula1, gets formula1 again and compares
88 * returned value with value that was stored by method
89 * <code>getFormula1()</code>. <p>
90 * Has <b> OK </b> status if values aren't equal. <p>
91 * The following method tests are to be completed successfully before :
93 * <li> <code> getFormula1() </code> : to have value of 'Formula1' </li>
96 public void _setFormula1() {
97 requiredMethod("getFormula1()");
98 oObj
.setFormula1("$Sheet1.$C$" + Thread
.activeCount());
99 tRes
.tested("setFormula1()", !Formula1
.equals( oObj
.getFormula1() ) );
103 * Test sets new value of formula2, gets formula2 again and compares
104 * returned value with value that was stored by method
105 * <code>getFormula2()</code>. <p>
106 * Has <b> OK </b> status if values aren't equal. <p>
107 * The following method tests are to be completed successfully before :
109 * <li> <code> getFormula2() </code> : to have value of 'Formula2' </li>
112 public void _setFormula2() {
113 requiredMethod("getFormula2()");
114 oObj
.setFormula2("$Sheet1.$A$" + Thread
.activeCount());
115 tRes
.tested("setFormula2()", !Formula2
.equals( oObj
.getFormula2() ) );
119 * Test sets new value of operator, gets operator and compares
120 * returned value with value that was set. <p>
121 * Has <b> OK </b> status if values aren't equal. <p>
123 public void _setOperator() {
124 oObj
.setOperator(ConditionOperator
.BETWEEN
);
125 tRes
.tested("setOperator()", !Operator
.equals( oObj
.getOperator() ) );
129 * Test change value that was stored by method
130 * <code>getSourcePosition()</code>, sets this new value, gets source
131 * position again and compares returned value with value that was set. <p>
132 * Has <b> OK </b> status if values aren't equal. <p>
133 * The following method tests are to be completed successfully before :
135 * <li> <code> getSourcePosition() </code> : to have value of source
139 public void _setSourcePosition() {
140 requiredMethod("getSourcePosition()");
141 oObj
.setSourcePosition(
142 (CellAddress
)ValueChanger
.changePValue(SourcePosition
));
144 "setSourcePosition()",
145 !SourcePosition
.equals( oObj
.getSourcePosition() ) );
148 } // finish class _XSheetCondition