| <?xml version="1.0" encoding="UTF-8"?> |
| <!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> |
| <script:module xmlns:script="http://openoffice.org/2000/script" script:name="chart_XChartDocument" script:language="StarBasic"> |
| |
| |
| '************************************************************************* |
| ' |
| ' Licensed to the Apache Software Foundation (ASF) under one |
| ' or more contributor license agreements. See the NOTICE file |
| ' distributed with this work for additional information |
| ' regarding copyright ownership. The ASF licenses this file |
| ' to you under the Apache License, Version 2.0 (the |
| ' "License"); you may not use this file except in compliance |
| ' with the License. You may obtain a copy of the License at |
| ' |
| ' http://www.apache.org/licenses/LICENSE-2.0 |
| ' |
| ' Unless required by applicable law or agreed to in writing, |
| ' software distributed under the License is distributed on an |
| ' "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| ' KIND, either express or implied. See the License for the |
| ' specific language governing permissions and limitations |
| ' under the License. |
| ' |
| '************************************************************************* |
| |
| |
| |
| |
| |
| ' Be sure that all variables are dimensioned: |
| option explicit |
| |
| |
| |
| Sub RunTest() |
| |
| '************************************************************************* |
| ' INTERFACE: |
| ' com.sun.star.chart.XChartDocument |
| '************************************************************************* |
| On Error Goto ErrHndl |
| |
| Dim bOK As Boolean |
| Dim oGetArea As Object |
| Dim oGetData As Object |
| Dim oGetDiagram As Object, oNewDiagram As Object |
| Dim oGetLegend As Object |
| Dim oGetSubTitle As Object |
| Dim oGetTitle As Object |
| Dim oSetDiagram As Object |
| Dim oAttachData As Object |
| Dim oRange As Object |
| Dim oXChartData As Variant |
| Dim sColumn As Variant, sColumnNew As Variant |
| Dim vColumnNew As Variant, vColumn As Variant |
| |
| |
| Test.StartMethod("getArea()") |
| bOK = true |
| oGetArea = oObj.GetArea |
| bOK = bOK AND isNumeric(oGetArea.fillStyle) |
| Test.MethodTested("getArea()", bOK) |
| |
| Test.StartMethod("getData()") |
| bOK = true |
| oGetData = oObj.getData() |
| bOK = bOK AND (oGetData.RowDescriptions(0) > "") |
| Test.MethodTested("getData()", bOK) |
| |
| Test.StartMethod("getDiagram()") |
| bOK = true |
| oGetDiagram = oObj.getDiagram |
| bOK = bOK AND isNumeric(oGetDiagram.constantErrorHigh) |
| Test.MethodTested("getDiagram()", bOK) |
| |
| Test.StartMethod("getLegend()") |
| bOK = true |
| oGetLegend = oObj.getLegend |
| bOK = bOK AND isNumeric(oGetLegend.fillStyle) |
| Test.MethodTested("getLegend()", bOK) |
| |
| Test.StartMethod("getSubTitle()") |
| bOK = true |
| oGetSubTitle = oObj.getSubTitle |
| bOK = bOK AND isNumeric(ogetSubTitle.fillStyle) |
| Test.MethodTested("getSubTitle()", bOK) |
| |
| Test.StartMethod("getTitle()") |
| bOK = true |
| oGetTitle = oObj.getTitle() |
| bOK = bOK AND isNumeric(oGetTitle.fillStyle) |
| Test.MethodTested("getTitle()", bOK) |
| |
| Test.StartMethod("setDiagram()") |
| bOK = true |
| 'oGetDiagram = oObj.GetDiagram |
| oNewDiagram = oDoc.createInstance("com.sun.star.chart.PieDiagram") |
| oNewDiagram.DataCaption = oGetDiagram.DataCaption + 1 |
| oObj.setDiagram(oNewDiagram) |
| oGetDiagram = oObj.GetDiagram |
| bOK = bOK AND oGetDiagram.DataCaption = oNewDiagram.DataCaption |
| Test.MethodTested("setDiagram()", bOK) |
| |
| Test.StartMethod("attachData()") |
| bOK = true |
| oXChartData = oObj.getData() |
| vColumn = oXChartData.ColumnDescriptions |
| sColumn = vColumn(0) |
| vColumnNew = vColumn |
| vColumnNew(0) = vColumnNew(0) + cIfcShortName |
| oXChartData.ColumnDescriptions = vColumnNew |
| oObj.attachData(oXChartData) |
| sColumnNew = oXChartData.ColumnDescriptions |
| bOK = bOK AND (sColumn <> vColumnNew(0)) |
| Test.MethodTested("attachData()", bOK) |
| |
| Exit Sub |
| ErrHndl: |
| Test.Exception() |
| bOK = false |
| resume next |
| End Sub |
| </script:module> |