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