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'  Licensed to the Apache Software Foundation (ASF) under one
9'  or more contributor license agreements.  See the NOTICE file
10'  distributed with this work for additional information
11'  regarding copyright ownership.  The ASF licenses this file
12'  to you under the Apache License, Version 2.0 (the
13'  "License"); you may not use this file except in compliance
14'  with the License.  You may obtain a copy of the License at
15'
16'    http://www.apache.org/licenses/LICENSE-2.0
17'
18'  Unless required by applicable law or agreed to in writing,
19'  software distributed under the License is distributed on an
20'  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21'  KIND, either express or implied.  See the License for the
22'  specific language governing permissions and limitations
23'  under the License.
24'
25'*************************************************************************
26
27
28
29
30
31' Be sure that all variables are dimensioned:
32option explicit
33
34
35
36Sub RunTest()
37
38'*************************************************************************
39' INTERFACE:
40' com.sun.star.chart.XChartDocument
41'*************************************************************************
42On Error Goto ErrHndl
43
44    Dim bOK As Boolean
45    Dim oGetArea As Object
46    Dim oGetData As Object
47    Dim oGetDiagram As Object, oNewDiagram As Object
48    Dim oGetLegend As Object
49    Dim oGetSubTitle As Object
50    Dim oGetTitle As Object
51    Dim oSetDiagram As Object
52    Dim oAttachData As Object
53    Dim oRange As Object
54    Dim oXChartData As Variant
55    Dim sColumn As Variant, sColumnNew As Variant
56    Dim vColumnNew As Variant, vColumn As Variant
57
58
59    Test.StartMethod("getArea()")
60    bOK = true
61    oGetArea = oObj.GetArea
62    bOK = bOK AND isNumeric(oGetArea.fillStyle)
63    Test.MethodTested("getArea()", bOK)
64
65    Test.StartMethod("getData()")
66    bOK = true
67    oGetData = oObj.getData()
68    bOK = bOK AND (oGetData.RowDescriptions(0) &gt; "")
69    Test.MethodTested("getData()", bOK)
70
71    Test.StartMethod("getDiagram()")
72    bOK = true
73    oGetDiagram = oObj.getDiagram
74    bOK = bOK AND isNumeric(oGetDiagram.constantErrorHigh)
75    Test.MethodTested("getDiagram()", bOK)
76
77    Test.StartMethod("getLegend()")
78    bOK = true
79    oGetLegend = oObj.getLegend
80    bOK = bOK AND isNumeric(oGetLegend.fillStyle)
81    Test.MethodTested("getLegend()", bOK)
82
83    Test.StartMethod("getSubTitle()")
84    bOK = true
85    oGetSubTitle = oObj.getSubTitle
86    bOK = bOK AND isNumeric(ogetSubTitle.fillStyle)
87    Test.MethodTested("getSubTitle()", bOK)
88
89    Test.StartMethod("getTitle()")
90    bOK = true
91    oGetTitle = oObj.getTitle()
92    bOK = bOK AND isNumeric(oGetTitle.fillStyle)
93    Test.MethodTested("getTitle()", bOK)
94
95    Test.StartMethod("setDiagram()")
96    bOK = true
97    'oGetDiagram = oObj.GetDiagram
98    oNewDiagram = oDoc.createInstance("com.sun.star.chart.PieDiagram")
99    oNewDiagram.DataCaption = oGetDiagram.DataCaption + 1
100    oObj.setDiagram(oNewDiagram)
101    oGetDiagram = oObj.GetDiagram
102    bOK = bOK AND oGetDiagram.DataCaption = oNewDiagram.DataCaption
103    Test.MethodTested("setDiagram()", bOK)
104
105    Test.StartMethod("attachData()")
106    bOK = true
107    oXChartData = oObj.getData()
108    vColumn = oXChartData.ColumnDescriptions
109    sColumn = vColumn(0)
110    vColumnNew = vColumn
111    vColumnNew(0) = vColumnNew(0) + cIfcShortName
112    oXChartData.ColumnDescriptions = vColumnNew
113    oObj.attachData(oXChartData)
114    sColumnNew = oXChartData.ColumnDescriptions
115    bOK = bOK AND (sColumn &lt;&gt; vColumnNew(0))
116    Test.MethodTested("attachData()", bOK)
117
118Exit Sub
119ErrHndl:
120    Test.Exception()
121    bOK = false
122    resume next
123End Sub
124</script:module>
125