diff options
Diffstat (limited to 'testautomation/xml/optional/includes/sxw7_01a.inc')
-rw-r--r-- | testautomation/xml/optional/includes/sxw7_01a.inc | 451 |
1 files changed, 451 insertions, 0 deletions
diff --git a/testautomation/xml/optional/includes/sxw7_01a.inc b/testautomation/xml/optional/includes/sxw7_01a.inc new file mode 100644 index 000000000000..f0121277b1e0 --- /dev/null +++ b/testautomation/xml/optional/includes/sxw7_01a.inc @@ -0,0 +1,451 @@ +'encoding UTF-8 Do not remove or change this line! +'************************************************************************** +' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +' +' Copyright 2000, 2010 Oracle and/or its affiliates. +' +' OpenOffice.org - a multi-platform office productivity suite +' +' This file is part of OpenOffice.org. +' +' OpenOffice.org is free software: you can redistribute it and/or modify +' it under the terms of the GNU Lesser General Public License version 3 +' only, as published by the Free Software Foundation. +' +' OpenOffice.org is distributed in the hope that it will be useful, +' but WITHOUT ANY WARRANTY; without even the implied warranty of +' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +' GNU Lesser General Public License version 3 for more details +' (a copy is included in the LICENSE file that accompanied this code). +' +' You should have received a copy of the GNU Lesser General Public License +' version 3 along with OpenOffice.org. If not, see +' <http://www.openoffice.org/license.html> +' for a copy of the LGPLv3 License. +' +'/************************************************************************ +'* +'* owner : helge.delfs@oracle.com +'* +'* short description : XML Writer Include File +'* +'\*********************************************************************************** + Dim Isliste(250) as string + Dim OutputPath as string + +sub sxw7_01a + + printlog "-------------------------- SXW7_01a.INC ------------------------------" + + printlog "---------------------------------------------------------------------" + call tfields + call tfootnotes + +end sub + +'------------------------------------------------------------------------- + +testcase tfields + Dim a as integer + Dim i as integer + Dim AttributeSearch(60) as string + Dim AttributeValue(60) as string + Dim sXMLNodename(50) as string + Dim sPathToAttributes as string + + printlog "+- fields.sdw" + '/// Opening file fields.sdw from input-directory. + call hFileOpen (gTesttoolPath & ConvertPath("xml\optional\input\writer\fields.sdw")) + '/// Saving the document in OOo XML 1.0 format. + if hFileSaveAsWithFilterKill (gOfficePath & ConvertPath("user\work\xml\writer\level1\fields.sxw") , "StarOffice XML (Writer)") then + '/// Closing the document also if there is a verification dialog. + call hCloseDocument() + sleep(3) + '/// Unpack the complete content of the file (ZIP-archieve) into a seperate directory. + UnpackStorage( gOfficePath & ConvertPath("user\work\xml\writer\level1\fields.sxw") , gOfficePath & ConvertPath("user\work\xml\writer\level1\fields") ) + '/// Checking the well formness of content.xml, styles.xml and meta.xml. + if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\writer\level1\fields\meta.xml")) = FALSE then + warnlog "XML-file 'meta.xml' not well formed!" + end if + if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\writer\level1\fields\styles.xml")) = FALSE then + warnlog "XML-file 'styles.xml' not well formed!" + end if + if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\writer\level1\fields\content.xml")) = FALSE then + warnlog "XML-file 'content.xml' not well formed!" + else + '/// Opening the exported file (GPF check). + call hFileOpen (gOfficePath & ConvertPath("user\work\xml\writer\level1\fields.sxw")) + sleep(2) + '/// Closing the document. + call hCloseDocument + sleep(2) + SAXReadFile(gOfficePath & ConvertPath("user\work\xml\writer\level1\fields\content.xml")) + printlog " ---------------------" + printlog " c o n t e n t . x m l" + printlog " ---------------------" + printlog "----------" + printlog " fields " + printlog "----------" + '------------------------------------------------------------------------- + '/// <u><b>CONTENT.XML</u></b> + printlog "++ Feature(s) to be searched for:" + printlog " |" + '------------------------------------------------------------------------- + '/// Searching for: <text:sender-firstname text:fixed="false"> + '/// Searching for: <text:sender-lastname text:fixed="false"> + sXMLNodename(1) = "text:sender-firstname" + sXMLNodename(2) = "text:sender-lastname" + AttributeSearch(1) = "text:fixed" + AttributeValue(1) = "false" + '/// Searching for: <text:date text:date-value="2000-11-30T16:14:56" + '/// Searching for: <text:time text:time-value="[not null]" + sXMLNodename(3) = "text:date" + AttributeSearch(3) = "text:date-value" + AttributeValue(3) = "2000-11-30T16:14:56" + sXMLNodename(4) = "text:time" + AttributeSearch(4) = "text:time-value" + AttributeValue(4) = "" + '/// Searching for: <text:word-count style:num-format="1">75</text:word-count> + '/// Searching for: <text:character-count style:num-format="1">788</text:character-count> + sXMLNodename(5) = "text:word-count" + 'TODO: JSI: Rotine needed for char XML node + 'CharNode = 75 + sXMLNodename(6) = "text:character-count" + 'TODO: JSI: Rotine needed for char XML node + 'CharNode = 788 + AttributeSearch(5) = "style:num-format" + AttributeValue(5) = "1" + '/// Searching for: <text:reference-mark-start text:name="ref"/>I am a reference<text:reference-mark-end text:name="ref"/> + sXMLNodename(7) = "text:reference-mark-start" + sXMLNodename(8) = "text:reference-mark-end" + AttributeSearch(7) = "text:name" + AttributeValue(7) = "ref" + '/// Searching for: <text:reference-ref text:reference-format="page" text:ref-name="ref">1</text:reference-ref> Chapter: <text:reference-ref text:reference-format="chapter" text:ref-name="ref">1</text:reference-ref> Location: <text:reference-ref text:reference-format="direction" text:ref-name="ref">above</text:reference-ref> + sXMLNodename(9) = "text:reference-ref" + 'TODO: JSI: Rotine needed for char XML node + 'CharNode: 1 [9] + 'CharNode: 1 [10] + 'CharNode: above [11] + AttributeSearch(9) = "text:reference-format" + AttributeValue(9) = "page" + AttributeValue(10) = "chapter" + AttributeValue(11) = "direction" + 'All three have this attribute and -value: + AttributeSearch(12) = "text:ref-name" + AttributeValue(12) = "ref" + '/// Searching for: <text:variable-set text:name="x" text:value-type="float" text:value="1" style:data-style-name="N0">1</text:variable-set> + sXMLNodename(13) = "text:variable-set" + AttributeSearch(13) = "text:name" + AttributeValue(13) = "x" + AttributeSearch(14) = "text:value-type" + AttributeValue(14) = "float" + AttributeSearch(15) = "text:value" + AttributeValue(15) = "1" + AttributeSearch(16) = "style:data-style-name" + AttributeValue(16) = "N0" + 'TODO: JSI: Rotine needed for char XML node + 'CharNode: 1 + '/// Searching for: <text:user-field-get text:name="I_am_a_user_field">Content of the user field</text:user-field-get> + sXMLNodename(17) = "text:user-field-get" + AttributeSearch(17) = "text:name" + AttributeValue(17) = "I_am_a_user_field" + 'TODO: JSI: Rotine needed for char XML node + 'CharNode: Content of the user field + '/// Searching for: <text:conditional-text text:condition="x==1" text:string-value-if-true="x = 1" text:string-value-if-false="x &lt;&gt; 1">x = 1</text:conditional-text> + sXMLNodename(18) = "text:conditional-text" + AttributeSearch(18) = "text:condition" + AttributeValue(18) = "x==1" + AttributeSearch(19) = "text:string-value-if-true" + AttributeValue(19) = "x = 1" + AttributeSearch(20) = "text:string-value-if-false" + AttributeValue(20) = "x <> 1" + 'TODO: JSI: Rotine needed for char XML node + 'CharNode: x = 1 + '/// Searching for: <text:hidden-text text:condition="x==1" text:string-value="x is not equal to 1"/> + sXMLNodename(21) = "text:hidden-text" + AttributeSearch(21) = "text:condition" + AttributeValue(21) = "x==1" + AttributeSearch(22) = "text:string-value" + AttributeValue(22) = "x is not equal to 1" + '/// Searching for: <text:hidden-paragraph text:condition="x==1" text:is-hidden="true"/>I am hidden if x=1</text:p> + sXMLNodename(23) = "text:hidden-paragraph" + AttributeSearch(23) = "text:condition" + AttributeValue(23) = "x==1" + AttributeSearch(24) = "text:is-hidden" + AttributeValue(24) = "true" + 'TODO: JSI: Rotine needed for char XML node + 'CharNode: I am hidden if x=1 + '/// Searching for: <text:creation-date style:data-style-name="N36">15/11/2000</text:creation-date> + sXMLNodename(25) = "text:creation-date" + AttributeSearch(25) = "style:data-style-name" + AttributeValue(25) = "N108" + '/// Searching for: '<text:editing-cycles>0</text:editing-cycles> + 'sXMLNodename(?) = text:editing-cycles + 'TODO: JSI: Rotine needed for char XML node + 'CharNode: 0 + '/// Searching for: <text:modification-date style:data-style-name="N81">6. mars 2003</text:modification-date> + sXMLNodename(26) = "text:modification-date" + AttributeSearch(26) = "style:data-style-name" + AttributeValue(26) = "N76" + 'TODO: JSI: Rotine needed for char XML node + 'CharNode: 6. mars 2003 + '/// Searching for: <text:database-display text:database-name="Bibliography" text:table-name="biblio" text:table-type="table" text:column-name="Author">&lt;Author&gt;</text:database-display> + sXMLNodename(27) = "text:database-display" + AttributeSearch(27) = "text:database-name" + AttributeValue(27) = "Bibliography" + AttributeSearch(28) = "text:table-name" + AttributeValue(28) = "biblio" + AttributeSearch(29) = "text:table-type" + AttributeValue(29) = "table" + AttributeSearch(30) = "text:column-name" + AttributeValue(30) = "Author" + 'TODO: JSI: Rotine needed for char XML node + 'CharNode: <Author> + '/// Searching for: <text:database-next text:database-name="Bibliography" text:table-name="biblio" text:table-type="table" text:condition="TRUE"/> + sXMLNodename(31) = "text:database-next" + AttributeSearch(31) = "text:database-name" + AttributeValue(31) = "Bibliography" + AttributeSearch(32) = "text:table-name" + AttributeValue(32) = "biblio" + AttributeSearch(33) = "text:table-type" + AttributeValue(33) = "table" + AttributeSearch(34) = "text:condition" + AttributeValue(34) = "TRUE" + '/// Searching for: <text:database-display text:database-name="Bibliography" text:table-name="biblio" text:table-type="table" text:column-name="Author">&lt;Author&gt;</text:database-display> + sXMLNodename(35) = "text:database-display" + AttributeSearch(35) = "text:database-name" + AttributeValue(35) = "Bibliography" + AttributeSearch(36) = "text:table-name" + AttributeValue(36) = "biblio" + AttributeSearch(37) = "text:table-type" + AttributeValue(37) = "table" + AttributeSearch(38) = "text:column-name" + AttributeValue(38) = "Author" + 'TODO: JSI: Rotine needed for char XML node + 'CharNode: <Author> + '/// Searching for: <text:database-row-number text:database-name="Bibliography" text:table-name="biblio" text:table-type="table" style:num-format="1" text:value="3">3</text:database-row-number> + sXMLNodename(39) = "text:database-row-number" + AttributeSearch(39) = "text:database-name" + AttributeValue(39) = "Bibliography" + AttributeSearch(40) = "text:table-name" + AttributeValue(40) = "biblio" + AttributeSearch(41) = "text:table-type" + AttributeValue(41) = "table" + AttributeSearch(42) = "style:num-format" + AttributeValue(42) = "1" + AttributeSearch(43) = "text:value" + AttributeValue(43) = "3" + 'TODO: JSI: Rotine needed for char XML node + 'CharNode: 3 + '/// Searching for: <text:database-name text:database-name="Bibliography" text:table-name="biblio" text:table-type="table">Bibliography.biblio</text:database-name> + sXMLNodename(44) = "text:database-name" + AttributeSearch(44) = "text:database-name" + AttributeValue(44) = "Bibliography" + AttributeSearch(45) = "text:table-name" + AttributeValue(45) = "biblio" + AttributeSearch(46) = "text:table-type" + AttributeValue(46) = "table" + 'TODO: JSI: Rotine needed for char XML node + 'CharNode: Bibliography.biblio + for a = 1 to 46 + select case a + case 1 , 2 : + ' Two nodes have the same attributes and -values as the first one + sPathToAttributes = fWhereIsXMLElementInBody("office:document-content" , "office:body" , sXMLNodename(a)) + SAXSeekElement(sPathToAttributes) + printlog " +- [Element: " & sXMLNodename(a) & "] Attribute: " & AttributeSearch(1) + if SAXGetAttributeValue(AttributeSearch(1)) <> AttributeValue(1) then + warnlog "Field: " & AttributeSearch(1) & " is not " & AttributeValue(1) & "!" + end if + SAXSeekElement("/") + case 5 , 6 : + ' Two nodes have the same attributes and -values as the first one + sPathToAttributes = fWhereIsXMLElementInBody("office:document-content" , "office:body" , sXMLNodename(a)) + SAXSeekElement(sPathToAttributes) + printlog " +- [Element: " & sXMLNodename(a) & "] Attribute: " & AttributeSearch(5) + if SAXGetAttributeValue(AttributeSearch(5)) <> AttributeValue(5) then + warnlog "Field: " & AttributeSearch(5) & " is not " & AttributeValue(5) & "!" + end if + SAXSeekElement("/") + case 7 , 8 : ' Two nodes have the same attributes and -values as the first one + sPathToAttributes = fWhereIsXMLElementInBody("office:document-content" , "office:body" , sXMLNodename(a)) + SAXSeekElement(sPathToAttributes) + printlog " +- [Element: " & sXMLNodename(a) & "] Attribute: " & AttributeSearch(7) + if SAXGetAttributeValue(AttributeSearch(7)) <> AttributeValue(7) then + warnlog "Field: " & AttributeSearch(7) & " is not " & AttributeValue(7) & "!" + end if + SAXSeekElement("/") + case 3, 4 : + ' The attribute is language dependent and should NOT be NULL + ' The if-then-else inquiry is another than in the other inquiries! + sPathToAttributes = fWhereIsXMLElementInBody("office:document-content" , "office:body" , sXMLNodename(a)) + SAXSeekElement(sPathToAttributes) + printlog " +- [Element: " & sXMLNodename(a) & "] Attribute: " & AttributeSearch(a) + if SAXGetAttributeValue(AttributeSearch(a)) = AttributeValue(a) then + warnlog "Field: " & AttributeSearch(a) & " is null empty!" + end if + SAXSeekElement("/") + case 9 , 10, 11: + ' Three times the same element name but not the same XML node + sPathToAttributes = fWhereIsXMLElementInBody("office:document-content" , "office:body" , sXMLNodename(9) , a-8) + SAXSeekElement(sPathToAttributes) + printlog " +- [Element: " & sXMLNodename(9) & "] Attribute: " & AttributeSearch(9) & "=" & AttributeValue(a) + if SAXGetAttributeValue(AttributeSearch(9)) <> AttributeValue(a) then + warnlog "Field: " & AttributeSearch(9) & " is not " & AttributeValue(a) & "!" + end if + SAXSeekElement("/") + case 12: + for i = 1 to 3 + sPathToAttributes = fWhereIsXMLElementInBody("office:document-content" , "office:body" , sXMLNodename(9) , i) + SAXSeekElement(sPathToAttributes) + printlog " +- [Element: " & sXMLNodename(9) & " (" & i & ")] Attribute: " & AttributeSearch(12) & "=" & AttributeValue(12) + if SAXGetAttributeValue(AttributeSearch(12)) <> AttributeValue(12) then + warnlog "Field: " & AttributeSearch(12) & " is not " & AttributeValue(12) & "!" + end if + SAXSeekElement("/") + next i + case 21, 22 : + ' One node has two attributes + sPathToAttributes = fWhereIsXMLElementInBody("office:document-content" , "office:body" , sXMLNodename(21)) + SAXSeekElement(sPathToAttributes) + printlog " +- [Element: " & sXMLNodename(21) & "]" & AttributeSearch(a) + if SAXGetAttributeValue(AttributeSearch(a)) <> AttributeValue(a) then + warnlog "Field: " & AttributeSearch(a) & " is not " & AttributeValue(a) & "!" + end if + SAXSeekElement("/") + case 23, 24 : + ' One node has two attributes + sPathToAttributes = fWhereIsXMLElementInBody("office:document-content" , "office:body" , sXMLNodename(23)) + SAXSeekElement(sPathToAttributes) + printlog " +- [Element: " & sXMLNodename(23) & "]" & AttributeSearch(a) + if SAXGetAttributeValue(AttributeSearch(a)) <> AttributeValue(a) then + warnlog "Field: " & AttributeSearch(a) & " is not " & AttributeValue(a) & "!" + end if + SAXSeekElement("/") + case 18, 19, 20 : + ' One node has three attributes + sPathToAttributes = fWhereIsXMLElementInBody("office:document-content" , "office:body" , sXMLNodename(18)) + SAXSeekElement(sPathToAttributes) + printlog " +- [Element: " & sXMLNodename(18) & "]" & AttributeSearch(a) + if SAXGetAttributeValue(AttributeSearch(a)) <> AttributeValue(a) then + warnlog "Field: " & AttributeSearch(a) & " is not " & AttributeValue(a) & "!" + end if + SAXSeekElement("/") + case 44, 45, 46 : + ' One node has three attributes + sPathToAttributes = fWhereIsXMLElementInBody("office:document-content" , "office:body" , sXMLNodename(44)) + SAXSeekElement(sPathToAttributes) + printlog " +- [Element: " & sXMLNodename(44) & "]" & AttributeSearch(a) + if SAXGetAttributeValue(AttributeSearch(a)) <> AttributeValue(a) then + warnlog "Field: " & AttributeSearch(a) & " is not " & AttributeValue(a) & "!" + end if + SAXSeekElement("/") + case 13, 14, 15, 16 : + ' One node has four attributes + sPathToAttributes = fWhereIsXMLElementInBody("office:document-content" , "office:body" , sXMLNodename(13)) + SAXSeekElement(sPathToAttributes) + printlog " +- [Element: " & sXMLNodename(13) & "]" & AttributeSearch(a) + if SAXGetAttributeValue(AttributeSearch(a)) <> AttributeValue(a) then + warnlog "Field: " & AttributeSearch(a) & " is not " & AttributeValue(a) & "!" + end if + SAXSeekElement("/") + case 27, 28, 29, 30 : + ' One node has four attributes + sPathToAttributes = fWhereIsXMLElementInBody("office:document-content" , "office:body" , sXMLNodename(27)) + SAXSeekElement(sPathToAttributes) + printlog " +- [Element: " & sXMLNodename(27) & "]" & AttributeSearch(a) + if SAXGetAttributeValue(AttributeSearch(a)) <> AttributeValue(a) then + warnlog "Field: " & AttributeSearch(a) & " is not " & AttributeValue(a) & "!" + end if + SAXSeekElement("/") + case 31, 32, 33, 34 : + ' One node has four attributes + sPathToAttributes = fWhereIsXMLElementInBody("office:document-content" , "office:body" , sXMLNodename(31)) + SAXSeekElement(sPathToAttributes) + printlog " +- [Element: " & sXMLNodename(31) & "]" & AttributeSearch(a) + if SAXGetAttributeValue(AttributeSearch(a)) <> AttributeValue(a) then + warnlog "Field: " & AttributeSearch(a) & " is not " & AttributeValue(a) & "!" + end if + SAXSeekElement("/") + case 35, 36, 37, 38 : + ' One node has four attributes + sPathToAttributes = fWhereIsXMLElementInBody("office:document-content" , "office:body" , sXMLNodename(35)) + SAXSeekElement(sPathToAttributes) + printlog " +- [Element: " & sXMLNodename(35) & "]" & AttributeSearch(a) + if SAXGetAttributeValue(AttributeSearch(a)) <> AttributeValue(a) then + warnlog "Field: " & AttributeSearch(a) & " is not " & AttributeValue(a) & "!" + end if + SAXSeekElement("/") + case 39, 40, 41, 42, 43 : + ' One node has five attributes + sPathToAttributes = fWhereIsXMLElementInBody("office:document-content" , "office:body" , sXMLNodename(39)) + SAXSeekElement(sPathToAttributes) + printlog " +- [Element: " & sXMLNodename(39) & "]" & AttributeSearch(a) + if SAXGetAttributeValue(AttributeSearch(a)) <> AttributeValue(a) then + warnlog "Field: " & AttributeSearch(a) & " is not " & AttributeValue(a) & "!" + end if + SAXSeekElement("/") + case 25, 26 : + 'skipping (evaluating different style names under different operating systems + SAXSeekElement("/") + case else : + sPathToAttributes = fWhereIsXMLElementInBody("office:document-content" , "office:body" , sXMLNodename(a)) + SAXSeekElement(sPathToAttributes) + printlog " +- [Element: " & sXMLNodename(a) & "]" & AttributeSearch(a) + if SAXGetAttributeValue(AttributeSearch(a)) <> AttributeValue(a) then + warnlog "Field: " & AttributeSearch(a) & " is not " & AttributeValue(a) & "!" + end if + SAXSeekElement("/") + end select + printlog " |" + next a + SAXRelease() + printlog " * * *" + end if + else + call hCloseDocument + end if +endcase +' +'------------------------------------------------------------------------- +' +testcase tfootnotes + Dim a as integer + Dim i as integer + Dim AttributeSearch(60) as string + Dim AttributeValue(60) as string + Dim sXMLNodename(50) as string + Dim sPathToAttributes as string + + printlog "+- footnotes.sdw" + '/// Opening file footnotes.sdw from input-directory. + call hFileOpen (gTesttoolPath & ConvertPath("xml\optional\input\writer\footnotes.sdw")) + '/// Saving the document in OOo XML 1.0 format. + if hFileSaveAsWithFilterKill (gOfficePath & ConvertPath("user\work\xml\writer\level1\footnotes.sxw") , "StarOffice XML (Writer)") then + '/// Closing the document also if there is a verification dialog. + call hCloseDocument() + sleep(3) + '/// Unpack the complete content of the file (ZIP-archieve) into a seperate directory. + UnpackStorage( gOfficePath & ConvertPath("user\work\xml\writer\level1\footnotes.sxw") , gOfficePath & ConvertPath("user\work\xml\writer\level1\footnotes") ) + '/// Checking the well formness of content.xml, styles.xml and meta.xml. + if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\writer\level1\footnotes\meta.xml")) = FALSE then + warnlog "XML-file 'meta.xml' not well formed!" + end if + if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\writer\level1\footnotes\styles.xml")) = FALSE then + warnlog "XML-file 'styles.xml' not well formed!" + end if + if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\writer\level1\footnotes\content.xml")) = FALSE then + warnlog "XML-file 'content.xml' not well formed!" + else + '/// Opening the exported file (GPF check). + call hFileOpen (gOfficePath & ConvertPath("user\work\xml\writer\level1\footnotes.sxw")) + sleep(2) + '/// Closing the document. + call hCloseDocument + end if + else + call hCloseDocument + end if +endcase + + |