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_ExecuteReport.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 : Execute Report
38 '\***********************************************************************************
41 printlog "------------------ rpt_ExecuteReport.inc ---------------------"
46 '-------------------------------------------------------------------------
47 '-------------------------------------------------------------------------
48 '-------------------------------------------------------------------------
51 if (iSprache = 7) then
52 qaerrorlog "due to issue i94729 this testcase does not work under russian."
56 '/// open Bibliography database
57 printlog "open Bibliography database"
58 call fOpenDataBase(gOfficePath + ConvertPath("user/database/biblio.odb"))
60 '/// open the report designer
61 printlog "open the report designer"
62 call fOpenNewReportDesign
66 '/// select the first table in the content list box
67 printlog "select the first table in the content list box"
68 Kontext "ReportDataProperties"
70 Content.typeKeys("<RETURN>",true) ' important to leave the listbox
72 'close the Add Field dialog to get the focus back to the design
73 call fCloseAddFieldDialog
75 '/// turn of the page header
76 call fSwitchPageHeader
78 '/// insert a data control
79 printlog "insert a data control"
80 Kontext "FormControls"
84 Kontext "ReportDesign"
85 ReportDesign.MouseDown ( 30, 10 )
86 ReportDesign.MouseMove ( 40, 20 )
87 ReportDesign.MouseUp ( 40, 20 )
88 '/// align the control top left
89 printlog "align the control top left"
90 Kontext "ReportDesign"
93 sleep(1) ' need a sleep before using the propety browser
94 Kontext "ReportPropertiesTabControl"
95 ReportPropertiesTabControl.setPage ReportDataProperties
97 '/// bind the first field of the tabel to the control
98 printlog "bind the first field of the tabel to the control"
99 Kontext "ReportDataProperties"
101 DataField.typeKeys("<RETURN>",true) ' important to leave the listbox
103 Kontext "ReportPropertiesTabControl"
104 ReportPropertiesTabControl.setPage ReportGeneralProperties
108 '/// select the 11. color (light green) for the background color
109 printlog "select the 11. color (light green) for the background color"
110 Kontext "ReportGeneralProperties"
111 ControlBackgroundTransparent.select 1
113 BackGroundColor.select 11
116 Height.typeKeys("<RETURN>",true)
118 ' select detail section with unselect the control
119 Kontext "ReportDesign"
120 ReportDesign.MouseDown(50, 10)
121 ReportDesign.MouseUp(50, 10)
123 Kontext "ReportGeneralProperties"
125 Height.typeKeys("<RETURN>",true)
129 '/// execute the report
130 printlog "execute the report"
135 '/// check if the report is created
136 printlog "check if the report is created"
137 Kontext "DocumentWriter"
138 if (DocumentWriter.exists(10)) then
139 hFileSaveAsKill(gOfficePath + ConvertPath("user/work/report01.odt"))
140 call fCloseReportView
142 warnlog "No report is created."
145 '/// close the report designer
146 printlog "close the report designer"
147 call fCloseReportDesign
149 '/// close the database
150 printlog "close the database"
153 '---- check the saved report with SAX parser
154 dim iNumberOfChilds as integer
157 UnpackStorage( gOfficePath & ConvertPath("user/work/report01.odt") , gOfficePath & ConvertPath("user/work/report01") )
159 SAXReadFile(gOfficePath & ConvertPath("user/work/report01/content.xml"))
161 SAXSeekElement("office:document-content")
162 SAXSeekElement("office:body")
163 SAXSeekElement("office:text")
164 SAXSeekElement("table:table")
166 iNumberOfChilds = SAXGetChildCount
168 dim iCount as integer
170 for iLoop = 1 to iNumberOfChilds
171 SAXSeekElement(iLoop)
172 if ( SAXGetElementName() = "table:table-row" ) then
178 if (iCount <> 59 ) then
179 warnlog "there should be 59 rows in the table, but there are " + iNumberOfChilds
183 SAXSeekElement("table:table-row",10)
185 ' printlog SAXGetChildCount
186 SAXSeekElement("table:table-cell")
187 SAXSeekElement("text:p")
191 if (sText <> "SUN02") then
192 warnlog "The text in the 10. row should be GRA00, but it is " + sText
195 'check background color
197 SAXSeekElement("office:document-content")
198 SAXSeekElement("office:body")
199 SAXSeekElement("office:text")
200 SAXSeekElement("table:table")
201 SAXSeekElement("table:table-row",10)
202 SAXSeekElement("table:table-cell")
203 SAXSeekElement("text:p")
207 sStyle = SAXGetAttributeValue("text:style-name")
210 dim iChildCount as integer
211 dim iChildNumber as integer
212 dim sBackgroundColor as string
215 SAXSeekElement("office:document-content")
216 SAXSeekElement("office:automatic-styles")
218 for iChildNumber = 1 to iChildCount
220 SAXSeekElement("office:document-content")
221 SAXSeekElement("office:automatic-styles")
222 SAXSeekElement(iChildNumber)
223 'printlog SAXGetAttributeValue("style:name")
224 if SAXGetAttributeValue("style:name") = sStyle then
225 SAXSeekElement("style:paragraph-properties")
226 sBackgroundColor = SAXGetAttributeValue("fo:background-color")
227 if sBackgroundColor <> "#00ff00" then
228 warnlog "wrong color. It should be #00ff00 but it is " + sBackgroundColor
230 'printlog "right color"
236 '--- end of SAX check
239 '-------------------------------------------------------------------------