1<?xml version="1.0" encoding="UTF-8"?> 2<script:module xmlns:script="http://openoffice.org/2000/script" script:name="task_XJob" script:language="StarBasic"> 3 4'************************************************************************* 5' 6' Licensed to the Apache Software Foundation (ASF) under one 7' or more contributor license agreements. See the NOTICE file 8' distributed with this work for additional information 9' regarding copyright ownership. The ASF licenses this file 10' to you under the Apache License, Version 2.0 (the 11' "License"); you may not use this file except in compliance 12' with the License. You may obtain a copy of the License at 13' 14' http://www.apache.org/licenses/LICENSE-2.0 15' 16' Unless required by applicable law or agreed to in writing, 17' software distributed under the License is distributed on an 18' "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 19' KIND, either express or implied. See the License for the 20' specific language governing permissions and limitations 21' under the License. 22' 23'************************************************************************* 24 25 26 27'************************************************************************* 28' This Interface/Service test depends on the following GLOBAL variables, 29' which must be specified in the object creation: 30 31' Global vXJobArgs(0 to n) as Variant 32' Example: 33' Dim vXJobArg0(0 to 0) as new com.sun.star.beans.NamedValue 34' Dim vXJobArg1(0 to 0) as new com.sun.star.beans.NamedValue 35' vXJobArgs0(0).Name = "MyProperty": vXJobArg0(0).Vaue = "MyValue" 36' vXJobArgs1(0).Name = "MyProperty": vXJobArg0(0).Vaue = "My2ndValue" 37' vXJobArgs(0) = vXJobArg0() 38' vXJobArgs(1) = vXJobArg1() 39 40 41'************************************************************************* 42 43 44' Be sure that all variables are dimensioned: 45option explicit 46 47 48 49 50Sub RunTest() 51 52'************************************************************************* 53' INTERFACE: 54' com.sun.star.task.XJob 55'************************************************************************* 56On Error Goto ErrHndl 57 Dim bOK As Boolean 58 Dim bRun as Boolean 59 Dim n as Integer 60 61 out.dbg("Start tests of com.sun.star.task.XJob #########") 62 ReCreateObj() 63 64 Test.StartMethod("execute()") 65 66 bOK = TRUE 67 for n = 0 to uBound(vXJobArgs()) 68 bRun = FALSE 69 out.dbg("running vXJobArgs(" + n + ")") 70 bRun = oObj.execute(vXJobArgs(n)) 71 bOK = bOK AND bRun 72 out.dbg("Result: " + bRun) 73 next n 74 Test.MethodTested("execute()", bOK) 75 76 77Exit Sub 78ErrHndl: 79 Test.Exception() 80 bOK = false 81 resume next 82End Sub 83</script:module> 84