Update ooo320-m1
[ooovba.git] / qadevOOo / tests / java / ifc / chart / _XChartDocument.java
blobb3ab60c7bf6c3b6599fa79acb9c442049e81389c
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: _XChartDocument.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.chart;
33 import lib.MultiMethodTest;
35 import com.sun.star.beans.XPropertySet;
36 import com.sun.star.chart.XChartData;
37 import com.sun.star.chart.XChartDocument;
38 import com.sun.star.chart.XDiagram;
39 import com.sun.star.drawing.XShape;
41 /**
42 * Testing <code>com.sun.star.chart.XChartDocument</code>
43 * interface methods :
44 * <ul>
45 * <li><code> getTitle()</code></li>
46 * <li><code> getSubTitle()</code></li>
47 * <li><code> getLegend()</code></li>
48 * <li><code> getArea()</code></li>
49 * <li><code> getDiagram()</code></li>
50 * <li><code> setDiagram()</code></li>
51 * <li><code> getData()</code></li>
52 * <li><code> attachData()</code></li>
53 * </ul> <p>
55 * This test needs the following object relations :
56 * <ul>
57 * <li> <code>'DIAGRAM'</code> (of type <code>XDiagram</code>):
58 * is used as parameter for method <code>setDiagram</code> </li>
59 * <li> <code>'CHARTDATA'</code> (of type <code>XChartData</code>):
60 * is used as parameter for method <code>attachData</code> </li>
61 * </ul>
63 * @see com.sun.star.chart.XChartDocument
65 public class _XChartDocument extends MultiMethodTest {
67 public XChartDocument oObj = null;
68 boolean result = true;
69 XDiagram diagram = null;
70 XChartData ChartData = null;
72 /**
73 * Test calls the method and checks returned value. <p>
74 * Has <b> OK </b> status if returned value isn't null. <p>
76 public void _getTitle() {
77 XShape title = oObj.getTitle();
78 tRes.tested("getTitle()", title != null);
81 /**
82 * Test calls the method and checks returned value. <p>
83 * Has <b> OK </b> status if returned value isn't null. <p>
85 public void _getSubTitle() {
86 XShape subtitle = oObj.getSubTitle();
87 tRes.tested("getSubTitle()", subtitle != null);
90 /**
91 * Test calls the method and checks returned value. <p>
92 * Has <b> OK </b> status if returned value isn't null. <p>
94 public void _getLegend() {
95 XShape legend = oObj.getLegend();
96 tRes.tested("getLegend()", legend != null);
99 /**
100 * Test calls the method and checks returned value. <p>
101 * Has <b> OK </b> status if returned value isn't null. <p>
103 public void _getArea() {
104 XPropertySet area = oObj.getArea();
105 tRes.tested("getArea()", area != null);
109 * Test calls the method and checks returned value. <p>
110 * Has <b> OK </b> status if returned value isn't null. <p>
112 public void _getDiagram() {
113 diagram = oObj.getDiagram();
114 tRes.tested("getDiagram()", diagram != null);
118 * Test compares type of diagram before method call and after.<p>
119 * Has <b> OK </b> status if diagram types are not equal. <p>
121 * The following method tests are to be completed successfully before :
122 * <ul>
123 * <li> <code> getDiagram </code> : to have diagram before method call</li>
124 * </ul>
126 * @see com.sun.star.chart.XDiagram
128 public void _setDiagram() {
129 requiredMethod("getDiagram()");
130 String oldType = diagram.getDiagramType();
131 XDiagram diag = (XDiagram)tEnv.getObjRelation("DIAGRAM");
132 oObj.setDiagram(diag);
133 String newType = oObj.getDiagram().getDiagramType();
134 tRes.tested("setDiagram()", !(oldType.equals(newType)));
138 * Test calls the method and checks returned value. <p>
139 * Has <b> OK </b> status if returned value isn't null. <p>
141 public void _getData() {
142 ChartData = oObj.getData();
143 tRes.tested("getData()", ChartData != null);
147 * Test compares data before method call and after. <p>
148 * Has <b> OK </b> status if the data before method call and
149 * after are not equal. <p>
150 * The following method tests are to be completed successfully before :
151 * <ul>
152 * <li> <code> getData </code> : to have data before method call </li>
153 * </ul>
154 * @see com.sun.star.chart.XChartData
156 public void _attachData() {
157 requiredMethod("getData()");
158 XChartData data = (XChartData)tEnv.getObjRelation("CHARTDATA");
159 oObj.attachData(data);
160 XChartData newdata = oObj.getData();
162 tRes.tested("attachData()", !(newdata.equals(ChartData)));