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 XDiagram diagram
= null;
57 XChartData ChartData
= null;
60 * Test calls the method and checks returned value. <p>
61 * Has <b> OK </b> status if returned value isn't null. <p>
63 public void _getTitle() {
64 XShape title
= oObj
.getTitle();
65 tRes
.tested("getTitle()", title
!= null);
69 * Test calls the method and checks returned value. <p>
70 * Has <b> OK </b> status if returned value isn't null. <p>
72 public void _getSubTitle() {
73 XShape subtitle
= oObj
.getSubTitle();
74 tRes
.tested("getSubTitle()", subtitle
!= null);
78 * Test calls the method and checks returned value. <p>
79 * Has <b> OK </b> status if returned value isn't null. <p>
81 public void _getLegend() {
82 XShape legend
= oObj
.getLegend();
83 tRes
.tested("getLegend()", legend
!= null);
87 * Test calls the method and checks returned value. <p>
88 * Has <b> OK </b> status if returned value isn't null. <p>
90 public void _getArea() {
91 XPropertySet area
= oObj
.getArea();
92 tRes
.tested("getArea()", area
!= null);
96 * Test calls the method and checks returned value. <p>
97 * Has <b> OK </b> status if returned value isn't null. <p>
99 public void _getDiagram() {
100 diagram
= oObj
.getDiagram();
101 tRes
.tested("getDiagram()", diagram
!= null);
105 * Test compares type of diagram before method call and after.<p>
106 * Has <b> OK </b> status if diagram types are not equal. <p>
108 * The following method tests are to be completed successfully before :
110 * <li> <code> getDiagram </code> : to have diagram before method call</li>
113 * @see com.sun.star.chart.XDiagram
115 public void _setDiagram() {
116 requiredMethod("getDiagram()");
117 String oldType
= diagram
.getDiagramType();
118 XDiagram diag
= (XDiagram
)tEnv
.getObjRelation("DIAGRAM");
119 oObj
.setDiagram(diag
);
120 String newType
= oObj
.getDiagram().getDiagramType();
121 tRes
.tested("setDiagram()", !(oldType
.equals(newType
)));
125 * Test calls the method and checks returned value. <p>
126 * Has <b> OK </b> status if returned value isn't null. <p>
128 public void _getData() {
129 ChartData
= oObj
.getData();
130 tRes
.tested("getData()", ChartData
!= null);
134 * Test compares data before method call and after. <p>
135 * Has <b> OK </b> status if the data before method call and
136 * after are not equal. <p>
137 * The following method tests are to be completed successfully before :
139 * <li> <code> getData </code> : to have data before method call </li>
141 * @see com.sun.star.chart.XChartData
143 public void _attachData() {
144 requiredMethod("getData()");
145 XChartData data
= (XChartData
)tEnv
.getObjRelation("CHARTDATA");
146 oObj
.attachData(data
);
147 XChartData newdata
= oObj
.getData();
149 tRes
.tested("attachData()", !(newdata
.equals(ChartData
)));