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