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' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9'
10' Copyright 2000, 2010 Oracle and/or its affiliates.
11'
12' OpenOffice.org - a multi-platform office productivity suite
13'
14' This file is part of OpenOffice.org.
15'
16' OpenOffice.org is free software: you can redistribute it and/or modify
17' it under the terms of the GNU Lesser General Public License version 3
18' only, as published by the Free Software Foundation.
19'
20' OpenOffice.org is distributed in the hope that it will be useful,
21' but WITHOUT ANY WARRANTY; without even the implied warranty of
22' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23' GNU Lesser General Public License version 3 for more details
24' (a copy is included in the LICENSE file that accompanied this code).
25'
26' You should have received a copy of the GNU Lesser General Public License
27' version 3 along with OpenOffice.org.  If not, see
28' <http://www.openoffice.org/license.html>
29' for a copy of the LGPLv3 License.
30'
31'*************************************************************************
32'*************************************************************************
33
34
35
36' Be sure that all variables are dimensioned:
37option explicit
38
39
40
41Sub RunTest()
42
43'*************************************************************************
44' INTERFACE:
45' com.sun.star.awt.XTimeField
46'*************************************************************************
47On Error Goto ErrHndl
48    Dim bOK As Boolean
49    Dim oldVal, newVal As Variant
50
51    Test.StartMethod("getTime()")
52    Test.StartMethod("setTime()")
53    bOK = true
54    oldVal = oObj.getTime()
55    Out.Log("value before: "+oldVal)
56    oObj.setTime(oldVal+20)
57    newVal = oObj.getTime()
58    Out.Log("value after: "+newVal)
59    bOK = bOK AND (oldVal &lt;&gt; newVal)
60    Test.MethodTested("setTime()", bOK)
61    Test.MethodTested("getTime()", bOK)
62
63    Test.StartMethod("getMin()")
64    Test.StartMethod("setMin()")
65    bOK = true
66    oldVal = oObj.getMin()
67    Out.Log("value before: "+oldVal)
68    oObj.setMin(oldVal+20)
69    newVal = oObj.getMin()
70    Out.Log("value after: "+newVal)
71    bOK = bOK AND (oldVal &lt;&gt; newVal)
72    Test.MethodTested("setMin()", bOK)
73    Test.MethodTested("getMin()", bOK)
74
75    Test.StartMethod("getMax()")
76    Test.StartMethod("setMax()")
77    bOK = true
78    oldVal = oObj.getMax()
79    Out.Log("value before: "+oldVal)
80    oObj.setMax(oldVal+20)
81    newVal = oObj.getMax()
82    Out.Log("value after: "+newVal)
83    bOK = bOK AND (oldVal &lt;&gt; newVal)
84    Test.MethodTested("setMax()", bOK)
85    Test.MethodTested("getMax()", bOK)
86
87    Test.StartMethod("getFirst()")
88    Test.StartMethod("setFirst()")
89    bOK = true
90    oldVal = oObj.getFirst()
91    Out.Log("value before: "+oldVal)
92    oObj.setFirst(oldVal+20)
93    newVal = oObj.getFirst()
94    Out.Log("value after: "+newVal)
95    bOK = bOK AND (oldVal &lt;&gt; newVal)
96    Test.MethodTested("setFirst()", bOK)
97    Test.MethodTested("getFirst()", bOK)
98
99    Test.StartMethod("getLast()")
100    Test.StartMethod("setLast()")
101    bOK = true
102    oldVal = oObj.getLast()
103    Out.Log("value before: "+oldVal)
104    oObj.setLast(oldVal+20)
105    newVal = oObj.getLast()
106    Out.Log("value after: "+newVal)
107    bOK = bOK AND (oldVal &lt;&gt; newVal)
108    Test.MethodTested("setLast()", bOK)
109    Test.MethodTested("getLast()", bOK)
110
111
112    Test.StartMethod("isEmpty()")
113    Test.StartMethod("setEmpty()")
114    bOK = true
115    oldVal = oObj.isEmpty()
116    if ( NOT oldVal) then
117        oObj.setEmpty()
118        bOK = oObj.isEmpty()
119    endif
120    Test.MethodTested("setEmpty()", bOK)
121    Test.MethodTested("isEmpty()", bOK)
122
123    Test.StartMethod("isStrictFormat()")
124    Test.StartMethod("setStrictFormat()")
125    bOK = true
126    oldVal = oObj.isStrictFormat()
127    Out.Log("value before: "+oldVal)
128    if (oldVal) then
129        oObj.setStrictFormat(false)
130    else
131        oObj.setStrictFormat(true)
132    endif
133    newVal = oObj.isStrictFormat()
134    Out.Log("value after: "+newVal)
135    bOK = bOK AND (oldVal &lt;&gt; newVal)
136    Test.MethodTested("setStrictFormat()", bOK)
137    Test.MethodTested("isStrictFormat()", bOK)
138
139Exit Sub
140ErrHndl:
141    Test.Exception()
142    bOK = false
143    resume next
144End Sub
145</script:module>
146