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 37' Be sure that all variables are dimensioned: 38option explicit 39 40 41 42Sub RunTest() 43 44'************************************************************************* 45' INTERFACE: 46' com.sun.star.chart.XChartDocument 47'************************************************************************* 48On Error Goto ErrHndl 49 50 Dim bOK As Boolean 51 Dim oGetArea As Object 52 Dim oGetData As Object 53 Dim oGetDiagram As Object, oNewDiagram As Object 54 Dim oGetLegend As Object 55 Dim oGetSubTitle As Object 56 Dim oGetTitle As Object 57 Dim oSetDiagram As Object 58 Dim oAttachData As Object 59 Dim oRange As Object 60 Dim oXChartData As Variant 61 Dim sColumn As Variant, sColumnNew As Variant 62 Dim vColumnNew As Variant, vColumn As Variant 63 64 65 Test.StartMethod("getArea()") 66 bOK = true 67 oGetArea = oObj.GetArea 68 bOK = bOK AND isNumeric(oGetArea.fillStyle) 69 Test.MethodTested("getArea()", bOK) 70 71 Test.StartMethod("getData()") 72 bOK = true 73 oGetData = oObj.getData() 74 bOK = bOK AND (oGetData.RowDescriptions(0) > "") 75 Test.MethodTested("getData()", bOK) 76 77 Test.StartMethod("getDiagram()") 78 bOK = true 79 oGetDiagram = oObj.getDiagram 80 bOK = bOK AND isNumeric(oGetDiagram.constantErrorHigh) 81 Test.MethodTested("getDiagram()", bOK) 82 83 Test.StartMethod("getLegend()") 84 bOK = true 85 oGetLegend = oObj.getLegend 86 bOK = bOK AND isNumeric(oGetLegend.fillStyle) 87 Test.MethodTested("getLegend()", bOK) 88 89 Test.StartMethod("getSubTitle()") 90 bOK = true 91 oGetSubTitle = oObj.getSubTitle 92 bOK = bOK AND isNumeric(ogetSubTitle.fillStyle) 93 Test.MethodTested("getSubTitle()", bOK) 94 95 Test.StartMethod("getTitle()") 96 bOK = true 97 oGetTitle = oObj.getTitle() 98 bOK = bOK AND isNumeric(oGetTitle.fillStyle) 99 Test.MethodTested("getTitle()", bOK) 100 101 Test.StartMethod("setDiagram()") 102 bOK = true 103 'oGetDiagram = oObj.GetDiagram 104 oNewDiagram = oDoc.createInstance("com.sun.star.chart.PieDiagram") 105 oNewDiagram.DataCaption = oGetDiagram.DataCaption + 1 106 oObj.setDiagram(oNewDiagram) 107 oGetDiagram = oObj.GetDiagram 108 bOK = bOK AND oGetDiagram.DataCaption = oNewDiagram.DataCaption 109 Test.MethodTested("setDiagram()", bOK) 110 111 Test.StartMethod("attachData()") 112 bOK = true 113 oXChartData = oObj.getData() 114 vColumn = oXChartData.ColumnDescriptions 115 sColumn = vColumn(0) 116 vColumnNew = vColumn 117 vColumnNew(0) = vColumnNew(0) + cIfcShortName 118 oXChartData.ColumnDescriptions = vColumnNew 119 oObj.attachData(oXChartData) 120 sColumnNew = oXChartData.ColumnDescriptions 121 bOK = bOK AND (sColumn <> vColumnNew(0)) 122 Test.MethodTested("attachData()", bOK) 123 124Exit Sub 125ErrHndl: 126 Test.Exception() 127 bOK = false 128 resume next 129End Sub 130</script:module> 131