1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
30 import lib
.MultiMethodTest
;
32 import com
.sun
.star
.sheet
.CellFlags
;
33 import com
.sun
.star
.sheet
.GeneralFunction
;
34 import com
.sun
.star
.sheet
.XSheetOperation
;
37 * Testing <code>com.sun.star.sheet.XSheetOperation</code>
40 * <li><code> computeFunction()</code></li>
41 * <li><code> clearContents()</code></li>
43 * @see com.sun.star.sheet.XSheetOperation
45 public class _XSheetOperation
extends MultiMethodTest
{
47 public XSheetOperation oObj
= null;
50 * Test clears formula and value contents, calls the method
51 * <code>computeFunction</code> and checks returned value. <p>
52 * Has <b> OK </b> status if returned value is equal to zero
53 * and no exceptions were thrown. <p>
55 public void _clearContents() {
56 boolean result
= true;
57 double resultVal
= -1;
59 log
.println("Testing clearContents() ...");
62 allFlags
= CellFlags
.VALUE
| CellFlags
.FORMULA
;
64 oObj
.clearContents (allFlags
) ;
67 resultVal
= oObj
.computeFunction(GeneralFunction
.SUM
);
68 result
&= (resultVal
== 0.0) || (resultVal
== 0);
69 } catch (com
.sun
.star
.uno
.Exception e
) {
72 "Exception occurred while checking results of method");
73 e
.printStackTrace(log
);
76 tRes
.tested("clearContents()", result
);
78 } // finished clearContents
81 * Test calls the method and checks returned value. <p>
82 * Has <b> OK </b> status if returned value is equal or greate than zero
83 * and no exceptions were thrown. <p>
85 public void _computeFunction() {
87 log
.println("Testing computeFunction() ...");
88 double resultVal
= -1;
89 boolean result
= true;
92 resultVal
= oObj
.computeFunction (GeneralFunction
.COUNT
) ;
93 result
= resultVal
>= 0;
94 } catch (com
.sun
.star
.uno
.Exception e
) {
96 log
.println("Exception occurred in method computeFunction.");
97 e
.printStackTrace(log
);
100 tRes
.tested("computeFunction()", result
);
101 } // finished computeFunction
103 } // finished class _XSheetOperation