Branch libreoffice-5-0-4
[LibreOffice.git] / qadevOOo / tests / java / ifc / sheet / _XScenarios.java
blob447c627b52e8a84407966f26b77e97098764b7a1
1 /*
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 .
19 package ifc.sheet;
21 import lib.MultiMethodTest;
22 import lib.Status;
23 import lib.StatusException;
25 import com.sun.star.sheet.XScenarios;
26 import com.sun.star.table.CellRangeAddress;
28 /**
29 * Testing <code>com.sun.star.sheet.XScenarios</code>
30 * interface methods :
31 * <ul>
32 * <li><code> addNewByName()</code></li>
33 * <li><code> removeByName()</code></li>
34 * </ul> <p>
35 * This test needs the following object relations :
36 * <ul>
37 * <li> <code>'ADDR'</code> (of type <code>CellRangeAddress[]</code>):
38 * the array of cell range addresses for adding new scenario </li>
39 * <ul> <p>
40 * @see com.sun.star.sheet.XScenarios
42 public class _XScenarios extends MultiMethodTest {
44 public XScenarios oObj = null;
46 /**
47 * Test adds new scenario, stores name of this scenario and checks that
48 * scenario with this name is present in collection. <p>
49 * Has <b> OK </b> status if the new scenario is present in collection. <p>
51 public void _addNewByName() {
52 CellRangeAddress[] oAddr = (CellRangeAddress[])
53 tEnv.getObjRelation("ADDR");
54 if (oAddr == null) throw new StatusException(Status.failed
55 ("Relation 'ADDR' not found"));
57 oObj.addNewByName("XScenarios", oAddr, "new");
58 tRes.tested("addNewByName()",oObj.hasByName("XScenarios"));
61 /**
62 * Test removes the scenario with stored name and checks that scenario
63 * with this name isn't present in collection. <p>
64 * Has <b> OK </b> status if the scenario with stored name isn't present in
65 * collection after it was removed. <p>
66 * The following method tests are to be completed successfully before :
67 * <ul>
68 * <li> <code> addNewByName() </code> : to have name of the scenario </li>
69 * </ul>
71 public void _removeByName() {
72 requiredMethod("addNewByName()");
73 oObj.removeByName("XScenarios");
74 tRes.tested("removeByName()",!oObj.hasByName("XScenarios"));
78 } // EOC _XScenarios