'************************************************************************* ' ' 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 '************************************************************************* ' This Interface/Service test depends on the following GLOBAL variables, ' which must be specified in the object creation: ' - Global AllFunctions As Variant '************************************************************************* Sub RunTest() '************************************************************************* ' INTERFACE: ' com.sun.star.sheet.XRecentFunctions '************************************************************************* On Error Goto ErrHndl Dim bOK As Boolean Dim recentFunctions As Variant Dim i, j As Integer Dim props As Variant Test.StartMethod("getRecentFunctionIds()") bOK = true recentFunctions = oObj.getRecentFunctionIds() bOK = bOK AND NOT isNULL(recentFunctions) bOK = bOK AND ubound(recentFunctions) <= oObj.getMaxRecentFunctions for i = 0 to ubound(recentFunctions) - 1 for j = i + 1 to ubound(recentFunctions) if recentFunctions(i) = recentFunctions(j) then bOK = false next j next i Test.MethodTested("getRecentFunctionIds()", bOK) Test.StartMethod("setRecentFunctionIds()") bOK = true Dim Max As Integer Max = oObj.getMaxRecentFunctions Dim newList(Max) As Integer for i = 0 to ubound(newList()) props = AllFunctions.getByIndex(i) for j = 0 to ubound(props()) if props(j).Name = "Id" then newList(i) = props(j).Value exit for end if next j next i oObj.setRecentFunctionIds(newList()) bOK = bOK AND (Max = oObj.getMaxRecentFunctions) Test.MethodTested("setRecentFunctionIds()", bOK) Test.StartMethod("getMaxRecentFunctions()") bOK = true Max = oObj.getMaxRecentFunctions Out.Log("MaxRecentFunctions = " & Max) bOK = bOK AND Max > 0 Test.MethodTested("getMaxRecentFunctions()", bOK) Exit Sub ErrHndl: Test.Exception() bOK = false resume next End Sub