merge the formfield patch from ooo-build
[ooovba.git] / qadevOOo / tests / java / ifc / sheet / _XScenarios.java
blob618ee41572ef9cb07fffb5e2736240b2b6ebff0d
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: _XScenarios.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;
34 import lib.Status;
35 import lib.StatusException;
37 import com.sun.star.sheet.XScenarios;
38 import com.sun.star.table.CellRangeAddress;
40 /**
41 * Testing <code>com.sun.star.sheet.XScenarios</code>
42 * interface methods :
43 * <ul>
44 * <li><code> addNewByName()</code></li>
45 * <li><code> removeByName()</code></li>
46 * </ul> <p>
47 * This test needs the following object relations :
48 * <ul>
49 * <li> <code>'ADDR'</code> (of type <code>CellRangeAddress[]</code>):
50 * the array of cell range addresses for adding new scenario </li>
51 * <ul> <p>
52 * @see com.sun.star.sheet.XScenarios
54 public class _XScenarios extends MultiMethodTest {
56 public XScenarios oObj = null;
58 /**
59 * Test adds new scenario, stores name of this scenario and checks that
60 * scenario with this name is present in collection. <p>
61 * Has <b> OK </b> status if the new scenario is present in collection. <p>
63 public void _addNewByName() {
64 CellRangeAddress[] oAddr = (CellRangeAddress[])
65 tEnv.getObjRelation("ADDR");
66 if (oAddr == null) throw new StatusException(Status.failed
67 ("Relation 'ADDR' not found"));
69 oObj.addNewByName("XScenarios", oAddr, "new");
70 tRes.tested("addNewByName()",oObj.hasByName("XScenarios"));
73 /**
74 * Test removes the scenario with stored name and checks that scenario
75 * with this name isn't present in collection. <p>
76 * Has <b> OK </b> status if the scenario with stored name isn't present in
77 * collection after it was removed. <p>
78 * The following method tests are to be completed successfully before :
79 * <ul>
80 * <li> <code> addNewByName() </code> : to have name of the scenario </li>
81 * </ul>
83 public void _removeByName() {
84 requiredMethod("addNewByName()");
85 oObj.removeByName("XScenarios");
86 tRes.tested("removeByName()",!oObj.hasByName("XScenarios"));
90 } // EOC _XScenarios