1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 package ifc.table;
25 
26 import lib.MultiMethodTest;
27 
28 import com.sun.star.awt.Rectangle;
29 import com.sun.star.table.CellRangeAddress;
30 import com.sun.star.table.XTableCharts;
31 
32 /**
33 * Testing <code>com.sun.star.table.XTableCharts</code>
34 * interface methods :
35 * <ul>
36 *  <li><code> addNewByName()</code></li>
37 *  <li><code> removeByName()</code></li>
38 * </ul> <p>
39 * This test needs the following object relations :
40 * <ul>
41 *  <li> <code>'ADDR'</code>
42 *  (of type <code>com.sun.star.table.CellRangeAddress[]</code>):
43 *   data source ranges for chart creating. </li>
44 *  <li> <code>'RECT'</code>
45 *  (of type <code>com.sun.star.awt.Rectangle</code>):
46 *   the position of chart </li>
47 * <ul> <p>
48 * Test is <b> NOT </b> multithread compilant. <p>
49 * @see com.sun.star.table.XTableCharts
50 */
51 public class _XTableCharts extends MultiMethodTest {
52 
53     public XTableCharts oObj = null;
54 
55     /**
56      * Adds a new chart into table with specified name . <p>
57      * Has <b> OK </b> status if <code>hasByName()</code> returns
58      * <code>true</code>. <p>
59      */
_addNewByName()60     public void _addNewByName() {
61 
62         CellRangeAddress[] the_Range = (CellRangeAddress[])
63             tEnv.getObjRelation("ADDR");
64         Rectangle the_rect = (Rectangle) tEnv.getObjRelation("RECT");
65         oObj.addNewByName("XTableCharts",the_rect,the_Range,true,true);
66         tRes.tested("addNewByName()", oObj.hasByName("XTableCharts") );
67 
68     } // addNewByName()
69 
70     /**
71      * Removes the chart added before. <p>
72      * Has <b> OK </b> status if <code>hasByName()</code> returns
73      * <code>false</code>. <p>
74      * The following method tests are to be completed successfully before :
75      * <ul>
76      *  <li> <code> addNewByName() </code> : chart mst be added first </li>
77      * </ul>
78      */
_removeByName()79     public void _removeByName() {
80         requiredMethod("addNewByName()") ;
81 
82         oObj.removeByName("XTableCharts");
83         tRes.tested("removeByName()", !oObj.hasByName("XTableCharts") );
84 
85     } // removeByName()
86 
87 } // finish class _XTableCharts
88 
89 
90 
91