Update ooo320-m1
[ooovba.git] / qadevOOo / tests / java / ifc / sheet / _XSheetOperation.java
blobaad5aee1eb40f8400070ef213f34f020a6c06421
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: _XSheetOperation.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;
35 import com.sun.star.sheet.CellFlags;
36 import com.sun.star.sheet.GeneralFunction;
37 import com.sun.star.sheet.XSheetOperation;
39 /**
40 * Testing <code>com.sun.star.sheet.XSheetOperation</code>
41 * interface methods :
42 * <ul>
43 * <li><code> computeFunction()</code></li>
44 * <li><code> clearContents()</code></li>
45 * </ul> <p>
46 * @see com.sun.star.sheet.XSheetOperation
48 public class _XSheetOperation extends MultiMethodTest {
50 public XSheetOperation oObj = null;
52 /**
53 * Test clears formula and value contents, calls the method
54 * <code>computeFunction</code> and checks returned value. <p>
55 * Has <b> OK </b> status if returned value is equal to zero
56 * and no exceptions were thrown. <p>
58 public void _clearContents() {
59 boolean result = true;
60 double resultVal = -1;
62 log.println("Testing clearContents() ...");
64 int allFlags;
65 allFlags = CellFlags.VALUE | CellFlags.FORMULA;
67 oObj.clearContents (allFlags) ;
69 try {
70 resultVal = oObj.computeFunction(GeneralFunction.SUM);
71 result &= (resultVal == 0.0) || (resultVal == 0);
72 } catch (com.sun.star.uno.Exception e) {
73 result &= false ;
74 log.println(
75 "Exception occured while checking results of method");
76 e.printStackTrace(log);
79 tRes.tested("clearContents()", result);
81 } // finished clearContents
83 /**
84 * Test calls the method and checks returned value. <p>
85 * Has <b> OK </b> status if returned value is equal or greate than zero
86 * and no exceptions were thrown. <p>
88 public void _computeFunction() {
90 log.println("Testing computeFunction() ...");
91 double resultVal = -1;
92 boolean result = true;
94 try {
95 resultVal = oObj.computeFunction (GeneralFunction.COUNT) ;
96 result = resultVal >= 0;
97 } catch (com.sun.star.uno.Exception e) {
98 result = false;
99 log.println("Exception occured in method computeFunction.");
100 e.printStackTrace(log);
103 tRes.tested("computeFunction()", result);
104 } // finished computeFunction
106 } // finished class _XSheetOperation