Update ooo320-m1
[ooovba.git] / testautomation / xml / optional / includes / sxw7_01.inc
blobfc17c797e569a905fc3de2f83f5522ba5ce0a9ab
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: sxw7_01.inc,v $
11 '* $Revision: 1.2 $
13 '* last change: $Author: rt $ $Date: 2008-07-11 07:34:18 $
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 : helge.delfs@sun.com
36 '* short description : XML Writer Include File
38 '\***********************************************************************************
39    Dim Isliste(250) as string
40    Dim OutputPath as string
42 sub sxw7_01
44    printlog "-------------------------- SXW7_01.INC ------------------------------"
46    printlog "------------------------ Alien Attributes ---------------------------"
47    call tfiscus
48    call tfiscus2
49    
50    printlog "---------------------- File Format Changes --------------------------"
51    call tfeat476
52    call tfeat1318
54    printlog "---------------------------------------------------------------------"
55    call tcharacters 
57 end sub
59 '-------------------------------------------------------------------------
61 testcase tfiscus
62     Dim i as integer
63     Dim a as integer
64     Dim xXMLStyleName as string
65     Dim xPath as string
66     Dim AttributeSearch(50) as string
67     Dim AttributeValue(50) as string
68     Dim iStylesToCount as integer
69     Dim sStyleStyleValueA as string
71     printlog "+- fiscus.sxw"
72     call hFileOpen (gTesttoolPath & ConvertPath("xml\optional\input\writer\fiscus.sxw"))
73     '/// Saving (and if already exiting overwriting) the document.
74     if hFileSaveAsWithFilterKill (gOfficePath & ConvertPath("user\work\xml\writer\level1\fiscus.sxw") , "StarOffice XML (Writer)") then
75         '/// Closing the document also if there is a verification dialog.
76         call hCloseDocument()
77         sleep(3)     
78         UnpackStorage( gOfficePath & ConvertPath("user\work\xml\writer\level1\fiscus.sxw") , gOfficePath & ConvertPath("user\work\xml\writer\level1\fiscus") )
79         if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\writer\level1\fiscus\meta.xml")) = FALSE then
80             warnlog "XML-file 'meta.xml' not well formed!"
81         end if
82         if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\writer\level1\fiscus\styles.xml")) = FALSE then
83             warnlog "XML-file 'styles.xml' not well formed!"
84         end if
85         if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\writer\level1\fiscus\content.xml")) = FALSE then
86             warnlog "XML-file 'content.xml' not well formed!"
87         else
88             call hFileOpen (gOfficePath & ConvertPath("user\work\xml\writer\level1\fiscus.sxw"))
89             sleep(2)
90             call hCloseDocument
91             sleep(2)
92             SAXReadFile(gOfficePath & ConvertPath("user\work\xml\writer\level1\fiscus\content.xml"))
93             printlog "    ---------------------"
94             printlog "    c o n t e n t . x m l"
95             printlog "    ---------------------"
97             printlog "-----------------"
98             printlog "Hidden Namespaces"
99             printlog "-----------------"
100             '/// <u><b>content.xml</u></b>
101             '/// <u>Hidden Namespaces</u>
102             '///+ Searching for: xmlns:foo=&quot;http://www.foo.com&quot;
103             '///+ Searching for: xmlns:bar=&quot;http://www.bar.com&quot; ///
104             '-------------------------------------------------------------------------
105             AttributeSearch(1) = "xmlns:foo"
106             AttributeValue(1) = "http://www.foo.com"
108             AttributeSearch(2) = "xmlns:bar"
109             AttributeValue(2) = "http://www.bar.com"
110             printlog "++ Feature(s) to be searched for:"
111             printlog " |"
112             '-------------------------------------------------------------------------
113             SAXSeekElement("office:document-content")
114             for i = 1 to 2
115                 printlog " +- " & AttributeSearch(i)
116                 if SAXGetAttributeValue(AttributeSearch(i)) <> AttributeValue(i) then
117                     warnlog "Hidden attributes (in namespace): " & AttributeSearch(i) & " is not " & AttributeValue(i) & "!"
118                 end if
119             next i
120             SAXSeekElement("/")
121             printlog "    * * *"
122             '/// <u>hidden attributes <b>in a table style</b></u>
123             '///+ Searching for: attr1=&quot;42&quot;
124             '///+ Searching for: foo:attr2=&quot;43&quot;
125             '///+ Searching for: bar:attr3=&quot;44&quot; ///
126             '/// <u>hidden attributes <b>in a table cell style</b></u>
127             '///+ Searching for: attr1=&quot;42&quot;
128             '///+ Searching for: foo:attr2=&quot;43&quot;
129             '///+ Searching for: bar:attr3=&quot;44&quot; ///
130             '/// <u>hidden attributes <b>in a paragraph style</b></u>
131             '///+ Searching for: attr1=&quot;42&quot;
132             '///+ Searching for: foo:attr2=&quot;43&quot;
133             '///+ Searching for: bar:attr3=&quot;44&quot; ///
134             '/// <u>hidden attributes <b>in a text style</b></u>
135             '///+ Searching for: attr1=&quot;42&quot;
136             '///+ Searching for: foo:attr2=&quot;43&quot;
137             '///+ Searching for: bar:attr3=&quot;44&quot; ///
138             '/// <u>hidden attributes <b>in a frame style</b></u>
139             '///+ Searching for: attr1=&quot;42&quot;
140             '///+ Searching for: foo:attr2=&quot;43&quot;
141             '///+ Searching for: bar:attr3=&quot;44&quot; ///
142             '-------------------------------------------------------------------------
143             AttributeSearch(1) = "attr1"
144             AttributeValue(1) = "42"
146             AttributeSearch(2) = "foo:attr2"
147             AttributeValue(2) = "43"
149             AttributeSearch(3) = "bar:attr3"
150             AttributeValue(3) = "44"
151             '-------------------------------------------------------------------------
152             for a = 1 to 8
153                 if a = 1 then
154                     printlog "----------------------------------"
155                     printlog "Hidden attributes in a table style"
156                     printlog "----------------------------------"
157                 end if
158                 if a = 4 then
159                     printlog "---------------------------------------"
160                     printlog "Hidden attributes in a table cell style"
161                     printlog "---------------------------------------"
162                 end if
163                 if a = 6 then
164                     printlog "--------------------------------------"
165                     printlog "Hidden attributes in a paragraph style"
166                     printlog "--------------------------------------"
167                 end if
168                 if a = 7 then
169                     printlog "---------------------------------"
170                     printlog "Hidden attributes in a text style"
171                     printlog "---------------------------------"
172                 end if
173                 if a = 8 then
174                     printlog "----------------------------------"
175                     printlog "Hidden attributes in a frame style"
176                     printlog "----------------------------------"
177                 end if
178                 if a = 1 or a = 4 or a = 6 or a = 7 or a = 8 then
179                     SAXSeekElement("office:document-content")
180                     SAXSeekElement("office:automatic-styles")
181                     SAXSeekElement("style:style" , a)
182                     SAXSeekElement("style:properties")
183                     printlog "++ Feature(s) to be searched for:"
184                     printlog " |"
185                     for i = 1 to 3
186                         printlog " +- " & AttributeSearch(i)
187                         if SAXGetAttributeValue(AttributeSearch(i)) <> AttributeValue(i) then
188                             if a = 1 then 
189                                 warnlog "Hidden attributes (in a table style): " & AttributeSearch(i) & " is not " & AttributeValue(i) & "!"
190                             end if
191                             if a = 4 then 
192                                 warnlog "Hidden attributes (in a table cell style): " & AttributeSearch(i) & " is not " & AttributeValue(i) & "!"
193                             end if
194                             if a = 6 then 
195                                 warnlog "Hidden attributes (in a paragraph style): " & AttributeSearch(i) & " is not " & AttributeValue(i) & "!"
196                             end if
197                             if a = 7 then
198                                 warnlog "#i74125# - Alien attributes get lost in text style properties." 
199                                 ' warnlog "Hidden attributes (in a text style): " & AttributeSearch(i) & " is not " & AttributeValue(i) & "!"
200                             end if
201                             if a = 8 then 
202                                 warnlog "Hidden attributes (in a frame style): " & AttributeSearch(i) & " is not " & AttributeValue(i) & "!"
203                             end if
204                         end if
205                     next i
206                     printlog "    * * *"
207                 end if
208                 SAXSeekElement("/")
209             next a
210             SAXRelease()
211             SAXReadFile(gOfficePath & ConvertPath("user\work\xml\writer\level1\fiscus\styles.xml"))
212             '-------------------------------------------------------------------------
213             printlog "    -------------------"
214             printlog "    s t y l e s . x m l"
215             printlog "    -------------------"
216             printlog "-----------------"
217             printlog "Hidden Namespaces"
218             printlog "-----------------"
219             '/// <u><b>STYLES.XML</u></b>
220             '/// <u>Hidden Namespace</u>
221             '///+ Searching for: xmlns:foo=&quot;http://www.foo.com&quot;
222             '///+ Searching for: xmlns:bar=&quot;http://www.bar.com&quot; ///
223             '-------------------------------------------------------------------------
224             AttributeSearch(1) = "xmlns:foo"
225             AttributeValue(1) = "http://www.foo.com"
227             AttributeSearch(2) = "xmlns:bar"
228             AttributeValue(2) = "http://www.bar.com"
229             printlog "++ Feature(s) to be searched for:"
230             printlog " |"
231             '-------------------------------------------------------------------------
232             SAXSeekElement("office:document-styles")
233             for i = 1 to 2
234                 printlog " +- " & AttributeSearch(i)
235                 if SAXGetAttributeValue(AttributeSearch(i)) <> AttributeValue(i) then
236                     warnlog "Hidden attributes (in namespace): " & AttributeSearch(i) & " is not " & AttributeValue(i) & "!"
237                 end if
238             next i
239             SAXSeekElement("/")
240             '-------------------------------------------------------------------------
241             printlog "    * * *"
242             printlog "-----------------------------------------------"
243             printlog "Hidden attributes in TEMPLATE STYLE 'Text body'"
244             printlog "-----------------------------------------------"
245             '/// <u>hidden attributes <b>in the template style &acute;Text body&acute;</b></u>
246             '///+ Searching for: attr1=&quot;42&quot;
247             '///+ Searching for: foo:attr2=&quot;43&quot;
248             '///+ Searching for: bar:attr3=&quot;44&quot; ///
249             '-------------------------------------------------------------------------
250             AttributeSearch(1) = "attr1"
251             AttributeValue(1) = "42"
253             AttributeSearch(2) = "foo:attr2"
254             AttributeValue(2) = "43"
256             AttributeSearch(3) = "bar:attr3"
257             AttributeValue(3) = "44"
259             printlog "++ Feature(s) to be searched for:"
260             printlog " |"
261             '-------------------------------------------------------------------------
262             SAXSeekElement("office:document-styles")
263             SAXSeekElement("office:styles")
264             ' There are 7 style:style elements; it is important to get
265             ' the 'Text body' titled one because it is the onliest which
266             ' has one additional 'style:properties' element.
267             ' Executing SAXSeekElement without having an additional
268             ' element interrupts the test run!
269             for iStylesToCount = 1 to 7
270                 SAXSeekElement("style:style", iStylesToCount)
271                 sStyleStyleValueA = SAXGetAttributeValue("style:name")
272                 if sStyleStyleValueA = "Text body" then
273                     exit for
274                 else 
275                     SAXSeekElement(0)  
276                 end if
277             next iStylesToCount
278             ' Go into the style:propries element in 'Text body' named style:style element.
279             ' There the three hidden attributes should be stored.
280             SAXSeekElement("style:properties")
281             for i = 1 to 3
282                 printlog " +- " & AttributeSearch(i)
283                 if SAXGetAttributeValue(AttributeSearch(i)) <> AttributeValue(i) then
284                     warnlog "Hidden attributes (in a template style): " & AttributeSearch(i) & " is not " & AttributeValue(i) & "!"
285                 end if
286             next i
287             '-------------------------------------------------------------------------
288             printlog "    * * *"
289             SAXRelease()
290         end if
291     else
292         call hCloseDocument
293     end if
294 endcase
296 '-------------------------------------------------------------------------
298 testcase tfiscus2
299     Dim i as integer
300     Dim xXMLStyleName as string
301     Dim AttributeSearch(50) as string
302     Dim AttributeValue(50) as string
303     printlog "+- fiscus2.sxw"
304     call hFileOpen (gTesttoolPath & ConvertPath("xml\optional\input\writer\fiscus2.sxw"))
305     if hFileSaveAsWithFilterKill (gOfficePath & ConvertPath("user\work\xml\writer\level1\fiscus2.sxw") , "StarOffice XML (Writer)") then
306         '/// Closing the document also if there is a verification dialog.
307         call hCloseDocument()
308         sleep(3)     
309         UnpackStorage( gOfficePath & ConvertPath("user\work\xml\writer\level1\fiscus2.sxw") , gOfficePath & ConvertPath("user\work\xml\writer\level1\fiscus2") )
310         if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\writer\level1\fiscus2\meta.xml")) = FALSE then
311             warnlog "XML-file 'meta.xml' not well formed!"
312         end if
313         if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\writer\level1\fiscus2\styles.xml")) = FALSE then
314             warnlog "XML-file 'styles.xml' not well formed!"
315         end if
316         if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\writer\level1\fiscus2\content.xml")) = FALSE then
317             warnlog "XML-file 'content.xml' not well formed!"
318         else
319             call hFileOpen (gOfficePath & ConvertPath("user\work\xml\writer\level1\fiscus2.sxw"))
320             sleep(2)
321             call hCloseDocument
322             sleep(2)
323             SAXReadFile(gOfficePath & ConvertPath("user\work\xml\writer\level1\fiscus2\content.xml"))
324             printlog "    ---------------------"
325             printlog "    c o n t e n t . x m l"
326             printlog "    ---------------------"
328             printlog "-----------------"
329             printlog "Hidden Namespaces"
330             printlog "-----------------"
331             '/// <u><b>content.xml</u></b>
332             '/// <u>Hidden Namespaces</u>
333             '///+ Searching for: xmlns:foo=&quot;http://www.foo.com&quot;
334             '///+ Searching for: xmlns:bar=&quot;http://www.bar.com&quot; ///
335             '-------------------------------------------------------------------------
336             AttributeSearch(1) = "xmlns:foo"
337             AttributeValue(1) = "http://www.foo.com"
339             AttributeSearch(2) = "xmlns:bar"
340             AttributeValue(2) = "http://www.bar.com"
341             printlog "++ Feature(s) to be searched for:"
342             printlog " |"
343             '-------------------------------------------------------------------------
344             SAXSeekElement("office:document-content")
345             for i = 1 to 2
346                 printlog " +- " & AttributeSearch(i)
347                 if SAXGetAttributeValue(AttributeSearch(i)) <> AttributeValue(i) then
348                     warnlog "Hidden attributes (in namespace): " & AttributeSearch(i) & " is not " & AttributeValue(i) & "!"
349                 end if
350             next i
351             SAXSeekElement("/")
352             printlog "    * * *"
353             printlog "--------------------------------------------------------------------------"
354             printlog "Hidden attributes in text style but a 'span'-item over the whole paragraph"
355             printlog "--------------------------------------------------------------------------"
356             '/// <u>hidden attributes <b>in a text style</b></u>
357             '///+ where a 'span'-item exists in a whole paragraph.
358             '///+ Searching for: attr1=&quot;42&quot;
359             '///+ Searching for: foo:attr2=&quot;43&quot;
360             '///+ Searching for: bar:attr3=&quot;44&quot; ///
361             '-------------------------------------------------------------------------
362             AttributeSearch(1) = "attr1"
363             AttributeValue(1) = "42"
365             AttributeSearch(2) = "foo:attr2"
366             AttributeValue(2) = "43"
368             AttributeSearch(3) = "bar:attr3"
369             AttributeValue(3) = "44"
371             printlog "++ Feature(s) to be searched for:"
372             printlog " |"
373             '-------------------------------------------------------------------------
374             SAXSeekElement("office:document-content")
375             SAXSeekElement("office:automatic-styles")
376             SAXSeekElement("style:style" , 9)
377             SAXSeekElement("style:properties")
378             for i = 1 to 3
379                 printlog " +- " & AttributeSearch(i)
380                 if SAXGetAttributeValue(AttributeSearch(i)) <> AttributeValue(i) then
381                     warnlog "Hidden attributes (in a text style with a 'span'-item over the whole paragraph): " & AttributeSearch(i) & " is not " & AttributeValue(i) & "!"
382                 end if
383             next i
384             printlog "    * * *"
385             SAXRelease()
386         end if
387     else
388         call hCloseDocument
389     end if
390 endcase
392 '-------------------------------------------------------------------------
394 testcase tfeat476
395     Dim i as integer
396     Dim a as integer
397     Dim xXMLStyleName as string
398     Dim xPath as string
399     Dim AttributeSearch(50) as string
400     Dim AttributeValue(50) as string
401     printlog "+- feat476.sxw"
402     call hFileOpen (gTesttoolPath & ConvertPath("xml\optional\input\writer\feat476.sxw"))
403     if hFileSaveAsWithFilterKill (gOfficePath & ConvertPath("user\work\xml\writer\level1\feat476.sxw") , "StarOffice XML (Writer)") then
404         '/// Closing the document also if there is a verification dialog.
405         call hCloseDocument()
406         sleep(3)     
407         UnpackStorage( gOfficePath & ConvertPath("user\work\xml\writer\level1\feat476.sxw") , gOfficePath & ConvertPath("user\work\xml\writer\level1\feat476") )
408         if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\writer\level1\feat476\meta.xml")) = FALSE then
409             warnlog "XML-file 'meta.xml' not well formed!"
410         end if
411         if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\writer\level1\feat476\styles.xml")) = FALSE then
412             warnlog "XML-file 'styles.xml' not well formed!"
413         end if
414         if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\writer\level1\feat476\content.xml")) = FALSE then
415             warnlog "XML-file 'content.xml' not well formed!"
416         else
417             call hFileOpen (gOfficePath & ConvertPath("user\work\xml\writer\level1\feat476.sxw"))
418             sleep(2)
419             call hCloseDocument
420             sleep(2)
421             SAXReadFile(gOfficePath & ConvertPath("user\work\xml\writer\level1\feat476\content.xml"))
422             printlog "    ---------------------"
423             printlog "    c o n t e n t . x m l"
424             printlog "    ---------------------"
426             printlog "-----------------"
427             printlog "Vertical Relation"
428             printlog "-----------------"
429             '/// <u><b>content.xml</u></b>
430             '/// <u>Vertical Relation</u>
431             '///+ <blockquote>The <i>style:vertical-rel</i> attribute has a new value "text".
432             '///+ It is used by frames (i.e. images, text-boxes, etc.) that
433             '///+ are bound as characters to specify a vertical alignment
434             '///+ relative to the text height of the line that contains the
435             '///+ frame.
436             '///+ Before this change, the value "char" was used for this
437             '///+ purpose. This lead to an ambiguity, because the same value
438             '///+ is used with a different meaning for frames bound at a character.</blockquote>
439             '/// Searching for: style:vertical-rel=&quot;text&quot;
441             '-------------------------------------------------------------------------
442             AttributeSearch(1) = "style:vertical-rel"
443             AttributeValue(1) = "text"
444             printlog "++ Feature(s) to be searched for:"
445             printlog " |"
446             '-------------------------------------------------------------------------
447             SAXSeekElement("office:document-content")
448             SAXSeekElement("office:automatic-styles")
449             SAXSeekElement("style:style")
450             SAXSeekElement("style:properties")
451             for i = 1 to 1
452                 printlog " +- " & AttributeSearch(i)
453                 if SAXGetAttributeValue(AttributeSearch(i)) <> AttributeValue(i) then
454                     warnlog "Vertical Relation (XML file format change 476): " & AttributeSearch(i) & " is not " & AttributeValue(i) & "!"
455                 end if
456             next i
457             SAXSeekElement("/")
458             printlog "    * * *"
459             SAXRelease()
460         end if
461     else
462         call hCloseDocument
463     end if
464 endcase
466 '-------------------------------------------------------------------------
468 testcase tfeat1318
469     Dim i as integer
470     Dim a as integer
471     Dim xXMLStyleName as string
472     Dim xPath as string
473     Dim AttributeSearch(50) as string
474     Dim AttributeValue(50) as string
475     printlog "+- feat1318.sxw"
476     call hFileOpen (gTesttoolPath & ConvertPath("xml\optional\input\writer\feat1318.sxw"))
477     if hFileSaveAsWithFilterKill (gOfficePath & ConvertPath("user\work\xml\writer\level1\feat1318.sxw") , "StarOffice XML (Writer)") then
478         '/// Closing the document also if there is a verification dialog.
479         call hCloseDocument()
480         sleep(3)     
481         UnpackStorage( gOfficePath & ConvertPath("user\work\xml\writer\level1\feat1318.sxw") , gOfficePath & ConvertPath("user\work\xml\writer\level1\feat1318") )
482         if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\writer\level1\feat1318\meta.xml")) = FALSE then
483             warnlog "XML-file 'meta.xml' not well formed!"
484         end if
485         if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\writer\level1\feat1318\styles.xml")) = FALSE then
486             warnlog "XML-file 'styles.xml' not well formed!"
487         end if
488         if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\writer\level1\feat1318\content.xml")) = FALSE then
489             warnlog "XML-file 'content.xml' not well formed!"
490         else
491             call hFileOpen (gOfficePath & ConvertPath("user\work\xml\writer\level1\feat1318.sxw"))
492             sleep(2)
493             call hCloseDocument
494             sleep(2)
495             SAXReadFile(gOfficePath & ConvertPath("user\work\xml\writer\level1\feat1318\content.xml"))
496             printlog "    ---------------------"
497             printlog "    c o n t e n t . x m l"
498             printlog "    ---------------------"
500             printlog "-----------------"
501             printlog "Vertical Position"
502             printlog "-----------------"
503             '/// <u><b>content.xml</u></b>
504             '/// <u>Vertical Position</u>
505             '///+ <blockquote>The <i>style:vertical-pos</i> attribute that can be attached to the
506             '///+ <i><style:properties></i> element of graphic styles has got the new
507             '///+ value &quot;below&quot;. It can be used for frames that are bound to a
508             '///+ character only and means that the frame is displayed right
509             '///+ below the anchor character.
510             '///+ The meaning of any other value of the <i>style:vertical-pos</i>
511             '///+ attribute is unchanged. There also was no other way to set
512             '///+ the vertical position of a frame to &quot;below the anchor
513             '///+ character&quot;.</blockquote>
514             '/// Searching for: style:vertical-pos=&quot;below&quot;
516             '-------------------------------------------------------------------------
517             AttributeSearch(1) = "style:vertical-pos"
518             AttributeValue(1) = "below"
519             printlog "++ Feature(s) to be searched for:"
520             printlog " |"
521             '-------------------------------------------------------------------------
522             SAXSeekElement("office:document-content")
523             SAXSeekElement("office:automatic-styles")
524             SAXSeekElement("style:style")
525             SAXSeekElement("style:properties")
526             for i = 1 to 1
527                 printlog " +- " & AttributeSearch(i)
528                 if SAXGetAttributeValue(AttributeSearch(i)) <> AttributeValue(i) then
529                     warnlog "Vertical Relation (XML file format change 1318): " & AttributeSearch(i) & " is not " & AttributeValue(i) & "!"
530                 end if
531             next i
532             SAXSeekElement("/")
533             printlog "    * * *"
534             SAXRelease()
535         end if
536     else
537         call hCloseDocument
538     end if
539 endcase
541 '-------------------------------------------------------------------------
543 testcase tcharacters
544     Dim a as integer
545     Dim b as integer
546     Dim c as integer
547     Dim g as integer
548     Dim i as integer
549     Dim xXMLStyleName as string
550     Dim xPath as string
551     Dim  AttributeSearch(50) as string
552     Dim AttributeValue(50) as string
553     printlog "+- characters.sdw"
554     '/// Opening the characters.sdw file from the input directory.
555     call hFileOpen (gTesttoolPath & ConvertPath("xml\optional\input\writer\characters.sdw"))
556     '/// Saving the document in OOo XML 1.0 file format.
557     if hFileSaveAsWithFilterKill (gOfficePath & ConvertPath("user\work\xml\writer\level1\characters.sxw") , "StarOffice XML (Writer)") then
558         '/// Closing the document also if there is a verification dialog.
559         call hCloseDocument()
560         sleep(3)
561         '/// Unpack the complete file (ZIP archieve) into a seperate directory.
562         UnpackStorage( gOfficePath & ConvertPath("user\work\xml\writer\level1\characters.sxw") , gOfficePath & ConvertPath("user\work\xml\writer\level1\characters") )
563         '/// Verifying the wellformness of content.xml, styles.xml and meta.xml.
564         if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\writer\level1\characters\meta.xml")) = FALSE then
565             warnlog "XML-file 'meta.xml' not well formed!"
566         end if
567         if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\writer\level1\characters\styles.xml")) = FALSE then
568             warnlog "XML-file 'styles.xml' not well formed!"
569         end if
570         if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\writer\level1\characters\content.xml")) = FALSE then
571             warnlog "XML-file 'content.xml' not well formed!"
572         else
573             '/// Opening the exported document (GPF-check).
574             call hFileOpen (gOfficePath & ConvertPath("user\work\xml\writer\level1\characters.sxw"))
575             sleep(2)
576             '/// Closing the document.
577             call hCloseDocument
578             sleep(2)
579             SAXReadFile(gOfficePath & ConvertPath("user\work\xml\writer\level1\characters\content.xml"))
580             printlog "    ---------------------"
581             printlog "    c o n t e n t . x m l"
582             printlog "    ---------------------"
584             printlog "----------"
585             printlog "Paragraphs"
586             printlog "----------"
587             '-------------------------------------------------------------------------
588             '/// <u><b>CONTENT.XML</u></b>
589             '/// <u>Paragraph Style P2</u>
590             SAXSeekElement("office:document-content")
591             SAXSeekElement("office:body")
592             SAXSeekElement("text:p" , 15)
593             xXMLStyleName = SAXGetAttributeValue("text:style-name")
594             printlog "text:style-name: " & xXMLStyleName
595             '///+ Searching for: style:text-position=&quot;super 90%&quot;
596             '///+ Searching for: style:text-blinking=&quot;true&quot; ///
597             AttributeSearch(1) = "style:text-position"
598             AttributeValue(1) = "super 90%"
600             AttributeSearch(2) = "style:text-blinking"
601             AttributeValue(2) = "true"
602             printlog "++ Feature(s) to be searched for:"
603             printlog " |"
604             SAXSeekElement("/")
605             SAXSeekElement("office:document-content")
606             SAXSeekElement("office:automatic-styles")
607             a = SAXGetChildCount
608             for c = 1 to a
609                 SAXSeekElement(c)
610                 if SAXGetAttributeValue("style:name") = xXMLStyleName then
611                     SAXSeekElement("style:properties")
612                     for i = 1 to 2
613                         printlog " +- " & AttributeSearch(i)
614                         if SAXGetAttributeValue(AttributeSearch(i)) <> AttributeValue(i) then
615                             warnlog "Paragraph style: " & AttributeSearch(i) & " is not " & AttributeValue(i) & "!"
616                         end if
617                     next i
618                     c=a          
619                 end if
620                 SAXSeekElement(0)         
621             next c
622             SAXSeekElement("/")
623             printlog "    * * *"   
624             '-------------------------------------------------------------------------
625             printlog "----------"
626             printlog "Textstyles"
627             printlog "----------"
628             printlog "++ Feature(s) to be searched for:"
629             printlog " |"     
630             SAXSeekElement("office:document-content")
631             SAXSeekElement("office:body")
632             SAXSeekElement("text:p", 12)
633             SAXSeekElement("text:span")
634             xXMLStyleName = SAXGetAttributeValue("text:style-name")
635             printlog "text:style-name: " & xXMLStyleName 
636             '/// <u>Text Style T8</u>
637             '///+ Searching for: style:text-outline=&quot;true&quot;
638             '///+ Searching for: style:text-crossing-out=&quot;single-line&quot;
639             '///+ Searching for: fo:font-size=&quot;22pt&quot;
640             '///+ Searching for: fo:text-shadow=&quot;1pt 1pt&quot;
641             '///+ Searching for: style:text-underline=&quot;single&quot;
642             '///+ Searching for: style:text-underline-color=&quot;font-color&quot; ///
643             AttributeSearch(1) = "style:text-outline"
644             AttributeValue(1) = "true"
645       
646             AttributeSearch(2) = "style:text-crossing-out"
647             AttributeValue(2) = "single-line"
648       
649             AttributeSearch(3) = "fo:font-size"
650             AttributeValue(3) = "22pt"
651       
652             AttributeSearch(4) = "fo:text-shadow"
653             AttributeValue(4) = "1pt 1pt"
654       
655             AttributeSearch(5) = "style:text-underline"
656             AttributeValue(5) = "single"
657       
658             AttributeSearch(6) = "style:text-underline-color"
659             AttributeValue(6) = "font-color"
661             SAXSeekElement("/")
662             SAXSeekElement("office:document-content")
663             SAXSeekElement("office:automatic-styles")
664             a = SAXGetChildCount
665             for c = 1 to a
666                 SAXSeekElement(c)
667                 if SAXGetAttributeValue("style:name") = xXMLStyleName then
668                     SAXSeekElement("style:properties")
669                     for g = 1 to 6
670                         printlog " +- " & AttributeSearch(g)
671                         if SAXGetAttributeValue(AttributeSearch(g)) <> AttributeValue(g) then
672                             warnlog "Textstyle: " & AttributeSearch(g) & " is not " & AttributeValue(g) & "!"
673                         end if
674                     next g
675                     c=a           
676                 end if
677                 SAXSeekElement(0)         
678             next c
679             printlog "    * * *"
680             SAXSeekElement("/")
681             '-------------------------------------------------------------------------     
682             printlog "++ Feature(s) to be searched for:"
683             printlog " |"     
684             for g = 1 to 3
685                 SAXSeekElement("office:document-content")
686                 SAXSeekElement("office:body")
687                 SAXSeekElement("text:p" , 8)     
688                 SAXSeekElement(g)
689                 xXMLStyleName = SAXGetAttributeValue("text:style-name")
690                 printlog "text:style-name: " & xXMLStyleName
691                 '/// <u>Text Style T5</u>
692                 '///+ Searching for: fo:font-style=&quot;italic&quot; ///
693                 '/// <u>Text Style T6</u>
694                 '///+ Searching for: fo:font-weight=&quot;bold&quot; ///
695                 '/// <u>Text Style T7</u>
696                 '///+ Searching for: style:text-underline=&quot;single&quot;
697                 '///+ Searching for: style:text-underline-color=&quot;font-color&quot; ///
699                 AttributeSearch(1) = "fo:font-style"
700                 AttributeValue(1) = "italic"
701                 
702                 AttributeSearch(2) = "fo:font-weight"
703                 AttributeValue(2) = "bold"
704                 
705                 AttributeSearch(3) = "style:text-underline"
706                 AttributeValue(3) = "single"
707                 
708                 AttributeSearch(4) = "style:text-underline-color"
709                 AttributeValue(4) = "font-color"
710                 
711                 SAXSeekElement("/")
712                 SAXSeekElement("office:document-content")
713                 SAXSeekElement("office:automatic-styles")
714                 a = SAXGetChildCount
715                 for c = 1 to a
716                     SAXSeekElement(c)
717                     if SAXGetAttributeValue("style:name") = xXMLStyleName then
718                         SAXSeekElement("style:properties")
719                         if g = 3 then 
720                             for i = 1 to 2
721                                 printlog " +- " & AttributeSearch(i+2)
722                                 if SAXGetAttributeValue(AttributeSearch(i+2)) <> AttributeValue(i+2) then
723                                     warnlog "Textstyle: " & AttributeSearch(i+2) & " is not " & AttributeValue(i+2) & "!"
724                                 end if
725                             next i
726                         else
727                             printlog " +- " & AttributeSearch(g)
728                             if SAXGetAttributeValue(AttributeSearch(g)) <> AttributeValue(g) then
729                                 warnlog "Textstyle: " & AttributeSearch(g) & " is not " & AttributeValue(g) & "!"
730                             end if          
731                         end if
732                         c=a          
733                     end if
734                     SAXSeekElement(0)        
735                 next c
736                 SAXSeekElement("/")
737             next g           
738             printlog "    * * *"
739             SAXSeekElement("/")
740             '-------------------------------------------------------------------------
741             printlog "++ Feature(s) to be searched for:"
742             printlog " |"     
743             SAXSeekElement("office:document-content")
744             SAXSeekElement("office:body")
745             SAXSeekElement("text:p", 19)
746             xXMLStyleName = SAXGetAttributeValue("text:style-name")
747             printlog "paragraph:style-name: " & xXMLStyleName 
748             '/// <u>Paragraph Style P3</u>
749             '///+ Searching in language 01 for : fo:letter-spacing=&quot;0.06cm&quot;
750             '///+ Searching in other language for: fo:letter-spacing=&quot;
751             '///+ Searching for: style:letter-kerning=&quot;true&quot;
752             '-------------------------------------------------------------------------
753             AttributeSearch(1) = "style:letter-kerning"
754             AttributeValue(1) = "true"
756             AttributeSearch(2) = "fo:letter-spacing"
757             AttributeValue(2) = "0.106cm"    
758             
759             SAXSeekElement("/")
760             SAXSeekElement("office:document-content")
761             SAXSeekElement("office:automatic-styles")
762             
763             a = SAXGetChildCount     
764             for c = 1 to a
765                 SAXSeekElement(c)
766                 if SAXGetAttributeValue("style:name") = xXMLStyleName then
767                     SAXSeekElement("style:properties")
768                     if gLanguage = 1 then 
769                         b = 2
770                     else
771                         b = 1
772                     end if
773                     for g = 1 to b
774                         printlog " +- " & AttributeSearch(g)
775                         if SAXGetAttributeValue(AttributeSearch(g)) <> AttributeValue(g) then
776                             warnlog "Textstyle: " & AttributeSearch(g) & " is not " & AttributeValue(g) & "!"
777                         end if
778                     next g
779                     c=a           
780                 end if
781                 SAXSeekElement(0)         
782             next c    
783             '-------------------------------------------------------------------------
784             printlog "    * * *"
785             SAXSeekElement("/")
786             '-------------------------------------------------------------------------
787             printlog "++ Feature(s) to be searched for:"
788             printlog " |" 
789             for g = 1 to 2
790                 SAXSeekElement("office:document-content")
791                 SAXSeekElement("office:body")
792                 SAXSeekElement("text:p", 26)
793                 SAXSeekElement(g)
794                 xXMLStyleName = SAXGetAttributeValue("text:style-name")
795                 printlog "text:style-name: " & xXMLStyleName 
796                 '/// <u>Text Style T10</u>
797                 '///+ Searching for: style:text-background-color=&quot;#00dcff&quot; ///
798                 '/// <u>Text Style T11</u>
799                 '///+ Searching for: style:text-background-color=&quot;#ffcc99&quot; ///
800                 '-------------------------------------------------------------------------
801                 AttributeSearch(1) = "style:text-background-color"
802                 AttributeValue(1) = "#00dcff"
804                 AttributeSearch(2) = "style:text-background-color"
805                 AttributeValue(2) = "#ffcc99"
806                 
807                 SAXSeekElement("/")
808                 SAXSeekElement("office:document-content")
809                 SAXSeekElement("office:automatic-styles")
810                 
811                 a = SAXGetChildCount
812                 for c = 1 to a
813                     SAXSeekElement(c)
814                     if SAXGetAttributeValue("style:name") = xXMLStyleName then
815                         SAXSeekElement("style:properties")
816                         printlog " +- " & AttributeSearch(g)
817                         if SAXGetAttributeValue(AttributeSearch(g)) <> AttributeValue(g) then
818                             warnlog "Textstyle: " & AttributeSearch(g) & " is not " & AttributeValue(g) & "!"
819                         end if          
820                         c=a          
821                     end if
822                     SAXSeekElement(0)        
823                 next c
824                 SAXSeekElement("/")
825             next g
826             '-------------------------------------------------------------------------
827             printlog "---------"
828             printlog "O t h e r" 
829             printlog "---------"
830             '/// <u>Other (Link)</u>
831             '///+ Searching for: &lt;text:a xlink:type=&quot;simple&quot; xlink:href=&quot;http://www.hyperlink.de/&quot; office:target-frame-name=&quot;_blank&quot; xlink:show=&quot;new&quot;&gt;Hyperlink&lt;/text:a&gt; ///
832             printlog "    * * *"
833             SAXSeekElement("/")
834             '-------------------------------------------------------------------------
835             printlog "++ Feature(s) to be searched for:"
836             printlog " |"     
837             SAXSeekElement("office:document-content")
838             SAXSeekElement("office:body")
839             SAXSeekElement("text:p", 29)
840             SAXSeekElement("text:a")
841             xXMLStyleName = SAXGetAttributeValue("text:style-name")
842             printlog "text:style-name: " & xXMLStyleName 
843      
844             AttributeSearch(1) = "xlink:type"
845             AttributeValue(1)  = "simple"
846             
847             AttributeSearch(2) = "xlink:href"
848             AttributeValue(2)  = "http://www.hyperlink.de/"
849             
850             AttributeSearch(3) = "office:target-frame-name"
851             AttributeValue(3)  = "_blank"
852             
853             AttributeSearch(4) = "xlink:show"
854             AttributeValue(4)  = "new"
855             
856             for i = 1 to 4
857                 if SAXGetAttributeValue(AttributeSearch(i)) <> AttributeValue(i) then
858                     if i = 3 then
859                         warnlog "#i80480# Hyperlink attribute office:target-frame-name gets lost sometimes."
860                     elseif i = 4 then
861                         warnlog "#i80480# Hyperlink attribute xlink:show gets lost sometimes."
862                     else
863                         warnlog "Other: " & AttributeSearch(i) & " is not " & AttributeValue(i) & "!"
864                     endif
865                 end if          
866             next i
867         end if
868         SAXRelease()
869     else
870         call hCloseDocument
871     end if
872 endcase