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="sheet_XConsolidationDescriptor" 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.sheet.XConsolidationDescriptor
41'*************************************************************************
42On Error Goto ErrHndl
43    Dim bOK As Boolean
44    Dim mStartPos, objpos As Variant
45    Dim bUseCols, bUseRows, bUsed, bLinks As Boolean
46    Dim src(0) As New com.sun.star.table.CellRangeAddress
47    Dim outpos As New com.sun.star.table.CellAddress
48    Dim objSrc() As Variant
49
50    Test.StartMethod("getFunction()")
51    bOK = true
52    bOK = bOK AND NOT IsNULL(oObj.Function)
53    Test.MethodTested("getFunction()", bOK)
54
55    Test.StartMethod("getSources()")
56    bOK = true
57    bOK = bOK AND NOT isNULL(oObj.getSources())
58    Test.MethodTested("getSources()", bOK)
59
60    Test.StartMethod("getStartOutputPosition()")
61    bOK = true
62    mStartPos = oObj.getStartOutputPosition()
63    bOK = mStartPos.Row &gt;= 0 ' Checking that returned type is correct
64                             ' (if Object has such field)
65    Test.MethodTested("getStartOutputPosition()", bOK)
66
67    Test.StartMethod("getUseRowHeaders()")
68    Test.StartMethod("setUseRowHeaders()")
69    bOK = true
70    bUsed = oObj.getUseRowHeaders
71    oObj.setUseRowHeaders(NOT bUsed)
72    bOK = bOK AND (oObj.getUseRowHeaders &lt;&gt; bUsed)
73    Test.MethodTested("getUseRowHeaders()", bOK)
74    Test.MethodTested("setUseRowHeaders()", bOK)
75
76    Test.StartMethod("setFunction()")
77    bOK = true
78    oObj.setFunction(com.sun.star.sheet.GeneralFunction.MAX)
79    bOK = bOK AND (oObj.getFunction = com.sun.star.sheet.GeneralFunction.MAX)
80    Test.MethodTested("setFunction()", bOK)
81
82    Test.StartMethod("getInsertLinks()")
83    Test.StartMethod("setInsertLinks()")
84    bOK = true
85    bLinks = oObj.getInsertLinks
86    oObj.setInsertLinks(NOT bLinks)
87    bOK = bOK AND (oObj.getInsertLinks &lt;&gt; bLinks)
88    Test.MethodTested("getInsertLinks()", bOK)
89    Test.MethodTested("setInsertLinks()", bOK)
90
91    Test.StartMethod("setSources()")
92    bOK = true
93    src(0).Sheet = 0
94    src(0).StartRow = 5
95    src(0).StartColumn = 5
96    src(0).EndRow = 10
97    src(0).EndColumn = 10
98    oObj.setSources(src())
99    objSrc() = oObj.getSources
100    bOK = bOK AND ((objSrc(0).Sheet  = src(0).Sheet) AND _
101                   (objSrc(0).StartRow = src(0).StartRow) AND _
102                   (objSrc(0).EndRow = src(0).EndRow) AND _
103                   (objSrc(0).StartColumn = src(0).StartColumn) AND _
104                   (objSrc(0).EndColumn = src(0).EndColumn))
105    Test.MethodTested("setSources()", bOK)
106
107    Test.StartMethod("setStartOutputPosition()")
108    bOK = true
109    outpos.Sheet = 0
110    outpos.Row = 2
111    outpos.Column = 2
112    oObj.setStartOutputPosition(outpos)
113    objpos = oObj.getStartOutputPosition
114    bOK = bOK AND ((objpos(0).Sheet  = outpos(0).Sheet) AND _
115                   (objpos(0).Row = outpos(0).Row) AND _
116                   (objpos(0).Column = outpos(0).Column))
117    Test.MethodTested("setStartOutputPosition()", bOK)
118
119    Test.StartMethod("getUseColumnHeaders()")
120    bOK = true
121    bUseCols = oObj.getUseColumnHeaders()
122    oObj.setUseColumnHeaders(NOT bUseCols)
123    bOK = bOK AND (oObj.getUseColumnHeaders() &lt;&gt; bUseCols)
124    Test.MethodTested("getUseColumnHeaders()", bOK)
125
126    Test.StartMethod("setUseColumnHeaders()")
127    bOK = true
128    bUseRows = oObj.getUseRowHeaders
129    oObj.setUseRowHeaders(NOT bUseRows)
130    bOK = bOK AND (oObj.getUseRowHeaders &lt;&gt; bUseRows)
131    Test.MethodTested("setUseColumnHeaders()", bOK)
132
133Exit Sub
134ErrHndl:
135    Test.Exception()
136    bOK = false
137    resume next
138End Sub
139</script:module>
140