1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
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.
14  *
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).
20  *
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.
25  *
26  ************************************************************************/
27 
28 package ifc.table;
29 
30 import lib.MultiMethodTest;
31 
32 import com.sun.star.awt.Rectangle;
33 import com.sun.star.table.CellRangeAddress;
34 import com.sun.star.table.XTableCharts;
35 
36 /**
37 * Testing <code>com.sun.star.table.XTableCharts</code>
38 * interface methods :
39 * <ul>
40 *  <li><code> addNewByName()</code></li>
41 *  <li><code> removeByName()</code></li>
42 * </ul> <p>
43 * This test needs the following object relations :
44 * <ul>
45 *  <li> <code>'ADDR'</code>
46 *  (of type <code>com.sun.star.table.CellRangeAddress[]</code>):
47 *   data source ranges for chart creating. </li>
48 *  <li> <code>'RECT'</code>
49 *  (of type <code>com.sun.star.awt.Rectangle</code>):
50 *   the position of chart </li>
51 * <ul> <p>
52 * Test is <b> NOT </b> multithread compilant. <p>
53 * @see com.sun.star.table.XTableCharts
54 */
55 public class _XTableCharts extends MultiMethodTest {
56 
57     public XTableCharts oObj = null;
58 
59     /**
60      * Adds a new chart into table with specified name . <p>
61      * Has <b> OK </b> status if <code>hasByName()</code> returns
62      * <code>true</code>. <p>
63      */
64     public void _addNewByName() {
65 
66         CellRangeAddress[] the_Range = (CellRangeAddress[])
67             tEnv.getObjRelation("ADDR");
68         Rectangle the_rect = (Rectangle) tEnv.getObjRelation("RECT");
69         oObj.addNewByName("XTableCharts",the_rect,the_Range,true,true);
70         tRes.tested("addNewByName()", oObj.hasByName("XTableCharts") );
71 
72     } // addNewByName()
73 
74     /**
75      * Removes the chart added before. <p>
76      * Has <b> OK </b> status if <code>hasByName()</code> returns
77      * <code>false</code>. <p>
78      * The following method tests are to be completed successfully before :
79      * <ul>
80      *  <li> <code> addNewByName() </code> : chart mst be added first </li>
81      * </ul>
82      */
83     public void _removeByName() {
84         requiredMethod("addNewByName()") ;
85 
86         oObj.removeByName("XTableCharts");
87         tRes.tested("removeByName()", !oObj.hasByName("XTableCharts") );
88 
89     } // removeByName()
90 
91 } // finish class _XTableCharts
92 
93 
94 
95