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="awt_XTimeField" 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.awt.XTimeField 41'************************************************************************* 42On Error Goto ErrHndl 43 Dim bOK As Boolean 44 Dim oldVal, newVal As Variant 45 46 Test.StartMethod("getTime()") 47 Test.StartMethod("setTime()") 48 bOK = true 49 oldVal = oObj.getTime() 50 Out.Log("value before: "+oldVal) 51 oObj.setTime(oldVal+20) 52 newVal = oObj.getTime() 53 Out.Log("value after: "+newVal) 54 bOK = bOK AND (oldVal <> newVal) 55 Test.MethodTested("setTime()", bOK) 56 Test.MethodTested("getTime()", bOK) 57 58 Test.StartMethod("getMin()") 59 Test.StartMethod("setMin()") 60 bOK = true 61 oldVal = oObj.getMin() 62 Out.Log("value before: "+oldVal) 63 oObj.setMin(oldVal+20) 64 newVal = oObj.getMin() 65 Out.Log("value after: "+newVal) 66 bOK = bOK AND (oldVal <> newVal) 67 Test.MethodTested("setMin()", bOK) 68 Test.MethodTested("getMin()", bOK) 69 70 Test.StartMethod("getMax()") 71 Test.StartMethod("setMax()") 72 bOK = true 73 oldVal = oObj.getMax() 74 Out.Log("value before: "+oldVal) 75 oObj.setMax(oldVal+20) 76 newVal = oObj.getMax() 77 Out.Log("value after: "+newVal) 78 bOK = bOK AND (oldVal <> newVal) 79 Test.MethodTested("setMax()", bOK) 80 Test.MethodTested("getMax()", bOK) 81 82 Test.StartMethod("getFirst()") 83 Test.StartMethod("setFirst()") 84 bOK = true 85 oldVal = oObj.getFirst() 86 Out.Log("value before: "+oldVal) 87 oObj.setFirst(oldVal+20) 88 newVal = oObj.getFirst() 89 Out.Log("value after: "+newVal) 90 bOK = bOK AND (oldVal <> newVal) 91 Test.MethodTested("setFirst()", bOK) 92 Test.MethodTested("getFirst()", bOK) 93 94 Test.StartMethod("getLast()") 95 Test.StartMethod("setLast()") 96 bOK = true 97 oldVal = oObj.getLast() 98 Out.Log("value before: "+oldVal) 99 oObj.setLast(oldVal+20) 100 newVal = oObj.getLast() 101 Out.Log("value after: "+newVal) 102 bOK = bOK AND (oldVal <> newVal) 103 Test.MethodTested("setLast()", bOK) 104 Test.MethodTested("getLast()", bOK) 105 106 107 Test.StartMethod("isEmpty()") 108 Test.StartMethod("setEmpty()") 109 bOK = true 110 oldVal = oObj.isEmpty() 111 if ( NOT oldVal) then 112 oObj.setEmpty() 113 bOK = oObj.isEmpty() 114 endif 115 Test.MethodTested("setEmpty()", bOK) 116 Test.MethodTested("isEmpty()", bOK) 117 118 Test.StartMethod("isStrictFormat()") 119 Test.StartMethod("setStrictFormat()") 120 bOK = true 121 oldVal = oObj.isStrictFormat() 122 Out.Log("value before: "+oldVal) 123 if (oldVal) then 124 oObj.setStrictFormat(false) 125 else 126 oObj.setStrictFormat(true) 127 endif 128 newVal = oObj.isStrictFormat() 129 Out.Log("value after: "+newVal) 130 bOK = bOK AND (oldVal <> newVal) 131 Test.MethodTested("setStrictFormat()", bOK) 132 Test.MethodTested("isStrictFormat()", bOK) 133 134Exit Sub 135ErrHndl: 136 Test.Exception() 137 bOK = false 138 resume next 139End Sub 140</script:module> 141