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 .
21 import lib
.MultiMethodTest
;
23 import com
.sun
.star
.beans
.XPropertySet
;
24 import com
.sun
.star
.chart
.XChartData
;
25 import com
.sun
.star
.chart
.XChartDocument
;
26 import com
.sun
.star
.chart
.XDiagram
;
27 import com
.sun
.star
.drawing
.XShape
;
30 * Testing <code>com.sun.star.chart.XChartDocument</code>
33 * <li><code> getTitle()</code></li>
34 * <li><code> getSubTitle()</code></li>
35 * <li><code> getLegend()</code></li>
36 * <li><code> getArea()</code></li>
37 * <li><code> getDiagram()</code></li>
38 * <li><code> setDiagram()</code></li>
39 * <li><code> getData()</code></li>
40 * <li><code> attachData()</code></li>
43 * This test needs the following object relations :
45 * <li> <code>'DIAGRAM'</code> (of type <code>XDiagram</code>):
46 * is used as parameter for method <code>setDiagram</code> </li>
47 * <li> <code>'CHARTDATA'</code> (of type <code>XChartData</code>):
48 * is used as parameter for method <code>attachData</code> </li>
51 * @see com.sun.star.chart.XChartDocument
53 public class _XChartDocument
extends MultiMethodTest
{
55 public XChartDocument oObj
= null;
56 boolean result
= true;
57 XDiagram diagram
= null;
58 XChartData ChartData
= null;
61 * Test calls the method and checks returned value. <p>
62 * Has <b> OK </b> status if returned value isn't null. <p>
64 public void _getTitle() {
65 XShape title
= oObj
.getTitle();
66 tRes
.tested("getTitle()", title
!= null);
70 * Test calls the method and checks returned value. <p>
71 * Has <b> OK </b> status if returned value isn't null. <p>
73 public void _getSubTitle() {
74 XShape subtitle
= oObj
.getSubTitle();
75 tRes
.tested("getSubTitle()", subtitle
!= null);
79 * Test calls the method and checks returned value. <p>
80 * Has <b> OK </b> status if returned value isn't null. <p>
82 public void _getLegend() {
83 XShape legend
= oObj
.getLegend();
84 tRes
.tested("getLegend()", legend
!= null);
88 * Test calls the method and checks returned value. <p>
89 * Has <b> OK </b> status if returned value isn't null. <p>
91 public void _getArea() {
92 XPropertySet area
= oObj
.getArea();
93 tRes
.tested("getArea()", area
!= null);
97 * Test calls the method and checks returned value. <p>
98 * Has <b> OK </b> status if returned value isn't null. <p>
100 public void _getDiagram() {
101 diagram
= oObj
.getDiagram();
102 tRes
.tested("getDiagram()", diagram
!= null);
106 * Test compares type of diagram before method call and after.<p>
107 * Has <b> OK </b> status if diagram types are not equal. <p>
109 * The following method tests are to be completed successfully before :
111 * <li> <code> getDiagram </code> : to have diagram before method call</li>
114 * @see com.sun.star.chart.XDiagram
116 public void _setDiagram() {
117 requiredMethod("getDiagram()");
118 String oldType
= diagram
.getDiagramType();
119 XDiagram diag
= (XDiagram
)tEnv
.getObjRelation("DIAGRAM");
120 oObj
.setDiagram(diag
);
121 String newType
= oObj
.getDiagram().getDiagramType();
122 tRes
.tested("setDiagram()", !(oldType
.equals(newType
)));
126 * Test calls the method and checks returned value. <p>
127 * Has <b> OK </b> status if returned value isn't null. <p>
129 public void _getData() {
130 ChartData
= oObj
.getData();
131 tRes
.tested("getData()", ChartData
!= null);
135 * Test compares data before method call and after. <p>
136 * Has <b> OK </b> status if the data before method call and
137 * after are not equal. <p>
138 * The following method tests are to be completed successfully before :
140 * <li> <code> getData </code> : to have data before method call </li>
142 * @see com.sun.star.chart.XChartData
144 public void _attachData() {
145 requiredMethod("getData()");
146 XChartData data
= (XChartData
)tEnv
.getObjRelation("CHARTDATA");
147 oObj
.attachData(data
);
148 XChartData newdata
= oObj
.getData();
150 tRes
.tested("attachData()", !(newdata
.equals(ChartData
)));