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