jl165 merging heads
[LibreOffice.git] / testautomation / xml / required / includes / oasis_graphics_01.inc
blob9c323d46386bb93e3cfc8474edce143a04f73d85
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 2000, 2010 Oracle and/or its affiliates.
7 ' OpenOffice.org - a multi-platform office productivity suite
9 ' This file is part of OpenOffice.org.
11 ' OpenOffice.org is free software: you can redistribute it and/or modify
12 ' it under the terms of the GNU Lesser General Public License version 3
13 ' only, as published by the Free Software Foundation.
15 ' OpenOffice.org is distributed in the hope that it will be useful,
16 ' but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 ' GNU Lesser General Public License version 3 for more details
19 ' (a copy is included in the LICENSE file that accompanied this code).
21 ' You should have received a copy of the GNU Lesser General Public License
22 ' version 3 along with OpenOffice.org.  If not, see
23 ' <http://www.openoffice.org/license.html>
24 ' for a copy of the LGPLv3 License.
26 '/************************************************************************
28 '* owner : wolfram.garten@oracle.com
30 '* short description : Library 01 for OASIS OpenDocument File Format (Presentation and Drawing) test
32 '************************************************************************
34 ' #1 talien_attributes                  ' Verification that alian attributes will be stored in document.
35 ' #1 t_all_header_footer                ' http://specs.openoffice.org/impress/header_and_footer.sxw
36 ' #1 t_no_header_footer                 ' http://specs.openoffice.org/impress/header_and_footer.sxw
37 ' #1 t_no_header_footer_master_elements ' http://specs.openoffice.org/impress/header_and_footer.sxw
38 ' #1 t_some_header_footer               ' http://specs.openoffice.org/impress/header_and_footer.sxw
40 '\***********************************************************************
42 testcase talien_attributes
43     Dim i as integer
44     Dim AttrNameInDOM as string
45     Dim sPropertyElement as string
46     Dim sLogAttributeName as string
47     Dim sAttributeSearch(9) as string
48     Dim sAttributeValue(9) as string
50     printlog "+- Presentation: alien.odp"
51     '/// Opening alien.sxi. ///
52     call hFileOpen (gTesttoolPath & ConvertPath("xml\required\input\graphics\alien_attributes\alien_attributes_presentation.odp"))
53     '/// Saving document. ///
54     if hFileSaveAsWithFilterKill (gOfficePath & ConvertPath("user\work\xml\graphics\update\alien_attributes_presentation.odp") , "impress8") = TRUE then
55         '/// Closing document. ///
56         call hCloseDocument
57         '/// Unpacking the compressed (ZIP) archive.
58         UnpackStorage( gOfficePath & ConvertPath("user\work\xml\graphics\update\alien_attributes_presentation.odp") , gOfficePath & ConvertPath("user\work\xml\graphics\update\alien_attributes_presentation\") )
59         '/// Verifying the well-formness of styles.xml, content.xml and meta.xml.
60         '///+ Only if the three XML files are well formed the next checks (GPF-check, attribute-search) will be started.
61         if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\graphics\update\alien_attributes_presentation\styles.xml")) = TRUE then        
62             if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\graphics\update\alien_attributes_presentation\meta.xml")) = TRUE then       
63                 if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\graphics\update\alien_attributes_presentation\content.xml")) = TRUE then
64                     '/// Opening exported document (GPF check). ///
65                     call hFileOpen (gOfficePath & ConvertPath("user\work\xml\graphics\update\alien_attributes_presentation.odp")
66                     sleep(2)
67                     '/// Closing document. ///
68                     call hCloseDocument
69                     sleep(2)
70                     SAXReadFile(gOfficePath & ConvertPath("user\work\xml\graphics\update\alien_attributes_presentation\content.xml"))
71                     printlog "-----------------"
72                     printlog "Hidden Namespaces"
73                     printlog "-----------------"
74                     '/// <u><b>content.xml</u></b>
75                     '/// <u>Hidden attributes in namespaces</u>
76                     '///+ Searching for: xmlns:alien=&quot;http://openoffice.org/2000/alien&quot;
77                     '-------------------------------------------------------------------------
78                     sAttributeSearch(1) = "xmlns:alien"
79                     sAttributeValue(1) = "http://openoffice.org/2000/alien"
80                     printlog "++ Feature(s) to be searched for:"
81                     printlog " |"
82                     '-------------------------------------------------------------------------
83                     SAXSeekElement("office:document-content")
84                     printlog " +- " & sAttributeSearch(1)
85                     if SAXGetAttributeValue(sAttributeSearch(1)) <> sAttributeValue(1) then
86                         warnlog "Hidden attributes (in namespace): " & sAttributeSearch(1) & " is not " & sAttributeValue(1) & "!"
87                     end if
88                     printlog "    * * *"
89                     SAXSeekElement("/")
90                     '/// <u>hidden attributes</u>
91                     '///+<ol><li><b>in a drawing-page style</b></li>
92                     '///+<li><b>in a graphics style</b></li>
93                     '///+<li><b>in a paragraph style (twice)</b></li>
94                     '///+<li><b>in a text style</b></li></ol>
95                     '///+ Searching for: alien:key=&quot;page&quot;
96                     '///+ Searching for: alien:key=&quot;shape&quot;
97                     '///+ Searching for: alien:key=&quot;para&quot;
98                     '///+ Searching for: alien:key=&quot;shape-text&quot;
99                     '///+ Searching for: alien:key=&quot;text&quot;
100                      
101                     'The number behind the string variable is the position
102                     'in the DOM-tree. The search is hard coded because the
103                     'export of the same file should not change in the lifetime
104                     'cycle.
105                 
106                     sAttributeSearch(1) = "alien:key"
107                     sAttributeValue(1) = "page"
108                 
109                     sAttributeSearch(3) = "alien:key"
110                     sAttributeValue(3) = "shape"
111                 
112                     sAttributeSearch(6) = "alien:key"
113                     sAttributeValue(6) = "para"
114                 
115                     sAttributeSearch(7) = "alien:key"
116                     sAttributeValue(7) = "shape-text"
117                 
118                     sAttributeSearch(9) = "alien:key"
119                     sAttributeValue(9) = "text"
120                     '-------------------------------------------------------------------------
121                     printlog "++ Feature(s) to be searched for:"
122                     printlog " |"
123                     '-------------------------------------------------------------------------
124                     for i = 1 to 9
125                         select case i
126                             case 1      :   printlog "-----------------------------------------"                    
127                                             printlog "Hidden attributes in a drawing-page style"
128                                             printlog "-----------------------------------------"
129                                             sPropertyElement = "style:drawing-page-properties"
130                                             sLogAttributeName = "drawing-page"
131                             case 3      :   printlog "-------------------------------------"
132                                             printlog "Hidden attributes in a graphics style"
133                                             printlog "-------------------------------------"
134                                             sPropertyElement = "style:graphic-properties"
135                                             sLogAttributeName = "graphics"      
136                             case 6, 7   :   printlog "-------------------------------------------"
137                                             printlog "Hidden attributes in a paragraph style (" & i-4 & ")"
138                                             printlog "-------------------------------------------"
139                                             sPropertyElement = "style:paragraph-properties"
140                                             sLogAttributeName = "paragraph"       
141                             case 9      :   printlog "---------------------------------"
142                                             printlog "Hidden attributes in a text style"
143                                             printlog "---------------------------------"
144                                             sPropertyElement = "style:text-properties"
145                                             sLogAttributeName = "text"
146                         end select
147                         if i = 1 or i = 3 or i = 6 or i = 7 or i = 9 then
148                             'The hidden attributes are in a known sequence included,
149                             'so the same routine will be used for different styles!
150                             SAXSeekElement("/")
151                             SAXSeekElement("office:document-content")
152                             SAXSeekElement("office:automatic-styles")
153                             SAXSeekElement("style:style" , i )
154                             AttrNameInDOM = SAXGetAttributeValue("style:name")
155                             printlog " + style:style position in DOM: " & i & ". Attribute name: " & AttrNameInDOM
156                             printlog " |"       
157                 
158                             'It depends on the type of element (drawing-page, paragraphic, graphics, ...)
159                             'which is the next element. That is a difference to OOo XML 1.0 where everything
160                             'called 'style:properties'.
161                 
162                             SAXSeekElement(sPropertyElement)
163                             printlog " +- " & sAttributeSearch(i)
164                             if SAXGetAttributeValue(sAttributeSearch(i)) <> sAttributeValue(i) then          
165                                 warnlog "Hidden attributes (in a " & sLogAttributeName & " style): " & sAttributeSearch(i) & " is not " & sAttributeValue(i) & "!"
166                             end if
167                         end if
168                     next i
169                     SAXSeekElement("/")
170                     printlog "    * * *"
171                     '-------------------------------------------------------------------------
172                     '/// Closing the XML DOM.
173                     SAXRelease()
174                     '/// Opening the DOM of styles.xml.
175                     SAXReadFile(gOfficePath & ConvertPath("user\work\xml\graphics\update\alien_attributes_presentation\styles.xml"))
176                     '-------------------------------------------------------------------------
177                     printlog "-------------------"
178                     printlog "s t y l e s . x m l"
179                     printlog "-------------------"
180                     printlog "-----------------"
181                     printlog "Hidden Namespaces"
182                     printlog "-----------------"
183                     '/// <u><b>styles.xml</u></b>
184                     '/// <u>Hidden attributes in namespaces</u>
185                     '///+ Searching for: xmlns:alien=&quot;http://openoffice.org/2000/alien&quot;
186                     '-------------------------------------------------------------------------
187                     sAttributeSearch(1) = "xmlns:alien"
188                     sAttributeValue(1) = "http://openoffice.org/2000/alien"
189                     printlog "++ Feature(s) to be searched for:"
190                     printlog " |"
191                     '-------------------------------------------------------------------------
192                     SAXSeekElement("office:document-styles")
193                     printlog " +- " & sAttributeSearch(1)
194                     if SAXGetAttributeValue(sAttributeSearch(1)) <> sAttributeValue(1) then
195                         warnlog "Hidden attributes (in namespace): " & sAttributeSearch(1) & " is not " & sAttributeValue(1) & "!"
196                     end if
197                     printlog "    * * *"
198                     SAXSeekElement("/")
199                     printlog "----------------------------------------"
200                     printlog "Hidden attributes in a master-page style"
201                     printlog "----------------------------------------"
202                     '-------------------------------------------------------------------------
203                     '/// <u>hidden attributes</u>
204                     '///+<ol><li><b>in a master-page style</b></li></ol>
205                     '///+ Searching for: alien:key=&quot;master-page&quot;
206                     '-------------------------------------------------------------------------
207                     sAttributeSearch(1) = "alien:key"
208                     sAttributeValue(1) = "master-page"
209                     printlog "++ Feature(s) to be searched for:"
210                     printlog " |"
211                     '-------------------------------------------------------------------------
212                     SAXSeekElement("office:document-styles")
213                     SAXSeekElement("office:automatic-styles")
214                     SAXSeekElement("style:style")
215                     SAXSeekElement("style:drawing-page-properties")
216                     printlog " +- " & sAttributeSearch(1)
217                     if SAXGetAttributeValue(sAttributeSearch(1)) <> sAttributeValue(1) then
218                         warnlog "Hidden attributes (in master-page style): " & sAttributeSearch(1) & " is not " & sAttributeValue(1) & "!"
219                     end if
220                     printlog "    * * *"
221                     '-------------------------------------------------------------------------
222                     SAXRelease()
223                 else
224                     warnlog "One of the XML files not well formed!"
225                 end if
226             end if
227         end if
228     else
229         warnlog "It was not possible to save the document as XML!"
230     end if
231 endcase
233 '-------------------------------------------------------------------------
235 testcase t_all_header_footer
236     Dim iPresAttr as integer
237     Dim sAttributeSearch(4) as string
238     Dim sAttributeValue(4) as string
239     Dim sHeaderInNotes as string
240     
241     printlog "+- Presentation: allheaderfooter_fixed.odp"
242     '/// Opening <i>xml\required\input\graphics\header_footer\allheaderfooter_fixed.odp</i>.
243     call hFileOpen (gTesttoolPath & ConvertPath("xml\required\input\graphics\header_footer\allheaderfooter_fixed.odp"))
244     '/// Saving document as <i>user\work\xml\graphics\update\allheaderfooter_fixed.odp</i> with default presentation document name.
245     if hFileSaveAsWithFilterKill (gOfficePath & ConvertPath("user\work\xml\graphics\update\allheaderfooter_fixed.odp") , "impress8") = TRUE then
246         '/// Closing document.
247         call hCloseDocument
248         '/// Unpacking the compressed (ZIP) archive. Putting the content to <i>user\work\xml\graphics\update\allheaderfooter_fixed\</i>"
249         UnpackStorage( gOfficePath & ConvertPath("user\work\xml\graphics\update\allheaderfooter_fixed.odp") , gOfficePath & ConvertPath("user\work\xml\graphics\update\allheaderfooter_fixed\") )
250         '/// Verifying the well-formness of styles.xml, content.xml and meta.xml.
251         '///+ Only if the three XML files are well formed the next checks (GPF-check, attribute-search) will be started.
252         if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\graphics\update\allheaderfooter_fixed\styles.xml")) = TRUE then        
253             if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\graphics\update\allheaderfooter_fixed\meta.xml")) = TRUE then       
254                 if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\graphics\update\allheaderfooter_fixed\content.xml")) = TRUE then
255                     '/// Opening exported document (GPF check). ///
256                     call hFileOpen (gOfficePath & ConvertPath("user\work\xml\graphics\update\allheaderfooter_fixed.odp")
257                     sleep(2)
258                     '/// Closing document. ///
259                     call hCloseDocument
260                     sleep(2)
261                     '/// <u><b>content.xml</u></b>
262                     '/// Opening user\work\xml\graphics\update\allheaderfooter_fixed\content.xml with SAX parser.
263                     '/// Searching for <ul>
264                     '///+<li>&lt;presentation:header-decl presentation:name=&quot;hdr1&quot;&gt;Header in notes/handout  powered by QA&lt;/presentation:header-decl&gt;
265                     '///+<li>&lt;presentation:footer-decl presentation:name=&quot;ftr1&quot;&gt;footer powered by QA&lt;/presentation:footer-decl&gt;
266                     '///+<li>&lt;presentation:footer-decl presentation:name=&quot;ftr2&quot;&gt;Footer notes/handout  powered by QA&lt;/presentation:footer-decl&gt;
267                     '///+<li>&lt;presentation:date-time-decl presentation:name=&quot;dtd1&quot; presentation:source=&quot;fixed&quot;&gt;09.12.2001&lt;/presentation:date-time-decl&gt;</ul>                    
268                     sAttributeSearch(1) = "presentation:header-decl"
269                     sAttributeValue(1) = "Header in notes/handout  powered by QA"
270                     sAttributeSearch(2) = "presentation:footer-decl"
271                     sAttributeValue(2) = "footer powered by QA"
272                     sAttributeSearch(3) = "presentation:footer-decl"
273                     sAttributeValue(3) = "Footer notes/handout  powered by QA"
274                     sAttributeSearch(4) = "presentation:date-time-decl"
275                     sAttributeValue(4) = "09.12.2001"
276                     
277                     SAXReadFile(gOfficePath & ConvertPath("user\work\xml\graphics\update\allheaderfooter_fixed\content.xml"))                    
278                         for iPresAttr = 1 to 4                        
279                             '/// Parsing to office:document-content
280                             SAXSeekElement("office:document-content")
281                             '/// Parsing to office:body
282                             SAXSeekElement("office:body")
283                             '/// Parsing to office:presentation                    
284                             SAXSeekElement("office:presentation")
285                             '/// Parsing to <ol><li>presentation:header-decl</li>
286                             '///+ <li>presentation:footer-decl</li>
287                             '///+ <li>presentation:footer-decl</li>                           
288                             '///+ <li>presentation:date-time-decl</li></ol>
289                             if iPresAttr = 3 then
290                                 'To reach the second 'presentation:footer-decl'-element an additional parameter is needed. 
291                                 SAXSeekElement(sAttributeSearch(iPresAttr) , 2)
292                             else
293                                 SAXSeekElement(sAttributeSearch(iPresAttr))
294                             end if
295                             '/// Parsing 1 node deeper (to get the CharNode)                     
296                             SAXSeekElement(1)
297                             '/// Reading the characters of the CharNode and verifying it against the reference.
298                             ' Initializing the variable (empty)
299                             sHeaderInNotes = ""                    
300                             sHeaderInNotes = SAXGetChars
301                             if sHeaderInNotes <> sAttributeValue(iPresAttr) then
302                                 warnlog "Failed! - Attribute '" & sAttributeSearch(iPresAttr) & "' has the value '" & sHeaderInNotes & "' but it has to be '" & sAttributeValue(iPresAttr) & "'."                                 
303                             else
304                                 printlog "Passed. - Attribute '" & sAttributeSearch(iPresAttr) & "' has the correct value '" & sHeaderInNotes & "'." 
305                             end if
306                             SAXSeekElement("/")                            
307                         next iPresAttr
308                     SAXRelease()                    
309                 else
310                     warnlog "One of the XML files not well formed!"
311                 end if
312             end if
313         end if
314     else
315         warnlog "It was not possible to save the document as XML!"
316     end if
317 endcase
319 '-------------------------------------------------------------------------
321 testcase t_no_header_footer
322     Dim sDrawName as string
323     Dim sElementName as string
324     Dim sAttributeSearch(3) as string
325     Dim sAttributeValue as string
326     Dim i as integer
327     Dim iChildsOfAutomaticStyles as integer
328     printlog "+- Presentation: noheaderfooter.odp"
329     '/// Opening <i>xml\required\input\graphics\header_footer\noheaderfooter.odp</i>.
330     call hFileOpen (gTesttoolPath & ConvertPath("xml\required\input\graphics\header_footer\noheaderfooter.odp"))
331     '/// Saving document as <i>user\work\xml\graphics\update\noheaderfooter.odp</i> with default presentation document name.
332     if hFileSaveAsWithFilterKill (gOfficePath & ConvertPath("user\work\xml\graphics\update\noheaderfooter.odp") , "impress8") = TRUE then
333         '/// Closing document. ///
334         call hCloseDocument
335         '/// Unpacking the compressed (ZIP) archive.
336         UnpackStorage( gOfficePath & ConvertPath("user\work\xml\graphics\update\noheaderfooter.odp") , gOfficePath & ConvertPath("user\work\xml\graphics\update\noheaderfooter\") )
337         '/// Verifying the well-formness of styles.xml, content.xml and meta.xml.
338         '///+ Only if the three XML files are well formed the next checks (GPF-check, attribute-search) will be started.
339         if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\graphics\update\noheaderfooter\styles.xml")) = TRUE then        
340             if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\graphics\update\noheaderfooter\meta.xml")) = TRUE then       
341                 if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\graphics\update\noheaderfooter\content.xml")) = TRUE then
342                     '/// Opening exported document (GPF check). ///
343                     call hFileOpen (gOfficePath & ConvertPath("user\work\xml\graphics\update\noheaderfooter.odp")
344                     sleep(2)
345                     '/// Closing document. ///
346                     call hCloseDocument                    
347                     sleep(2)
348                     '/// Opening user\work\xml\graphics\update\noheaderfooter\content.xml with SAX-parser.
349                     SAXReadFile(gOfficePath & ConvertPath("user\work\xml\graphics\update\noheaderfooter\content.xml"))
350                     '/// <ol> 
351                     '///+<li> Parsing to office:document-content
352                     SAXSeekElement("office:document-content")
353                     '///+ Parsing to office:body
354                     SAXSeekElement("office:body")
355                     '///+ Parsing to office:presentation                    
356                     SAXSeekElement("office:presentation")
357                     '///+ Parsing to draw:page
358                     SAXSeekElement("draw:page")
359                     '///+ Get value of draw:style-name
360                     sDrawName = ""
361                     sDrawName = SAXGetAttributeValue ("draw:style-name")
362                     '///+ Get back to the top of DOM</li>                    
363                     SAXSeekElement("/")
364                     '///+<li> Parsing to office:document-content
365                     SAXSeekElement("office:document-content")
366                     '///+ Parsing to office:automatic-styles
367                     SAXSeekElement("office:automatic-styles")
368                     '///+ Look where the style:style element is where the style:name is the same as it was for draw:name
369                     iChildsOfAutomaticStyles = SAXGetChildCount
370                     'The count of style:style nodes is normaly 7 but the 8th is a text:list-style where
371                     'the searched attributes won't be included.
372                     for i = 1 to (iChildsOfAutomaticStyles-1)
373                         SAXSeekElement("style:style" , i)
374                         sElementName = SAXGetAttributeValue("style:name")
375                         if sElementName = sDrawName then
376                         '///+ If found the named attribute (e.g. dp1) parsing to style:drawing-page-properties.  
377                             SAXSeekElement("style:drawing-page-properties")                            
378                             exit for
379                         end if
380                         if i = iChildsOfAutomaticStyles then
381                             '///+ If the style:name is not found a warnlog will be written into the log and the test will be stopped. 
382                             warnlog "Failed! The style:style='" & sDrawName & "' has not been found in the automatic-styles! Test will be aborted here!"
383                             SAXRelease()
384                             goto endsub
385                         end if
386                         'Go one node to the parent node.
387                         SAXSeekElement(0)
388                     next i
389                     '///+Parsing to <ol><li>presentation:display-footer</li>
390                     '///+ <li>presentation:footer-decl</li>
391                     '///+ <li>presentation:display-page-number</li>                           
392                     '///+ <li>presentation:display-date-time</li></ol>                    
393                     sAttributeSearch(1) = "presentation:display-footer"
394                     sAttributeSearch(2) = "presentation:display-page-number"
395                     sAttributeSearch(3) = "presentation:display-date-time"                   
396                     for i = 1 to 3
397                         sAttributeValue = SAXGetAttributeValue(sAttributeSearch(i))
398                         '///+ Verifying that the value of each attribute is 'false'.</li></ol>
399                         if sAttributeValue <> "false" then
400                             warnlog "Failed! The value of '" & sAttributeSearch(i) & "' is NOT 'false'!"
401                         else
402                             printlog "Passed. The value of '" & sAttributeSearch(i) & "' is 'false'."
403                         end if
404                     next i
405                     SAXRelease()
406                 else
407                     warnlog "One of the XML files not well formed!"
408                 end if
409             end if
410         end if
411     else
412         warnlog "It was not possible to save the document as XML!"
413     end if
414 endcase
416 '-------------------------------------------------------------------------
418 testcase t_no_header_footer_master_elements
419     printlog "+- Presentation: nomasterelements.odp"
420     '/// Opening <i>xml\required\input\graphics\header_footer\nomasterelements.odp</i>.
421     call hFileOpen (gTesttoolPath & ConvertPath("xml\required\input\graphics\header_footer\nomasterelements.odp"))
422     '/// Saving document as <i>user\work\xml\graphics\update\nomasterelements.odp</i> with default presentation document name.
423     if hFileSaveAsWithFilterKill (gOfficePath & ConvertPath("user\work\xml\graphics\update\nomasterelements.odp") , "impress8") = TRUE then
424         '/// Closing document. ///
425         call hCloseDocument
426         '/// Unpacking the compressed (ZIP) archive.
427         UnpackStorage( gOfficePath & ConvertPath("user\work\xml\graphics\update\nomasterelements.odp") , gOfficePath & ConvertPath("user\work\xml\graphics\update\nomasterelements\") )
428         '/// Verifying the well-formness of styles.xml, content.xml and meta.xml.
429         '///+ Only if the three XML files are well formed the next checks (GPF-check, attribute-search) will be started.
430         if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\graphics\update\nomasterelements\styles.xml")) = TRUE then        
431             if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\graphics\update\nomasterelements\meta.xml")) = TRUE then       
432                 if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\graphics\update\nomasterelements\content.xml")) = TRUE then
433                     '/// Opening exported document (GPF check). ///
434                     call hFileOpen (gOfficePath & ConvertPath("user\work\xml\graphics\update\nomasterelements.odp")
435                     sleep(2)
436                     '/// Closing document. ///
437                     call hCloseDocument
438                     sleep(2)
439                 else
440                     warnlog "One of the XML files not well formed!"
441                 end if
442             end if
443         end if
444     else
445         warnlog "It was not possible to save the document as XML!"
446     end if
447 endcase
449 '-------------------------------------------------------------------------
451 testcase t_some_header_footer
452     Dim sDrawName as string
453     Dim sElementName as string
454     Dim sAttributeSearch(4) as string
455     Dim sAttributeValue as string
456     Dim i as integer
457     Dim iChildsOfAutomaticStyles as integer
458     Dim iLoopSearch as integer
459     printlog "+- Presentation: someheaderfooter_varible.odp"
460     '/// Opening <i>xml\required\input\graphics\header_footer\someheaderfooter_varible.odp</i>.
461     call hFileOpen (gTesttoolPath & ConvertPath("xml\required\input\graphics\header_footer\someheaderfooter_varible.odp"))
462     '/// Saving document as <i>user\work\xml\graphics\update\someheaderfooter_varible.odp</i> with default presentation document name.
463     if hFileSaveAsWithFilterKill (gOfficePath & ConvertPath("user\work\xml\graphics\update\someheaderfooter_varible.odp") , "impress8") = TRUE then
464         '/// Closing document. ///
465         call hCloseDocument
466         '/// Unpacking the compressed (ZIP) archive.
467         UnpackStorage( gOfficePath & ConvertPath("user\work\xml\graphics\update\someheaderfooter_varible.odp") , gOfficePath & ConvertPath("user\work\xml\graphics\update\someheaderfooter_varible\") )
468         '/// Verifying the well-formness of styles.xml, content.xml and meta.xml.
469         '///+ Only if the three XML files are well formed the next checks (GPF-check, attribute-search) will be started.
470         if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\graphics\update\someheaderfooter_varible\styles.xml")) = TRUE then        
471             if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\graphics\update\someheaderfooter_varible\meta.xml")) = TRUE then       
472                 if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\graphics\update\someheaderfooter_varible\content.xml")) = TRUE then
473                     '/// Opening exported document (GPF check). ///
474                     call hFileOpen (gOfficePath & ConvertPath("user\work\xml\graphics\update\someheaderfooter_varible.odp")
475                     sleep(2)
476                     '/// Closing document. ///
477                     call hCloseDocument
478                     sleep(2)
479                     '/// Opening user\work\xml\graphics\update\noheaderfooter\content.xml with SAX-parser.
480                     SAXReadFile(gOfficePath & ConvertPath("user\work\xml\graphics\update\someheaderfooter_varible\content.xml"))
481                     '/// <ol> 
482                     '///+<li> Parsing to office:document-content
483                     For iLoopSearch = 1 to 2
484                         SAXSeekElement("office:document-content")
485                         '///+ Parsing to office:body
486                         SAXSeekElement("office:body")
487                         '///+ Parsing to office:presentation                    
488                         SAXSeekElement("office:presentation")
489                         '///+ Parsing to draw:page
490                         SAXSeekElement("draw:page")
491                         '///+ In second loop enter <i>presentation:notes</i> node
492                         if iLoopSearch = 2 then
493                             SAXSeekElement("presentation:notes")
494                         end if
495                         '///+ Get value of draw:style-name
496                         sDrawName = ""
497                         sDrawName = SAXGetAttributeValue ("draw:style-name")
498                         '///+ Get back to the top of DOM                    
499                         SAXSeekElement("/")
500                         '///+<li> Parsing to office:document-content
501                         SAXSeekElement("office:document-content")
502                         '///+ Parsing to office:automatic-styles
503                         SAXSeekElement("office:automatic-styles")
504                         '///+ Look where the style:style element is where the style:name is the same as it was for draw:name
505                         iChildsOfAutomaticStyles = SAXGetChildCount
506                         'The count of style:style nodes is normaly 7 but the 8th is a text:list-style where
507                         'the searched attributes won't be included.
508                         for i = 1 to (iChildsOfAutomaticStyles-1)
509                             SAXSeekElement("style:style" , i)
510                             sElementName = SAXGetAttributeValue("style:name") 
511                             if sElementName = sDrawName then
512                             '///+ If found the named attribute (e.g. dp1) parsing to style:drawing-page-properties. 
513                                 SAXSeekElement("style:drawing-page-properties")                            
514                                 exit for
515                             end if
516                             if i = iChildsOfAutomaticStyles then
517                                 '///+ If the style:name is not found a warnlog will be written into the log and the test will be stopped. 
518                                 warnlog "Failed! The style:style='" & sDrawName & "' has not been found in the automatic-styles! Test will be aborted here!"
519                                 SAXRelease()
520                                 goto endsub
521                             end if
522                             'Go one node to the parent node.
523                             SAXSeekElement(0)
524                         next i                       
525                         if iLoopSearch = 1 then
526                             '///+Parsing to <ol>                        
527                             '///+ <li>presentation:display-footer</li>
528                             '///+ <li>presentation:footer-decl</li>
529                             '///+ <li>presentation:display-page-number</li>                           
530                             '///+ <li>presentation:display-date-time</li></ol>                    
531                             sAttributeSearch(1) = "presentation:display-footer"
532                             sAttributeSearch(2) = "presentation:display-page-number"
533                             sAttributeSearch(3) = "presentation:display-date-time"                        
534                             for i = 1 to 3
535                                 sAttributeValue = SAXGetAttributeValue(sAttributeSearch(i))                         
536                                 '/// Verifying that the value of <i>presentation:display-footer</i> attribute is 'false'.
537                                 if i = 1 then
538                                     if sAttributeValue <> "false" then
539                                         warnlog "Failed! The value of '" & sAttributeSearch(i) & "' is NOT 'false'!"
540                                     else
541                                         printlog "Passed. The value of '" & sAttributeSearch(i) & "' is 'false'."
542                                     end if
543                                 else
544                                 '///+ Verifying that the values of <i>presentation:display-page-number</i> and <i>presentation:display-date-time</i> attribute are 'true'.                        
545                                     if sAttributeValue <> "true" then
546                                         warnlog "Failed! The value of '" & sAttributeSearch(i) & "' is NOT 'true'!"
547                                     else
548                                         printlog "Passed. The value of '" & sAttributeSearch(i) & "' is 'true'."
549                                     end if                        
550                                 end if                                
551                             next i
552                             '///+ Get back to the top of DOM                    
553                             SAXSeekElement("/")                            
554                         end if
555                         if iLoopSearch = 2 then
556                             '///+Parsing to second page-style attributes <ol>                        
557                             '///+ <li>presentation:display-header</li>
558                             '///+ <li>presentation:display-footer</li>
559                             '///+ <li>presentation:display-page-number</li>                           
560                             '///+ <li>presentation:display-date-time</li></ol>                    
561                             sAttributeSearch(1) = "presentation:display-header"
562                             sAttributeSearch(2) = "presentation:display-footer"
563                             sAttributeSearch(3) = "presentation:display-page-number"
564                             sAttributeSearch(4) = "presentation:display-date-time"
565                             for i = 1 to 4
566                                 sAttributeValue = SAXGetAttributeValue(sAttributeSearch(i))                         
567                                 '/// Verifying that the value of <i>presentation:display-page-number</i> and <i>presentation:display-date-time</i> attributes is 'false'.
568                                 if i = 3 OR i = 4 then
569                                     if sAttributeValue <> "false" then
570                                         warnlog "Failed! The value of '" & sAttributeSearch(i) & "' is NOT 'false'!"
571                                     else
572                                         printlog "Passed. The value of '" & sAttributeSearch(i) & "' is 'false'."
573                                     end if
574                                 else
575                                 '///+ Verifying that the values of <i>presentation:display-header</i> and <i>presentation:display-footer</i> attribute are 'true'.                        
576                                     if sAttributeValue <> "true" then
577                                         warnlog "Failed! The value of '" & sAttributeSearch(i) & "' is NOT 'true'!"
578                                     else
579                                         printlog "Passed. The value of '" & sAttributeSearch(i) & "' is 'true'."
580                                     end if                        
581                                 end if                                
582                             next i                        
583                         end if
584                     next iLoopSearch
585                     SAXRelease()
586                 else
587                     warnlog "One of the XML files not well formed!"
588                 end if
589             end if
590         end if
591     else
592         warnlog "It was not possible to save the document as XML!"
593     end if
594 endcase
596 '-------------------------------------------------------------------------