diff options
author | Rüdiger Timm <rt@openoffice.org> | 2008-07-11 09:15:59 +0000 |
---|---|---|
committer | Rüdiger Timm <rt@openoffice.org> | 2008-07-11 09:15:59 +0000 |
commit | 9efeb65ebd29f876621344efa8eaa16c6de4a57b (patch) | |
tree | e59ecec6de5277390af3f73724b6e1bccb08c128 | |
parent | d1a9ae508b6c3a7f5bc9071b8d3453233ddd9b52 (diff) |
INTEGRATION: CWS autotestfixes01 (1.1.2); FILE ADDED
2008/07/04 17:08:17 jsi 1.1.2.1: #i91336#
Adding the modul xml to testautomation
Issue number:
Submitted by:
Reviewed by:
-rwxr-xr-x | testautomation/xml/required/includes/oasis_graphics_01.inc | 603 | ||||
-rwxr-xr-x | testautomation/xml/required/input/graphics/alien_attributes/alien_attributes_presentation.odp | bin | 0 -> 7351 bytes | |||
-rwxr-xr-x | testautomation/xml/required/input/graphics/header_footer/allheaderfooter_fixed.odp | bin | 0 -> 9161 bytes | |||
-rwxr-xr-x | testautomation/xml/required/input/graphics/header_footer/noheaderfooter.odp | bin | 0 -> 10143 bytes | |||
-rwxr-xr-x | testautomation/xml/required/input/graphics/header_footer/nomasterelements.odp | bin | 0 -> 9485 bytes | |||
-rwxr-xr-x | testautomation/xml/required/input/graphics/header_footer/someheaderfooter_varible.odp | bin | 0 -> 10190 bytes | |||
-rwxr-xr-x | testautomation/xml/tools/includes/itools1.inc | 66 | ||||
-rwxr-xr-x | testautomation/xml/tools/includes/xmltool1.inc | 90 |
8 files changed, 759 insertions, 0 deletions
diff --git a/testautomation/xml/required/includes/oasis_graphics_01.inc b/testautomation/xml/required/includes/oasis_graphics_01.inc new file mode 100755 index 000000000000..7166fa4ba5be --- /dev/null +++ b/testautomation/xml/required/includes/oasis_graphics_01.inc @@ -0,0 +1,603 @@ +'encoding UTF-8 Do not remove or change this line! +'************************************************************************** +'* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +'* +'* Copyright 2008 by Sun Microsystems, Inc. +'* +'* OpenOffice.org - a multi-platform office productivity suite +'* +'* $RCSfile: oasis_graphics_01.inc,v $ +'* +'* $Revision: 1.2 $ +'* +'* last change: $Author: rt $ $Date: 2008-07-11 10:14:45 $ +'* +'* 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 : joerg.sievers@sun.com +'* +'* short description : Library 01 for OASIS OpenDocument File Format (Presentation and Drawing) test +'* +'************************************************************************ +'* +' #1 talien_attributes ' Verification that alian attributes will be stored in document. +' #1 t_all_header_footer ' http://specs.openoffice.org/impress/header_and_footer.sxw +' #1 t_no_header_footer ' http://specs.openoffice.org/impress/header_and_footer.sxw +' #1 t_no_header_footer_master_elements ' http://specs.openoffice.org/impress/header_and_footer.sxw +' #1 t_some_header_footer ' http://specs.openoffice.org/impress/header_and_footer.sxw +'* +'\*********************************************************************** + +testcase talien_attributes + Dim i as integer + Dim AttrNameInDOM as string + Dim sPropertyElement as string + Dim sLogAttributeName as string + Dim sAttributeSearch(9) as string + Dim sAttributeValue(9) as string + + printlog "+- Presentation: alien.odp" + '/// Opening alien.sxi. /// + call hFileOpen (gTesttoolPath & ConvertPath("xml\required\input\graphics\alien_attributes\alien_attributes_presentation.odp")) + '/// Saving document. /// + if hFileSaveAsWithFilterKill (gOfficePath & ConvertPath("user\work\xml\graphics\update\alien_attributes_presentation.odp") , "impress8") = TRUE then + '/// Closing document. /// + call hCloseDocument + '/// Unpacking the compressed (ZIP) archive. + UnpackStorage( gOfficePath & ConvertPath("user\work\xml\graphics\update\alien_attributes_presentation.odp") , gOfficePath & ConvertPath("user\work\xml\graphics\update\alien_attributes_presentation\") ) + '/// Verifying the well-formness of styles.xml, content.xml and meta.xml. + '///+ Only if the three XML files are well formed the next checks (GPF-check, attribute-search) will be started. + if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\graphics\update\alien_attributes_presentation\styles.xml")) = TRUE then + if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\graphics\update\alien_attributes_presentation\meta.xml")) = TRUE then + if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\graphics\update\alien_attributes_presentation\content.xml")) = TRUE then + '/// Opening exported document (GPF check). /// + call hFileOpen (gOfficePath & ConvertPath("user\work\xml\graphics\update\alien_attributes_presentation.odp") + sleep(2) + '/// Closing document. /// + call hCloseDocument + sleep(2) + SAXReadFile(gOfficePath & ConvertPath("user\work\xml\graphics\update\alien_attributes_presentation\content.xml")) + printlog "-----------------" + printlog "Hidden Namespaces" + printlog "-----------------" + '/// <u><b>content.xml</u></b> + '/// <u>Hidden attributes in namespaces</u> + '///+ Searching for: xmlns:alien="http://openoffice.org/2000/alien" + '------------------------------------------------------------------------- + sAttributeSearch(1) = "xmlns:alien" + sAttributeValue(1) = "http://openoffice.org/2000/alien" + printlog "++ Feature(s) to be searched for:" + printlog " |" + '------------------------------------------------------------------------- + SAXSeekElement("office:document-content") + printlog " +- " & sAttributeSearch(1) + if SAXGetAttributeValue(sAttributeSearch(1)) <> sAttributeValue(1) then + warnlog "Hidden attributes (in namespace): " & sAttributeSearch(1) & " is not " & sAttributeValue(1) & "!" + end if + printlog " * * *" + SAXSeekElement("/") + '/// <u>hidden attributes</u> + '///+<ol><li><b>in a drawing-page style</b></li> + '///+<li><b>in a graphics style</b></li> + '///+<li><b>in a paragraph style (twice)</b></li> + '///+<li><b>in a text style</b></li></ol> + '///+ Searching for: alien:key="page" + '///+ Searching for: alien:key="shape" + '///+ Searching for: alien:key="para" + '///+ Searching for: alien:key="shape-text" + '///+ Searching for: alien:key="text" + + 'The number behind the string variable is the position + 'in the DOM-tree. The search is hard coded because the + 'export of the same file should not change in the lifetime + 'cycle. + + sAttributeSearch(1) = "alien:key" + sAttributeValue(1) = "page" + + sAttributeSearch(3) = "alien:key" + sAttributeValue(3) = "shape" + + sAttributeSearch(6) = "alien:key" + sAttributeValue(6) = "para" + + sAttributeSearch(7) = "alien:key" + sAttributeValue(7) = "shape-text" + + sAttributeSearch(9) = "alien:key" + sAttributeValue(9) = "text" + '------------------------------------------------------------------------- + printlog "++ Feature(s) to be searched for:" + printlog " |" + '------------------------------------------------------------------------- + for i = 1 to 9 + select case i + case 1 : printlog "-----------------------------------------" + printlog "Hidden attributes in a drawing-page style" + printlog "-----------------------------------------" + sPropertyElement = "style:drawing-page-properties" + sLogAttributeName = "drawing-page" + case 3 : printlog "-------------------------------------" + printlog "Hidden attributes in a graphics style" + printlog "-------------------------------------" + sPropertyElement = "style:graphic-properties" + sLogAttributeName = "graphics" + case 6, 7 : printlog "-------------------------------------------" + printlog "Hidden attributes in a paragraph style (" & i-4 & ")" + printlog "-------------------------------------------" + sPropertyElement = "style:paragraph-properties" + sLogAttributeName = "paragraph" + case 9 : printlog "---------------------------------" + printlog "Hidden attributes in a text style" + printlog "---------------------------------" + sPropertyElement = "style:text-properties" + sLogAttributeName = "text" + end select + if i = 1 or i = 3 or i = 6 or i = 7 or i = 9 then + 'The hidden attributes are in a known sequence included, + 'so the same routine will be used for different styles! + SAXSeekElement("/") + SAXSeekElement("office:document-content") + SAXSeekElement("office:automatic-styles") + SAXSeekElement("style:style" , i ) + AttrNameInDOM = SAXGetAttributeValue("style:name") + printlog " + style:style position in DOM: " & i & ". Attribute name: " & AttrNameInDOM + printlog " |" + + 'It depends on the type of element (drawing-page, paragraphic, graphics, ...) + 'which is the next element. That is a difference to OOo XML 1.0 where everything + 'called 'style:properties'. + + SAXSeekElement(sPropertyElement) + printlog " +- " & sAttributeSearch(i) + if SAXGetAttributeValue(sAttributeSearch(i)) <> sAttributeValue(i) then + warnlog "Hidden attributes (in a " & sLogAttributeName & " style): " & sAttributeSearch(i) & " is not " & sAttributeValue(i) & "!" + end if + end if + next i + SAXSeekElement("/") + printlog " * * *" + '------------------------------------------------------------------------- + '/// Closing the XML DOM. + SAXRelease() + '/// Opening the DOM of styles.xml. + SAXReadFile(gOfficePath & ConvertPath("user\work\xml\graphics\update\alien_attributes_presentation\styles.xml")) + '------------------------------------------------------------------------- + printlog "-------------------" + printlog "s t y l e s . x m l" + printlog "-------------------" + printlog "-----------------" + printlog "Hidden Namespaces" + printlog "-----------------" + '/// <u><b>styles.xml</u></b> + '/// <u>Hidden attributes in namespaces</u> + '///+ Searching for: xmlns:alien="http://openoffice.org/2000/alien" + '------------------------------------------------------------------------- + sAttributeSearch(1) = "xmlns:alien" + sAttributeValue(1) = "http://openoffice.org/2000/alien" + printlog "++ Feature(s) to be searched for:" + printlog " |" + '------------------------------------------------------------------------- + SAXSeekElement("office:document-styles") + printlog " +- " & sAttributeSearch(1) + if SAXGetAttributeValue(sAttributeSearch(1)) <> sAttributeValue(1) then + warnlog "Hidden attributes (in namespace): " & sAttributeSearch(1) & " is not " & sAttributeValue(1) & "!" + end if + printlog " * * *" + SAXSeekElement("/") + printlog "----------------------------------------" + printlog "Hidden attributes in a master-page style" + printlog "----------------------------------------" + '------------------------------------------------------------------------- + '/// <u>hidden attributes</u> + '///+<ol><li><b>in a master-page style</b></li></ol> + '///+ Searching for: alien:key="master-page" + '------------------------------------------------------------------------- + sAttributeSearch(1) = "alien:key" + sAttributeValue(1) = "master-page" + printlog "++ Feature(s) to be searched for:" + printlog " |" + '------------------------------------------------------------------------- + SAXSeekElement("office:document-styles") + SAXSeekElement("office:automatic-styles") + SAXSeekElement("style:style") + SAXSeekElement("style:drawing-page-properties") + printlog " +- " & sAttributeSearch(1) + if SAXGetAttributeValue(sAttributeSearch(1)) <> sAttributeValue(1) then + warnlog "Hidden attributes (in master-page style): " & sAttributeSearch(1) & " is not " & sAttributeValue(1) & "!" + end if + printlog " * * *" + '------------------------------------------------------------------------- + SAXRelease() + else + warnlog "One of the XML files not well formed!" + end if + end if + end if + else + warnlog "It was not possible to save the document as XML!" + end if +endcase + +'------------------------------------------------------------------------- + +testcase t_all_header_footer + Dim iPresAttr as integer + Dim sAttributeSearch(4) as string + Dim sAttributeValue(4) as string + Dim sHeaderInNotes as string + + printlog "+- Presentation: allheaderfooter_fixed.odp" + '/// Opening <i>xml\required\input\graphics\header_footer\allheaderfooter_fixed.odp</i>. + call hFileOpen (gTesttoolPath & ConvertPath("xml\required\input\graphics\header_footer\allheaderfooter_fixed.odp")) + '/// Saving document as <i>user\work\xml\graphics\update\allheaderfooter_fixed.odp</i> with default presentation document name. + if hFileSaveAsWithFilterKill (gOfficePath & ConvertPath("user\work\xml\graphics\update\allheaderfooter_fixed.odp") , "impress8") = TRUE then + '/// Closing document. + call hCloseDocument + '/// Unpacking the compressed (ZIP) archive. Putting the content to <i>user\work\xml\graphics\update\allheaderfooter_fixed\</i>" + UnpackStorage( gOfficePath & ConvertPath("user\work\xml\graphics\update\allheaderfooter_fixed.odp") , gOfficePath & ConvertPath("user\work\xml\graphics\update\allheaderfooter_fixed\") ) + '/// Verifying the well-formness of styles.xml, content.xml and meta.xml. + '///+ Only if the three XML files are well formed the next checks (GPF-check, attribute-search) will be started. + if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\graphics\update\allheaderfooter_fixed\styles.xml")) = TRUE then + if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\graphics\update\allheaderfooter_fixed\meta.xml")) = TRUE then + if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\graphics\update\allheaderfooter_fixed\content.xml")) = TRUE then + '/// Opening exported document (GPF check). /// + call hFileOpen (gOfficePath & ConvertPath("user\work\xml\graphics\update\allheaderfooter_fixed.odp") + sleep(2) + '/// Closing document. /// + call hCloseDocument + sleep(2) + '/// <u><b>content.xml</u></b> + '/// Opening user\work\xml\graphics\update\allheaderfooter_fixed\content.xml with SAX parser. + '/// Searching for <ul> + '///+<li><presentation:header-decl presentation:name="hdr1">Header in notes/handout powered by QA</presentation:header-decl> + '///+<li><presentation:footer-decl presentation:name="ftr1">footer powered by QA</presentation:footer-decl> + '///+<li><presentation:footer-decl presentation:name="ftr2">Footer notes/handout powered by QA</presentation:footer-decl> + '///+<li><presentation:date-time-decl presentation:name="dtd1" presentation:source="fixed">09.12.2001</presentation:date-time-decl></ul> + sAttributeSearch(1) = "presentation:header-decl" + sAttributeValue(1) = "Header in notes/handout powered by QA" + sAttributeSearch(2) = "presentation:footer-decl" + sAttributeValue(2) = "footer powered by QA" + sAttributeSearch(3) = "presentation:footer-decl" + sAttributeValue(3) = "Footer notes/handout powered by QA" + sAttributeSearch(4) = "presentation:date-time-decl" + sAttributeValue(4) = "09.12.2001" + + SAXReadFile(gOfficePath & ConvertPath("user\work\xml\graphics\update\allheaderfooter_fixed\content.xml")) + for iPresAttr = 1 to 4 + '/// Parsing to office:document-content + SAXSeekElement("office:document-content") + '/// Parsing to office:body + SAXSeekElement("office:body") + '/// Parsing to office:presentation + SAXSeekElement("office:presentation") + '/// Parsing to <ol><li>presentation:header-decl</li> + '///+ <li>presentation:footer-decl</li> + '///+ <li>presentation:footer-decl</li> + '///+ <li>presentation:date-time-decl</li></ol> + if iPresAttr = 3 then + 'To reach the second 'presentation:footer-decl'-element an additional parameter is needed. + SAXSeekElement(sAttributeSearch(iPresAttr) , 2) + else + SAXSeekElement(sAttributeSearch(iPresAttr)) + end if + '/// Parsing 1 node deeper (to get the CharNode) + SAXSeekElement(1) + '/// Reading the characters of the CharNode and verifying it against the reference. + ' Initializing the variable (empty) + sHeaderInNotes = "" + sHeaderInNotes = SAXGetChars + if sHeaderInNotes <> sAttributeValue(iPresAttr) then + warnlog "Failed! - Attribute '" & sAttributeSearch(iPresAttr) & "' has the value '" & sHeaderInNotes & "' but it has to be '" & sAttributeValue(iPresAttr) & "'." + else + printlog "Passed. - Attribute '" & sAttributeSearch(iPresAttr) & "' has the correct value '" & sHeaderInNotes & "'." + end if + SAXSeekElement("/") + next iPresAttr + SAXRelease() + else + warnlog "One of the XML files not well formed!" + end if + end if + end if + else + warnlog "It was not possible to save the document as XML!" + end if +endcase + +'------------------------------------------------------------------------- + +testcase t_no_header_footer + Dim sDrawName as string + Dim sElementName as string + Dim sAttributeSearch(3) as string + Dim sAttributeValue as string + Dim i as integer + Dim iChildsOfAutomaticStyles as integer + printlog "+- Presentation: noheaderfooter.odp" + '/// Opening <i>xml\required\input\graphics\header_footer\noheaderfooter.odp</i>. + call hFileOpen (gTesttoolPath & ConvertPath("xml\required\input\graphics\header_footer\noheaderfooter.odp")) + '/// Saving document as <i>user\work\xml\graphics\update\noheaderfooter.odp</i> with default presentation document name. + if hFileSaveAsWithFilterKill (gOfficePath & ConvertPath("user\work\xml\graphics\update\noheaderfooter.odp") , "impress8") = TRUE then + '/// Closing document. /// + call hCloseDocument + '/// Unpacking the compressed (ZIP) archive. + UnpackStorage( gOfficePath & ConvertPath("user\work\xml\graphics\update\noheaderfooter.odp") , gOfficePath & ConvertPath("user\work\xml\graphics\update\noheaderfooter\") ) + '/// Verifying the well-formness of styles.xml, content.xml and meta.xml. + '///+ Only if the three XML files are well formed the next checks (GPF-check, attribute-search) will be started. + if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\graphics\update\noheaderfooter\styles.xml")) = TRUE then + if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\graphics\update\noheaderfooter\meta.xml")) = TRUE then + if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\graphics\update\noheaderfooter\content.xml")) = TRUE then + '/// Opening exported document (GPF check). /// + call hFileOpen (gOfficePath & ConvertPath("user\work\xml\graphics\update\noheaderfooter.odp") + sleep(2) + '/// Closing document. /// + call hCloseDocument + sleep(2) + '/// Opening user\work\xml\graphics\update\noheaderfooter\content.xml with SAX-parser. + SAXReadFile(gOfficePath & ConvertPath("user\work\xml\graphics\update\noheaderfooter\content.xml")) + '/// <ol> + '///+<li> Parsing to office:document-content + SAXSeekElement("office:document-content") + '///+ Parsing to office:body + SAXSeekElement("office:body") + '///+ Parsing to office:presentation + SAXSeekElement("office:presentation") + '///+ Parsing to draw:page + SAXSeekElement("draw:page") + '///+ Get value of draw:style-name + sDrawName = "" + sDrawName = SAXGetAttributeValue ("draw:style-name") + '///+ Get back to the top of DOM</li> + SAXSeekElement("/") + '///+<li> Parsing to office:document-content + SAXSeekElement("office:document-content") + '///+ Parsing to office:automatic-styles + SAXSeekElement("office:automatic-styles") + '///+ Look where the style:style element is where the style:name is the same as it was for draw:name + iChildsOfAutomaticStyles = SAXGetChildCount + 'The count of style:style nodes is normaly 7 but the 8th is a text:list-style where + 'the searched attributes won't be included. + for i = 1 to (iChildsOfAutomaticStyles-1) + SAXSeekElement("style:style" , i) + sElementName = SAXGetAttributeValue("style:name") + if sElementName = sDrawName then + '///+ If found the named attribute (e.g. dp1) parsing to style:drawing-page-properties. + SAXSeekElement("style:drawing-page-properties") + exit for + end if + if i = iChildsOfAutomaticStyles then + '///+ If the style:name is not found a warnlog will be written into the log and the test will be stopped. + warnlog "Failed! The style:style='" & sDrawName & "' has not been found in the automatic-styles! Test will be aborted here!" + SAXRelease() + goto endsub + end if + 'Go one node to the parent node. + SAXSeekElement(0) + next i + '///+Parsing to <ol><li>presentation:display-footer</li> + '///+ <li>presentation:footer-decl</li> + '///+ <li>presentation:display-page-number</li> + '///+ <li>presentation:display-date-time</li></ol> + sAttributeSearch(1) = "presentation:display-footer" + sAttributeSearch(2) = "presentation:display-page-number" + sAttributeSearch(3) = "presentation:display-date-time" + for i = 1 to 3 + sAttributeValue = SAXGetAttributeValue(sAttributeSearch(i)) + '///+ Verifying that the value of each attribute is 'false'.</li></ol> + if sAttributeValue <> "false" then + warnlog "Failed! The value of '" & sAttributeSearch(i) & "' is NOT 'false'!" + else + printlog "Passed. The value of '" & sAttributeSearch(i) & "' is 'false'." + end if + next i + SAXRelease() + else + warnlog "One of the XML files not well formed!" + end if + end if + end if + else + warnlog "It was not possible to save the document as XML!" + end if +endcase + +'------------------------------------------------------------------------- + +testcase t_no_header_footer_master_elements + printlog "+- Presentation: nomasterelements.odp" + '/// Opening <i>xml\required\input\graphics\header_footer\nomasterelements.odp</i>. + call hFileOpen (gTesttoolPath & ConvertPath("xml\required\input\graphics\header_footer\nomasterelements.odp")) + '/// Saving document as <i>user\work\xml\graphics\update\nomasterelements.odp</i> with default presentation document name. + if hFileSaveAsWithFilterKill (gOfficePath & ConvertPath("user\work\xml\graphics\update\nomasterelements.odp") , "impress8") = TRUE then + '/// Closing document. /// + call hCloseDocument + '/// Unpacking the compressed (ZIP) archive. + UnpackStorage( gOfficePath & ConvertPath("user\work\xml\graphics\update\nomasterelements.odp") , gOfficePath & ConvertPath("user\work\xml\graphics\update\nomasterelements\") ) + '/// Verifying the well-formness of styles.xml, content.xml and meta.xml. + '///+ Only if the three XML files are well formed the next checks (GPF-check, attribute-search) will be started. + if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\graphics\update\nomasterelements\styles.xml")) = TRUE then + if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\graphics\update\nomasterelements\meta.xml")) = TRUE then + if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\graphics\update\nomasterelements\content.xml")) = TRUE then + '/// Opening exported document (GPF check). /// + call hFileOpen (gOfficePath & ConvertPath("user\work\xml\graphics\update\nomasterelements.odp") + sleep(2) + '/// Closing document. /// + call hCloseDocument + sleep(2) + else + warnlog "One of the XML files not well formed!" + end if + end if + end if + else + warnlog "It was not possible to save the document as XML!" + end if +endcase + +'------------------------------------------------------------------------- + +testcase t_some_header_footer + Dim sDrawName as string + Dim sElementName as string + Dim sAttributeSearch(4) as string + Dim sAttributeValue as string + Dim i as integer + Dim iChildsOfAutomaticStyles as integer + Dim iLoopSearch as integer + printlog "+- Presentation: someheaderfooter_varible.odp" + '/// Opening <i>xml\required\input\graphics\header_footer\someheaderfooter_varible.odp</i>. + call hFileOpen (gTesttoolPath & ConvertPath("xml\required\input\graphics\header_footer\someheaderfooter_varible.odp")) + '/// Saving document as <i>user\work\xml\graphics\update\someheaderfooter_varible.odp</i> with default presentation document name. + if hFileSaveAsWithFilterKill (gOfficePath & ConvertPath("user\work\xml\graphics\update\someheaderfooter_varible.odp") , "impress8") = TRUE then + '/// Closing document. /// + call hCloseDocument + '/// Unpacking the compressed (ZIP) archive. + UnpackStorage( gOfficePath & ConvertPath("user\work\xml\graphics\update\someheaderfooter_varible.odp") , gOfficePath & ConvertPath("user\work\xml\graphics\update\someheaderfooter_varible\") ) + '/// Verifying the well-formness of styles.xml, content.xml and meta.xml. + '///+ Only if the three XML files are well formed the next checks (GPF-check, attribute-search) will be started. + if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\graphics\update\someheaderfooter_varible\styles.xml")) = TRUE then + if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\graphics\update\someheaderfooter_varible\meta.xml")) = TRUE then + if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\graphics\update\someheaderfooter_varible\content.xml")) = TRUE then + '/// Opening exported document (GPF check). /// + call hFileOpen (gOfficePath & ConvertPath("user\work\xml\graphics\update\someheaderfooter_varible.odp") + sleep(2) + '/// Closing document. /// + call hCloseDocument + sleep(2) + '/// Opening user\work\xml\graphics\update\noheaderfooter\content.xml with SAX-parser. + SAXReadFile(gOfficePath & ConvertPath("user\work\xml\graphics\update\someheaderfooter_varible\content.xml")) + '/// <ol> + '///+<li> Parsing to office:document-content + For iLoopSearch = 1 to 2 + SAXSeekElement("office:document-content") + '///+ Parsing to office:body + SAXSeekElement("office:body") + '///+ Parsing to office:presentation + SAXSeekElement("office:presentation") + '///+ Parsing to draw:page + SAXSeekElement("draw:page") + '///+ In second loop enter <i>presentation:notes</i> node + if iLoopSearch = 2 then + SAXSeekElement("presentation:notes") + end if + '///+ Get value of draw:style-name + sDrawName = "" + sDrawName = SAXGetAttributeValue ("draw:style-name") + '///+ Get back to the top of DOM + SAXSeekElement("/") + '///+<li> Parsing to office:document-content + SAXSeekElement("office:document-content") + '///+ Parsing to office:automatic-styles + SAXSeekElement("office:automatic-styles") + '///+ Look where the style:style element is where the style:name is the same as it was for draw:name + iChildsOfAutomaticStyles = SAXGetChildCount + 'The count of style:style nodes is normaly 7 but the 8th is a text:list-style where + 'the searched attributes won't be included. + for i = 1 to (iChildsOfAutomaticStyles-1) + SAXSeekElement("style:style" , i) + sElementName = SAXGetAttributeValue("style:name") + if sElementName = sDrawName then + '///+ If found the named attribute (e.g. dp1) parsing to style:drawing-page-properties. + SAXSeekElement("style:drawing-page-properties") + exit for + end if + if i = iChildsOfAutomaticStyles then + '///+ If the style:name is not found a warnlog will be written into the log and the test will be stopped. + warnlog "Failed! The style:style='" & sDrawName & "' has not been found in the automatic-styles! Test will be aborted here!" + SAXRelease() + goto endsub + end if + 'Go one node to the parent node. + SAXSeekElement(0) + next i + if iLoopSearch = 1 then + '///+Parsing to <ol> + '///+ <li>presentation:display-footer</li> + '///+ <li>presentation:footer-decl</li> + '///+ <li>presentation:display-page-number</li> + '///+ <li>presentation:display-date-time</li></ol> + sAttributeSearch(1) = "presentation:display-footer" + sAttributeSearch(2) = "presentation:display-page-number" + sAttributeSearch(3) = "presentation:display-date-time" + for i = 1 to 3 + sAttributeValue = SAXGetAttributeValue(sAttributeSearch(i)) + '/// Verifying that the value of <i>presentation:display-footer</i> attribute is 'false'. + if i = 1 then + if sAttributeValue <> "false" then + warnlog "Failed! The value of '" & sAttributeSearch(i) & "' is NOT 'false'!" + else + printlog "Passed. The value of '" & sAttributeSearch(i) & "' is 'false'." + end if + else + '///+ Verifying that the values of <i>presentation:display-page-number</i> and <i>presentation:display-date-time</i> attribute are 'true'. + if sAttributeValue <> "true" then + warnlog "Failed! The value of '" & sAttributeSearch(i) & "' is NOT 'true'!" + else + printlog "Passed. The value of '" & sAttributeSearch(i) & "' is 'true'." + end if + end if + next i + '///+ Get back to the top of DOM + SAXSeekElement("/") + end if + if iLoopSearch = 2 then + '///+Parsing to second page-style attributes <ol> + '///+ <li>presentation:display-header</li> + '///+ <li>presentation:display-footer</li> + '///+ <li>presentation:display-page-number</li> + '///+ <li>presentation:display-date-time</li></ol> + sAttributeSearch(1) = "presentation:display-header" + sAttributeSearch(2) = "presentation:display-footer" + sAttributeSearch(3) = "presentation:display-page-number" + sAttributeSearch(4) = "presentation:display-date-time" + for i = 1 to 4 + sAttributeValue = SAXGetAttributeValue(sAttributeSearch(i)) + '/// Verifying that the value of <i>presentation:display-page-number</i> and <i>presentation:display-date-time</i> attributes is 'false'. + if i = 3 OR i = 4 then + if sAttributeValue <> "false" then + warnlog "Failed! The value of '" & sAttributeSearch(i) & "' is NOT 'false'!" + else + printlog "Passed. The value of '" & sAttributeSearch(i) & "' is 'false'." + end if + else + '///+ Verifying that the values of <i>presentation:display-header</i> and <i>presentation:display-footer</i> attribute are 'true'. + if sAttributeValue <> "true" then + warnlog "Failed! The value of '" & sAttributeSearch(i) & "' is NOT 'true'!" + else + printlog "Passed. The value of '" & sAttributeSearch(i) & "' is 'true'." + end if + end if + next i + end if + next iLoopSearch + SAXRelease() + else + warnlog "One of the XML files not well formed!" + end if + end if + end if + else + warnlog "It was not possible to save the document as XML!" + end if +endcase + +'------------------------------------------------------------------------- + diff --git a/testautomation/xml/required/input/graphics/alien_attributes/alien_attributes_presentation.odp b/testautomation/xml/required/input/graphics/alien_attributes/alien_attributes_presentation.odp Binary files differnew file mode 100755 index 000000000000..14c85af3e193 --- /dev/null +++ b/testautomation/xml/required/input/graphics/alien_attributes/alien_attributes_presentation.odp diff --git a/testautomation/xml/required/input/graphics/header_footer/allheaderfooter_fixed.odp b/testautomation/xml/required/input/graphics/header_footer/allheaderfooter_fixed.odp Binary files differnew file mode 100755 index 000000000000..f7b4f585ce9a --- /dev/null +++ b/testautomation/xml/required/input/graphics/header_footer/allheaderfooter_fixed.odp diff --git a/testautomation/xml/required/input/graphics/header_footer/noheaderfooter.odp b/testautomation/xml/required/input/graphics/header_footer/noheaderfooter.odp Binary files differnew file mode 100755 index 000000000000..2aed7413b526 --- /dev/null +++ b/testautomation/xml/required/input/graphics/header_footer/noheaderfooter.odp diff --git a/testautomation/xml/required/input/graphics/header_footer/nomasterelements.odp b/testautomation/xml/required/input/graphics/header_footer/nomasterelements.odp Binary files differnew file mode 100755 index 000000000000..46b9d05f8067 --- /dev/null +++ b/testautomation/xml/required/input/graphics/header_footer/nomasterelements.odp diff --git a/testautomation/xml/required/input/graphics/header_footer/someheaderfooter_varible.odp b/testautomation/xml/required/input/graphics/header_footer/someheaderfooter_varible.odp Binary files differnew file mode 100755 index 000000000000..16591a31f54d --- /dev/null +++ b/testautomation/xml/required/input/graphics/header_footer/someheaderfooter_varible.odp diff --git a/testautomation/xml/tools/includes/itools1.inc b/testautomation/xml/tools/includes/itools1.inc new file mode 100755 index 000000000000..52d683b07afc --- /dev/null +++ b/testautomation/xml/tools/includes/itools1.inc @@ -0,0 +1,66 @@ +'************************************************************************** +'* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +'* +'* Copyright 2008 by Sun Microsystems, Inc. +'* +'* OpenOffice.org - a multi-platform office productivity suite +'* +'* $RCSfile: itools1.inc,v $ +'* +'* $Revision: 1.2 $ +'* +'* last change: $Author: rt $ $Date: 2008-07-11 10:15:49 $ +'* +'* 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 : joerg.sievers@sun.com +'* +'* short description : Internet- and XML Tools +'* +'*************************************************************************************** +'* +' #1 hGetXMLRoot +'* +'\*********************************************************************************** +function hGetXMLRoot ( XMLFileName as string ) as boolean +'/// <i>hGetXML</i> +'/// +checks the initial XML-tag in the StarOffice-XML-document. This function is CASE SENSITIVE! +'/// +INPUT : <Filename as string> +'/// +RETURN : TRUE, FALSE + Dim FileNum as Integer + Dim xmlZeile as String + + hGetXMLRoot = FALSE + FileNum = FreeFile + + Open XMLFileName For Input As #FileNum + Do until EOF(#FileNum) = TRUE + Line input #FileNum, xmlZeile + xmlZeile = Trim ( xmlZeile ) + if xmlZeile = "<?xml version=" & CHR$(34) & "1.0" & CHR$(34) & " encoding=" & CHR$(34) & "UTF-8" & CHR$(34) & "?>" then + hGetXMLRoot = TRUE + Exit Function + end if + Loop + Close #FileNum +end function + +'------------------------------------------------------------------------- + diff --git a/testautomation/xml/tools/includes/xmltool1.inc b/testautomation/xml/tools/includes/xmltool1.inc new file mode 100755 index 000000000000..e4fffb249b6c --- /dev/null +++ b/testautomation/xml/tools/includes/xmltool1.inc @@ -0,0 +1,90 @@ +'encoding UTF-8 Do not remove or change this line! +'************************************************************************** +'* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +'* +'* Copyright 2008 by Sun Microsystems, Inc. +'* +'* OpenOffice.org - a multi-platform office productivity suite +'* +'* $RCSfile: xmltool1.inc,v $ +'* +'* $Revision: 1.2 $ +'* +'* last change: $Author: rt $ $Date: 2008-07-11 10:15:59 $ +'* +'* 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 : joerg.sievers@sun.com +'* +'* short description : XML Tools +'* +'*************************************************************************************** +'* +' #1 CreateWorkXMLExportDir +' #1 hEnablePrettyPrinting +'* +'\*********************************************************************************** +sub CreateWorkXMLExportDir ( DirName as string ) +'/*** <i>CreateWorkXMLExportDir</i> creates in the StarOffice/work- +'/*** +directory a directory. If the same name exists the content (files only) +'/*** +will be deleted. + Dim OutputPath as string + Dim Isliste(200) as string + Dim i, BornToKill + printlog "Checking work-dir & creating '" & gOfficePath & ConvertPath(DirName) & "'." + if hDirectoryExists ( gOfficePath & ConvertPath(DirName) ) = TRUE then + OutputPath = gOfficePath & ConvertPath(DirName) + IsListe(0) = 0 + GetFileList ( OutputPath , "*", IsListe() ) + BornToKill = KillFileList ( IsListe() ) + for i = 1 to BornToKill + warnlog IsListe(i) & " could not be deleted!" + next i + else + app.mkDir( gOfficePath & ConvertPath(DirName)) + end if +end sub +'------------------------------------------------------------------------- +sub hEnablePrettyPrinting (OPTIONAL A) +'/// <i>hEnablePrettyPrinting</i> enables the pretty printing (=better +'/// +formated view) in XML file export. It takes >10 percent more time +'/// +to save files!!! OPTIONAL parameter is used to DISABLE it. + ToolsOptions + Kontext "ExtrasOptionenDLG" + call hToolsOptions("loadsave","general") + Kontext "TabSpeichern" + if IsMissing(A) then + if NoPrettyPrinting.IsChecked = TRUE then + NoPrettyPrinting.Uncheck + sleep(1) + printlog "- XML pretty printing enabled ( xmltool1.inc )" + end if + else + if NoPrettyPrinting.IsChecked = FALSE then + NoPrettyPrinting.Check + sleep(1) + printlog "- XML pretty printing disabled ( xmltool1.inc )" + end if + end if + Kontext "ExtrasOptionenDLG" + ExtrasOptionenDLG.OK +end sub +'------------------------------------------------------------------------- + |