1 'encoding UTF-8 Do not remove or change this line!
2 '**************************************************************************
3 '* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 '* Copyright 2008 by Sun Microsystems, Inc.
7 '* OpenOffice.org - a multi-platform office productivity suite
9 '* $RCSfile: rpt_DateTime.inc,v $
13 '* last change: $Author: jsi $ $Date: 2008-06-16 07:43:42 $
15 '* This file is part of OpenOffice.org.
17 '* OpenOffice.org is free software: you can redistribute it and/or modify
18 '* it under the terms of the GNU Lesser General Public License version 3
19 '* only, as published by the Free Software Foundation.
21 '* OpenOffice.org is distributed in the hope that it will be useful,
22 '* but WITHOUT ANY WARRANTY; without even the implied warranty of
23 '* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 '* GNU Lesser General Public License version 3 for more details
25 '* (a copy is included in the LICENSE file that accompanied this code).
27 '* You should have received a copy of the GNU Lesser General Public License
28 '* version 3 along with OpenOffice.org. If not, see
29 '* <http://www.openoffice.org/license.html>
30 '* for a copy of the LGPLv3 License.
32 '/************************************************************************
34 '* owner : marc.neumann@sun.com
36 '* short description : Date Time Dialog
38 '\***********************************************************************************
41 printlog "------------------ rpt_DateTime.inc ---------------------"
47 '-------------------------------------------------------------------------
48 '-------------------------------------------------------------------------
49 '-------------------------------------------------------------------------
50 testcase tDefaultSetting
52 '/// FILE / OPEN / biblio.odb
53 printlog "FILE / OPEN / biblio.odb"
54 call fOpenDataBase(gOfficePath + ConvertPath("user/database/biblio.odb"))
57 printlog "INSERT / REPORT"
58 call fOpenNewReportDesign
62 '/// select any section to get the insert page number menu item activated
63 printlog "select any section to get the insert page number menu item activated"
64 Kontext "ReportDesign"
65 ReportDesign.MouseDown(50, 10)
66 ReportDesign.MouseUp(50, 10)
68 '/// INSERT / DATE TIME
69 Kontext "ReportDesign"
75 '/// check if the "Date Time" dialog appear
76 printlog "check if the ""Date Time"" dialog appear"
77 Kontext "ReportDateTime"
78 if (ReportDateTime.exists(3)) then
80 '/// check if ""IncludeDate"" is checked
81 printlog "check if ""IncludeDate"" is checked"
82 if ( IncludeDate.isChecked() ) then
83 printlog "Default ""IncludeDate"" is checked"
85 warnlog "Default ""IncludeDate"" is not checked"
88 '/// check if the date format list box is enabled
89 printlog "check if the date format list box is enabled"
90 if DateFormat.isEnabled() then
91 printlog "Date fomat List box is enabled"
93 printlog "Date fomat List box is disabled"
96 '/// check if ""IncludeTime"" is checked
97 printlog "check if ""IncludeTime"" is checked"
98 if ( IncludeTime.isChecked() ) then
99 printlog "Default ""IncludeTime"" is checked"
101 warnlog """IncludeTime"" is not checked"
104 '/// check if the time format list box is enabled
105 printlog "check if the time format list box is enabled"
106 if TimeFormat.isEnabled() then
107 printlog "Time fomat list box is enabled"
109 printlog "Time fomat Llst box is disabled"
112 '/// close dialog with OK
113 printlog "close dialog with OK"
116 warnlog "ReportDateTime doesn't exists"
119 '/// close the report designer with WINDOW / CLOSE
120 printlog "close the report designer with WINDOW / CLOSE"
121 call fCloseReportDesign
123 '/// close the database with FILE / CLOSE
124 printlog "close the database with FILE / CLOSE"
128 '-------------------------------------------------------------------------
131 '/// open Bibliography database
132 printlog "open Bibliography database"
133 call fOpenDataBase(gOfficePath + ConvertPath("user/database/biblio.odb"))
135 '/// open the report designer
136 printlog "open the report designer"
137 call fOpenNewReportDesign
141 '/// select the first table in the content list box
142 printlog "select the first table in the content list box"
143 Kontext "ReportDataProperties"
145 Content.typeKeys("<RETURN>",true) ' important to leave the listbox
147 'close the Add Field dialog to get the focus back to the design
148 call fCloseAddFieldDialog
150 '/// turn off the page header
151 call fSwitchPageHeader
153 '/// insert a data control
154 printlog "insert a data control"
155 Kontext "FormControls"
159 Kontext "ReportDesign"
160 ReportDesign.MouseDown ( 30, 10 )
161 ReportDesign.MouseMove ( 40, 20 )
162 ReportDesign.MouseUp ( 40, 20 )
164 Kontext "ReportDesign"
170 '/// select the first field in the property browser for this control
171 printlog "select the first field in the property browser for this control"
172 Kontext "ReportPropertiesTabControl"
173 ReportPropertiesTabControl.setPage ReportDataProperties
175 Kontext "ReportDataProperties"
177 DataField.typeKeys("<RETURN>",true) ' important to leave the listbox
179 ' select detail section with unselect the control
180 Kontext "ReportDesign"
181 ReportDesign.MouseDown(50, 10)
182 ReportDesign.MouseUp(50, 10)
184 '/// set the Detail sectio to the minial height
185 printlog "set the Detail sectio to the minial height"
186 Kontext "ReportGeneralProperties"
188 Height.typeKeys("<RETURN>",true)
190 '/// tunr on pageHeader again
191 call fSwitchPageHeader
193 '/// select the page header
194 Kontext "ReportDesign"
195 ReportDesign.MouseDown(50, 10)
196 ReportDesign.MouseUp(50, 10)
198 '/// INSERT / DATE TIME
199 Kontext "ReportDesign"
206 '/// check the 3. date and time option
207 printlog "check the 3. date and time option"
208 Kontext "ReportDateTime"
212 '/// close dialog with OK
213 printlog "close dialog with OK"
218 '/// select the date field and check if the date field contain the function TODAY()
219 printlog "select the date field and check if the date field contain the function TODAY()"
220 Kontext "ReportDesign"
221 ReportDesign.typeKeys("<TAB>",true)
223 Kontext "ReportPropertiesTabControl"
224 ReportPropertiesTabControl.setPage ReportDataProperties
226 Kontext "ReportDataProperties"
228 s = DataField.getSelText()
229 if (instr(s,"TODAY()") = 0) then
230 warnlog "The date function is not correct.The function is " + s
232 printlog "The date function is correct."
235 '/// select the time field and check if the data field contains the function now()
236 printlog "select the time field and check if the data field contains the function now()"
237 Kontext "ReportDesign"
238 ReportDesign.typeKeys("<MOD1 F6>",true) ' go to the document window
240 ReportDesign.typeKeys("<MOD1 F6>",true) ' really go to the document window
242 ReportDesign.typeKeys("<TAB>",true)
245 Kontext "ReportPropertiesTabControl"
246 ReportPropertiesTabControl.setPage ReportDataProperties
248 Kontext "ReportDataProperties"
249 s = DataField.getSelText()
250 if (instr(s,"NOW()") = 0) then
251 warnlog "The time function is not correct.The function is " + s
253 printlog "The time function is correct."
256 '/// execute the report
261 '/// check if the report is created
262 printlog "check if the report is created"
263 Kontext "DocumentWriter"
264 if (DocumentWriter.exists(10)) then
265 hFileSaveAsKill(gOfficePath + ConvertPath("user/work/report_date_time.odt"))
266 call fCloseReportView
268 warnlog "No report is created."
271 '/// close the report designer with WINDOW / CLOSE
272 printlog "close the report designer with WINDOW / CLOSE"
273 call fCloseReportDesign
275 '/// close the database with FILE / CLOSE
276 printlog "close the database with FILE / CLOSE"
281 '---- check the saved report with SAX parser
282 dim iNumberOfChilds as integer
285 UnpackStorage( gOfficePath & ConvertPath("user/work/report_date_time.odt") , gOfficePath & ConvertPath("user/work/report_date_time") )
287 SAXReadFile(gOfficePath & ConvertPath("user/work/report_date_time/content.xml"))
289 SAXSeekElement("office:document-content")
290 SAXSeekElement("office:body")
291 SAXSeekElement("office:text")
292 SAXSeekElement("table:table")
294 iNumberOfChilds = SAXGetChildCount
295 'print iNumberOfChilds
300 '--- end of SAX check
303 '-------------------------------------------------------------------------