1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
3<script:module xmlns:script="http://openoffice.org/2000/script" script:name="chart_XChartDocument" script:language="StarBasic">
4
5
6'*************************************************************************
7'
8' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9'
10' Copyright 2000, 2010 Oracle and/or its affiliates.
11'
12' OpenOffice.org - a multi-platform office productivity suite
13'
14' This file is part of OpenOffice.org.
15'
16' OpenOffice.org is free software: you can redistribute it and/or modify
17' it under the terms of the GNU Lesser General Public License version 3
18' only, as published by the Free Software Foundation.
19'
20' OpenOffice.org is distributed in the hope that it will be useful,
21' but WITHOUT ANY WARRANTY; without even the implied warranty of
22' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23' GNU Lesser General Public License version 3 for more details
24' (a copy is included in the LICENSE file that accompanied this code).
25'
26' You should have received a copy of the GNU Lesser General Public License
27' version 3 along with OpenOffice.org.  If not, see
28' <http://www.openoffice.org/license.html>
29' for a copy of the LGPLv3 License.
30'
31'*************************************************************************
32'*************************************************************************
33
34
35
36' Be sure that all variables are dimensioned:
37option explicit
38
39
40
41Sub RunTest()
42
43'*************************************************************************
44' INTERFACE:
45' com.sun.star.chart.XChartDocument
46'*************************************************************************
47On Error Goto ErrHndl
48
49    Dim bOK As Boolean
50    Dim oGetArea As Object
51    Dim oGetData As Object
52    Dim oGetDiagram As Object, oNewDiagram As Object
53    Dim oGetLegend As Object
54    Dim oGetSubTitle As Object
55    Dim oGetTitle As Object
56    Dim oSetDiagram As Object
57    Dim oAttachData As Object
58    Dim oRange As Object
59    Dim oXChartData As Variant
60    Dim sColumn As Variant, sColumnNew As Variant
61    Dim vColumnNew As Variant, vColumn As Variant
62
63
64    Test.StartMethod("getArea()")
65    bOK = true
66    oGetArea = oObj.GetArea
67    bOK = bOK AND isNumeric(oGetArea.fillStyle)
68    Test.MethodTested("getArea()", bOK)
69
70    Test.StartMethod("getData()")
71    bOK = true
72    oGetData = oObj.getData()
73    bOK = bOK AND (oGetData.RowDescriptions(0) &gt; "")
74    Test.MethodTested("getData()", bOK)
75
76    Test.StartMethod("getDiagram()")
77    bOK = true
78    oGetDiagram = oObj.getDiagram
79    bOK = bOK AND isNumeric(oGetDiagram.constantErrorHigh)
80    Test.MethodTested("getDiagram()", bOK)
81
82    Test.StartMethod("getLegend()")
83    bOK = true
84    oGetLegend = oObj.getLegend
85    bOK = bOK AND isNumeric(oGetLegend.fillStyle)
86    Test.MethodTested("getLegend()", bOK)
87
88    Test.StartMethod("getSubTitle()")
89    bOK = true
90    oGetSubTitle = oObj.getSubTitle
91    bOK = bOK AND isNumeric(ogetSubTitle.fillStyle)
92    Test.MethodTested("getSubTitle()", bOK)
93
94    Test.StartMethod("getTitle()")
95    bOK = true
96    oGetTitle = oObj.getTitle()
97    bOK = bOK AND isNumeric(oGetTitle.fillStyle)
98    Test.MethodTested("getTitle()", bOK)
99
100    Test.StartMethod("setDiagram()")
101    bOK = true
102    'oGetDiagram = oObj.GetDiagram
103    oNewDiagram = oDoc.createInstance("com.sun.star.chart.PieDiagram")
104    oNewDiagram.DataCaption = oGetDiagram.DataCaption + 1
105    oObj.setDiagram(oNewDiagram)
106    oGetDiagram = oObj.GetDiagram
107    bOK = bOK AND oGetDiagram.DataCaption = oNewDiagram.DataCaption
108    Test.MethodTested("setDiagram()", bOK)
109
110    Test.StartMethod("attachData()")
111    bOK = true
112    oXChartData = oObj.getData()
113    vColumn = oXChartData.ColumnDescriptions
114    sColumn = vColumn(0)
115    vColumnNew = vColumn
116    vColumnNew(0) = vColumnNew(0) + cIfcShortName
117    oXChartData.ColumnDescriptions = vColumnNew
118    oObj.attachData(oXChartData)
119    sColumnNew = oXChartData.ColumnDescriptions
120    bOK = bOK AND (sColumn &lt;&gt; vColumnNew(0))
121    Test.MethodTested("attachData()", bOK)
122
123Exit Sub
124ErrHndl:
125    Test.Exception()
126    bOK = false
127    resume next
128End Sub
129</script:module>
130