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