diff options
Diffstat (limited to 'qadevOOo/tests/basic/mod/sm')
18 files changed, 879 insertions, 0 deletions
diff --git a/qadevOOo/tests/basic/mod/sm/SmEditAccessible/script.xlb b/qadevOOo/tests/basic/mod/sm/SmEditAccessible/script.xlb new file mode 100644 index 000000000000..a19ead0edc9b --- /dev/null +++ b/qadevOOo/tests/basic/mod/sm/SmEditAccessible/script.xlb @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd"> +<library:library xmlns:library="http://openoffice.org/2000/library" library:name="sm_SmEditAccessible" library:readonly="false" library:passwordprotected="false"> +"<library:element library:name="sm_SmEditAccessible"/> +"</library:library> diff --git a/qadevOOo/tests/basic/mod/sm/SmEditAccessible/sm_SmEditAccessible.xba b/qadevOOo/tests/basic/mod/sm/SmEditAccessible/sm_SmEditAccessible.xba new file mode 100644 index 000000000000..fef7c4783a37 --- /dev/null +++ b/qadevOOo/tests/basic/mod/sm/SmEditAccessible/sm_SmEditAccessible.xba @@ -0,0 +1,78 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> +<script:module xmlns:script="http://openoffice.org/2000/script" script:name="sm_SmEditAccessible" script:language="StarBasic"> + + +'************************************************************************* +' +' 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. +' +'************************************************************************* +'************************************************************************* + + + +' Be sure that all variables are dimensioned: +option explicit + + +' REQUIRED VARIABLES for interface/service tests: + +'Required for XAccessibleText +Global accText As String + + +Sub CreateObj() + +'************************************************************************* +' COMPONENT: +' sm.SmEditAccessible +'************************************************************************* +On Error Goto ErrHndl + oDoc = utils.createDocument("smath", cObjectName) + + accText = "sum hat a" + oDoc.Formula = accText + + wait(2000) + + Dim oWin As Object + Dim xRoot As Object + + oWin = utils.at_getCurrentWindow(oDoc) + xRoot = utils.at_getAccessibleObject(oWin) + + oObj = utils.at_getAccessibleObjectForRole(xRoot, com.sun.star.accessibility.AccessibleRole.PANEL, "Commands") +Exit Sub +ErrHndl: + Test.Exception() +End Sub + +Sub fireEvent() + oDoc.Formula = "sum hat x" + wait(2000) + oDoc.Formula = accText + wait(2000) +End Sub +</script:module> diff --git a/qadevOOo/tests/basic/mod/sm/SmGraphicAccessible/script.xlb b/qadevOOo/tests/basic/mod/sm/SmGraphicAccessible/script.xlb new file mode 100644 index 000000000000..aff350c9c197 --- /dev/null +++ b/qadevOOo/tests/basic/mod/sm/SmGraphicAccessible/script.xlb @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd"> +<library:library xmlns:library="http://openoffice.org/2000/library" library:name="sm_SmGraphicAccessible" library:readonly="false" library:passwordprotected="false"> +"<library:element library:name="sm_SmGraphicAccessible"/> +"</library:library> diff --git a/qadevOOo/tests/basic/mod/sm/SmGraphicAccessible/sm_SmGraphicAccessible.xba b/qadevOOo/tests/basic/mod/sm/SmGraphicAccessible/sm_SmGraphicAccessible.xba new file mode 100644 index 000000000000..4990d276e4fd --- /dev/null +++ b/qadevOOo/tests/basic/mod/sm/SmGraphicAccessible/sm_SmGraphicAccessible.xba @@ -0,0 +1,79 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> +<script:module xmlns:script="http://openoffice.org/2000/script" script:name="sm_SmGraphicAccessible" script:language="StarBasic"> + + +'************************************************************************* +' +' 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. +' +'************************************************************************* +'************************************************************************* + + + +' Be sure that all variables are dimensioned: +option explicit + + +' REQUIRED VARIABLES for interface/service tests: + +'Required for XAccessibleText +Global accText As String +Global readOnly as Boolean + +Sub CreateObj() + +'************************************************************************* +' COMPONENT: +' sm.SmGraphicAccessible +'************************************************************************* +On Error Goto ErrHndl + oDoc = utils.createDocument("smath", cObjectName) + + accText = "sum a cdot b" + oDoc.Formula = accText + + wait(2000) + + Dim oWin As Object + Dim xRoot As Object + + oWin = utils.at_getCurrentWindow(oDoc) + xRoot = utils.at_getAccessibleObject(oWin) + + oObj = utils.at_getAccessibleObjectForRole(xRoot, com.sun.star.accessibility.AccessibleRole.DOCUMENT, "Formula") + readOnly = false +Exit Sub +ErrHndl: + Test.Exception() +End Sub + +Sub fireEvent() + oDoc.Formula = "sum hat x" + wait(2000) + oDoc.Formula = accText + wait(2000) +End Sub +</script:module> diff --git a/qadevOOo/tests/basic/mod/sm/SmModel/script.xlb b/qadevOOo/tests/basic/mod/sm/SmModel/script.xlb new file mode 100644 index 000000000000..0ef9ff02ff5a --- /dev/null +++ b/qadevOOo/tests/basic/mod/sm/SmModel/script.xlb @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd"> +<library:library xmlns:library="http://openoffice.org/2000/library" library:name="sm_SmModel" library:readonly="false" library:passwordprotected="false"> +"<library:element library:name="sm_SmModel"/> +"</library:library> diff --git a/qadevOOo/tests/basic/mod/sm/SmModel/sm_SmModel.xba b/qadevOOo/tests/basic/mod/sm/SmModel/sm_SmModel.xba new file mode 100644 index 000000000000..0247417e56c1 --- /dev/null +++ b/qadevOOo/tests/basic/mod/sm/SmModel/sm_SmModel.xba @@ -0,0 +1,54 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> +<script:module xmlns:script="http://openoffice.org/2000/script" script:name="sm_SmModel" script:language="StarBasic"> + + +'************************************************************************* +' +' 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. +' +'************************************************************************* +'************************************************************************* + + + +' Be sure that all variables are dimensioned: +option explicit + + + +Sub CreateObj() + +'************************************************************************* +' COMPONENT: +' sm.SmModel +'************************************************************************* +On Error Goto ErrHndl + oDoc = utils.createDocument("smath", cObjectName) + oObj = oDoc +Exit Sub +ErrHndl: + Test.Exception() +End Sub +</script:module> diff --git a/qadevOOo/tests/basic/mod/sm/XMLExporter/script.xlb b/qadevOOo/tests/basic/mod/sm/XMLExporter/script.xlb new file mode 100644 index 000000000000..aa91c6231059 --- /dev/null +++ b/qadevOOo/tests/basic/mod/sm/XMLExporter/script.xlb @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd"> +<library:library xmlns:library="http://openoffice.org/2000/library" library:name="sm_XMLExporter" library:readonly="false" library:passwordprotected="false"> +"<library:element library:name="sm_XMLExporter"/> +"</library:library> diff --git a/qadevOOo/tests/basic/mod/sm/XMLExporter/sm_XMLExporter.xba b/qadevOOo/tests/basic/mod/sm/XMLExporter/sm_XMLExporter.xba new file mode 100644 index 000000000000..9b3f4a00eea4 --- /dev/null +++ b/qadevOOo/tests/basic/mod/sm/XMLExporter/sm_XMLExporter.xba @@ -0,0 +1,109 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> +<script:module xmlns:script="http://openoffice.org/2000/script" script:name="sm_XMLExporter" script:language="StarBasic"> + + +'************************************************************************* +' +' 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. +' +'************************************************************************* +'************************************************************************* + + + +' Be sure that all variables are dimensioned: +option explicit + + +' REQUIRED VARIABLES for interface/service tests: + +' Required for com.sun.star.lang.XInitialization: + Global aInitArgs() As Variant + +' Required for com.sun.star.document.XFilter: + Global oFilterDescriptor As Variant + +' Required for com.sun.star.document.XExporter: + Global oSrcDocument As Object + + +Sub CreateObj() + +'************************************************************************* +' COMPONENT: +' sm.XMLExporter +'************************************************************************* +On Error Goto ErrHndl + Dim initArgs(0) As Object + Dim oMSF As Object + Dim filter As Variant + Dim printXML As Boolean + Dim Tag1, Tag2, Tag3 As Variant + Dim expFormula As String + + printXML = true + expFormula = "a - b" + oMSF = getProcessServiceManager() + oDoc = utils.createDocument("smath", cObjectName) + oDocHandler = oMSF.createInstanceWithArguments("basichelper.DocumentHandler", Array(printXML)) + + Tag1 = Array("math:math") + Tag2 = Array("math:annotation") + Tag3 = Array("math:semantics") + filter = Array( _ + Array("TagExists", Tag1), _ + Array("TagEnclosed", Tag2, Tag3), _ + Array("CharsEnclosed", Tag2, expFormula) _ + ) + + oDocHandler.initialize(filter) + + initArgs(0) = oDocHandler + aInitArgs = initArgs() + oObj = oMSF.createInstanceWithArguments("com.sun.star.comp.Math.XMLExporter", initArgs()) + + oDoc.setPropertyValue("Formula", expFormula) + + oObj.setSourceDocument(oDoc) + + Dim aFilterDescr(0) As New com.sun.star.beans.PropertyValue + aFilterDescr(0).Name = "FilterName" + aFilterDescr(0).Value = "smath: StarOffice XML (Formula)" + oFilterDescriptor = aFilterDescr() + + oSrcDocument = oDoc + +Exit Sub +ErrHndl: + Test.Exception() +End Sub + +Global oDocHandler As Object + +Function checkFilter() As Boolean + checkFilter = oDocHandler.getByName("XMLIsCorrect") + Out.Log(oDocHandler.getByName("XMLCode")) +End Function +</script:module> diff --git a/qadevOOo/tests/basic/mod/sm/XMLImporter/script.xlb b/qadevOOo/tests/basic/mod/sm/XMLImporter/script.xlb new file mode 100644 index 000000000000..a0d5abd5eff0 --- /dev/null +++ b/qadevOOo/tests/basic/mod/sm/XMLImporter/script.xlb @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd"> +<library:library xmlns:library="http://openoffice.org/2000/library" library:name="sm_XMLImporter" library:readonly="false" library:passwordprotected="false"> +"<library:element library:name="sm_XMLImporter"/> +"</library:library> diff --git a/qadevOOo/tests/basic/mod/sm/XMLImporter/sm_XMLImporter.xba b/qadevOOo/tests/basic/mod/sm/XMLImporter/sm_XMLImporter.xba new file mode 100644 index 000000000000..4f7e90db93a1 --- /dev/null +++ b/qadevOOo/tests/basic/mod/sm/XMLImporter/sm_XMLImporter.xba @@ -0,0 +1,85 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> +<script:module xmlns:script="http://openoffice.org/2000/script" script:name="sm_XMLImporter" script:language="StarBasic"> + + +'************************************************************************* +' +' 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. +' +'************************************************************************* +'************************************************************************* + + + +' Be sure that all variables are dimensioned: +option explicit + + +' REQUIRED VARIABLES for interface/service tests: + +' Required for com.sun.star.xml.sax.XDocumentHandler + Global vXMLData As Variant + +' Required for procedure CheckImport + Global sFormula As String + +' Required for com.sun.star.document.XImporter: + Global oSrcDocument As Object + + +Sub CreateObj() + +'************************************************************************* +' COMPONENT: +' sm.XMLImporter +'************************************************************************* +On Error Goto ErrHndl + oDoc = utils.createDocument("smath", cObjectName) + oObj = createUnoService("com.sun.star.comp.Math.XMLImporter") + + oSrcDocument = oDoc + oObj.setTargetDocument(oDoc) + + sFormula = "a - b" + vXMLData = Array( _ + Array("start", "math:math", _ + "xmlns:math", "CDATA", "http://www.w3.org/1998/Math/MathML"), _ + Array("start", "math:semantics"), _ + Array("start", "math:annotation", _ + "math:encoding", "CDATA", "StarMath 5.0"), _ + Array("chars", sFormula), _ + Array("end", "math:annotation"), _ + Array("end", "math:semantics"), _ + Array("end", "math:math") ) +Exit Sub +ErrHndl: + Test.Exception() +End Sub + +Function CheckImport() As Boolean + out.log("checking of import...") + CheckImport() = (oDoc.getPropertyValue("Formula") = sFormula) +End Function +</script:module> diff --git a/qadevOOo/tests/basic/mod/sm/XMLMetaExporter/script.xlb b/qadevOOo/tests/basic/mod/sm/XMLMetaExporter/script.xlb new file mode 100644 index 000000000000..cfc33f047031 --- /dev/null +++ b/qadevOOo/tests/basic/mod/sm/XMLMetaExporter/script.xlb @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd"> +<library:library xmlns:library="http://openoffice.org/2000/library" library:name="sm_XMLMetaExporter" library:readonly="false" library:passwordprotected="false"> +"<library:element library:name="sm_XMLMetaExporter"/> +"</library:library> diff --git a/qadevOOo/tests/basic/mod/sm/XMLMetaExporter/sm_XMLMetaExporter.xba b/qadevOOo/tests/basic/mod/sm/XMLMetaExporter/sm_XMLMetaExporter.xba new file mode 100644 index 000000000000..503d50e37ff8 --- /dev/null +++ b/qadevOOo/tests/basic/mod/sm/XMLMetaExporter/sm_XMLMetaExporter.xba @@ -0,0 +1,111 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> +<script:module xmlns:script="http://openoffice.org/2000/script" script:name="sm_XMLMetaExporter" script:language="StarBasic"> + + +'************************************************************************* +' +' 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. +' +'************************************************************************* +'************************************************************************* + + + +' Be sure that all variables are dimensioned: +option explicit + + +' REQUIRED VARIABLES for interface/service tests: + +' Required for com.sun.star.lang.XInitialization: + Global aInitArgs() As Variant + +' Required for com.sun.star.document.XFilter: + Global oFilterDescriptor As Variant + +' Required for com.sun.star.document.XExporter: + Global oSrcDocument As Object + + +Sub CreateObj() + +'************************************************************************* +' COMPONENT: +' sm.XMLMetaExporter +'************************************************************************* +On Error Goto ErrHndl + Dim initArgs(0) As Object + Dim oMSF As Object + Dim filter As Variant + Dim printXML As Boolean + Dim Tag1, Tag2 As Variant + Dim expMetaName, expMetaValue As String + Dim oDocInfo As Object + + printXML = true + expMetaName = "XMLMetaExporterName" + expMetaValue = "XMLMetaExporterValue" + oMSF = getProcessServiceManager() + oDoc = utils.createDocument("smath", cObjectName) + oDocHandler = oMSF.createInstanceWithArguments("basichelper.DocumentHandler", Array(printXML)) + + Tag1 = Array("office:document-meta") + Tag2 = Array("meta:user-defined", "meta:name", expMetaName) + filter = Array( _ + Array("TagExists", Tag1), _ + Array("CharsEnclosed", Tag2, expMetaValue) _ + ) + + oDocHandler.initialize(filter) + + initArgs(0) = oDocHandler + aInitArgs = initArgs() + oObj = oMSF.createInstanceWithArguments("com.sun.star.comp.Math.XMLMetaExporter", initArgs()) + + oDocInfo = oDoc.getDocumentInfo() + oDocInfo.setUserFieldName(0, expMetaName) + oDocInfo.setUserFieldValue(0, expMetaValue) + + oObj.setSourceDocument(oDoc) + + Dim aFilterDescr(0) As New com.sun.star.beans.PropertyValue + aFilterDescr(0).Name = "FilterName" + aFilterDescr(0).Value = "smath: StarOffice XML (Formula)" + oFilterDescriptor = aFilterDescr() + + oSrcDocument = oDoc + +Exit Sub +ErrHndl: + Test.Exception() +End Sub + +Global oDocHandler As Object + +Function checkFilter() As Boolean + checkFilter = oDocHandler.getByName("XMLIsCorrect") + Out.Log(oDocHandler.getByName("XMLCode")) +End Function +</script:module> diff --git a/qadevOOo/tests/basic/mod/sm/XMLMetaImporter/script.xlb b/qadevOOo/tests/basic/mod/sm/XMLMetaImporter/script.xlb new file mode 100644 index 000000000000..7231ac372d02 --- /dev/null +++ b/qadevOOo/tests/basic/mod/sm/XMLMetaImporter/script.xlb @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd"> +<library:library xmlns:library="http://openoffice.org/2000/library" library:name="sm_XMLMetaImporter" library:readonly="false" library:passwordprotected="false"> +"<library:element library:name="sm_XMLMetaImporter"/> +"</library:library> diff --git a/qadevOOo/tests/basic/mod/sm/XMLMetaImporter/sm_XMLMetaImporter.xba b/qadevOOo/tests/basic/mod/sm/XMLMetaImporter/sm_XMLMetaImporter.xba new file mode 100644 index 000000000000..12210bf62867 --- /dev/null +++ b/qadevOOo/tests/basic/mod/sm/XMLMetaImporter/sm_XMLMetaImporter.xba @@ -0,0 +1,113 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> +<script:module xmlns:script="http://openoffice.org/2000/script" script:name="sm_XMLMetaImporter" script:language="StarBasic"> + + +'************************************************************************* +' +' 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. +' +'************************************************************************* +'************************************************************************* + + + +' Be sure that all variables are dimensioned: +option explicit + + +' REQUIRED VARIABLES for interface/service tests: + +' Required for com.sun.star.xml.sax.XDocumentHandler + Global vXMLData As Variant + +' Required for procedure CheckImport + Global sTitle, sName, sValue As String + +' Required for com.sun.star.document.XImporter: + Global oSrcDocument As Object + + + +Sub CreateObj() + +'************************************************************************* +' COMPONENT: +' sm.XMLMetaImporter +'************************************************************************* +On Error Goto ErrHndl + oDoc = utils.createDocument("smath", cObjectName) + oObj = createUnoService("com.sun.star.comp.Math.XMLMetaImporter") + + oSrcDocument = oDoc + oObj.setTargetDocument(oDoc) + + sTitle = "XMLMetaImporter Title" + sName = "XMLMetaImporter" + sValue = "XMLMetaImporter_Value" + vXMLData = Array( _ + Array("start", "office:document-meta", _ + "xmlns:office", "CDATA", "http://openoffice.org/2000/office", _ + "xmlns:meta", "CDATA", "http://openoffice.org/2000/meta", _ + "xmlns:xlink", "CDATA", "http://www.w3.org/1999/xlink", _ + "xmlns:dc", "CDATA", "http://purl.org/dc/elements/1.1/"), _ + Array("start", "office:meta"), _ + Array("start", "dc:title"), _ + Array("chars", sTitle), _ + Array("end", "dc:title"), _ + Array("start", "meta:user-defined", _ + "meta:name", "CDATA", sName), _ + Array("chars", sValue), _ + Array("end", "meta:user-defined"), _ + Array("end", "office:meta"), _ + Array("end", "office:document-meta")) +Exit Sub +ErrHndl: + Test.Exception() +End Sub + +Function CheckImport() As Boolean + out.log("checking of import...") + Dim res As Boolean + Dim i As Integer + Dim docInfo As Object + Dim fieldValue, fieldName, title as String + docInfo = oDoc.getDocumentInfo() + res = false + For i = 0 to docInfo.getUserFieldCount() - 1 + fieldName = docInfo.getUserFieldName(i) + fieldValue = docInfo.getUserFieldValue(i) + out.log("Field name: " + fieldName + " Value: " + fieldValue) + If (fieldName = sName) and (fieldValue = sValue) then + res = true + EndIf + Next i + + title = docInfo.getPropertyValue("Title") + out.log("Title: " + title) + res = res and (title = sTitle) + out.log("checking result: " + res) + CheckImport() = res +End Function +</script:module> diff --git a/qadevOOo/tests/basic/mod/sm/XMLSettingsExporter/script.xlb b/qadevOOo/tests/basic/mod/sm/XMLSettingsExporter/script.xlb new file mode 100644 index 000000000000..5fdd3687c0bb --- /dev/null +++ b/qadevOOo/tests/basic/mod/sm/XMLSettingsExporter/script.xlb @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd"> +<library:library xmlns:library="http://openoffice.org/2000/library" library:name="sm_XMLSettingsExporter" library:readonly="false" library:passwordprotected="false"> +"<library:element library:name="sm_XMLSettingsExporter"/> +"</library:library> diff --git a/qadevOOo/tests/basic/mod/sm/XMLSettingsExporter/sm_XMLSettingsExporter.xba b/qadevOOo/tests/basic/mod/sm/XMLSettingsExporter/sm_XMLSettingsExporter.xba new file mode 100644 index 000000000000..7fa1af0005bd --- /dev/null +++ b/qadevOOo/tests/basic/mod/sm/XMLSettingsExporter/sm_XMLSettingsExporter.xba @@ -0,0 +1,107 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> +<script:module xmlns:script="http://openoffice.org/2000/script" script:name="sm_XMLSettingsExporter" script:language="StarBasic"> + + +'************************************************************************* +' +' 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. +' +'************************************************************************* +'************************************************************************* + + + +' Be sure that all variables are dimensioned: +option explicit + + +' REQUIRED VARIABLES for interface/service tests: + +' Required for com.sun.star.lang.XInitialization: + Global aInitArgs() As Variant + +' Required for com.sun.star.document.XFilter: + Global oFilterDescriptor As Variant + +' Required for com.sun.star.document.XExporter: + Global oSrcDocument As Object + + +Sub CreateObj() + +'************************************************************************* +' COMPONENT: +' sm.XMLSettingsExporter +'************************************************************************* +On Error Goto ErrHndl + Dim initArgs(0) As Object + Dim oMSF As Object + Dim filter As Variant + Dim printXML As Boolean + Dim Tag1, Tag2 As Variant + Dim expMargin As Integer + + printXML = true + expMargin = 67 + oMSF = getProcessServiceManager() + oDoc = utils.createDocument("smath", cObjectName) + oDocHandler = oMSF.createInstanceWithArguments("basichelper.DocumentHandler", Array(printXML)) + + Tag1 = Array("office:document-settings") + Tag2 = Array("config:config-item", "config:name", "TopMargin") + filter = Array( _ + Array("TagExists", Tag1), _ + Array("CharsEnclosed", Tag2, ""+expMargin) _ + ) + + oDocHandler.initialize(filter) + + initArgs(0) = oDocHandler + aInitArgs = initArgs() + oObj = oMSF.createInstanceWithArguments("com.sun.star.comp.Math.XMLSettingsExporter", initArgs()) + + oDoc.setPropertyValue("TopMargin", expMargin) + + oObj.setSourceDocument(oDoc) + + Dim aFilterDescr(0) As New com.sun.star.beans.PropertyValue + aFilterDescr(0).Name = "FilterName" + aFilterDescr(0).Value = "smath: StarOffice XML (Formula)" + oFilterDescriptor = aFilterDescr() + + oSrcDocument = oDoc + +Exit Sub +ErrHndl: + Test.Exception() +End Sub + +Global oDocHandler As Object + +Function checkFilter() As Boolean + checkFilter = oDocHandler.getByName("XMLIsCorrect") + Out.Log(oDocHandler.getByName("XMLCode")) +End Function +</script:module> diff --git a/qadevOOo/tests/basic/mod/sm/XMLSettingsImporter/script.xlb b/qadevOOo/tests/basic/mod/sm/XMLSettingsImporter/script.xlb new file mode 100644 index 000000000000..055b77c7819a --- /dev/null +++ b/qadevOOo/tests/basic/mod/sm/XMLSettingsImporter/script.xlb @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd"> +<library:library xmlns:library="http://openoffice.org/2000/library" library:name="sm_XMLSettingsImporter" library:readonly="false" library:passwordprotected="false"> +"<library:element library:name="sm_XMLSettingsImporter"/> +"</library:library> diff --git a/qadevOOo/tests/basic/mod/sm/XMLSettingsImporter/sm_XMLSettingsImporter.xba b/qadevOOo/tests/basic/mod/sm/XMLSettingsImporter/sm_XMLSettingsImporter.xba new file mode 100644 index 000000000000..b6f047f02d83 --- /dev/null +++ b/qadevOOo/tests/basic/mod/sm/XMLSettingsImporter/sm_XMLSettingsImporter.xba @@ -0,0 +1,98 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> +<script:module xmlns:script="http://openoffice.org/2000/script" script:name="sm_XMLSettingsImporter" script:language="StarBasic"> + + +'************************************************************************* +' +' 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. +' +'************************************************************************* +'************************************************************************* + + + +' Be sure that all variables are dimensioned: +option explicit + + +' REQUIRED VARIABLES for interface/service tests: + +' Required for com.sun.star.xml.sax.XDocumentHandler + Global vXMLData As Variant + +' Required for procedure CheckImport + Global sMargin As Integer + +' Required for com.sun.star.document.XImporter: + Global oSrcDocument As Object + + + +Sub CreateObj() + +'************************************************************************* +' COMPONENT: +' sm.XMLSettingsImporter +'************************************************************************* +On Error Goto ErrHndl + oDoc = utils.createDocument("smath", cObjectName) + oObj = createUnoService("com.sun.star.comp.Math.XMLSettingsImporter") + + oSrcDocument = oDoc + oObj.setTargetDocument(oDoc) + + sMargin = "67" + vXMLData = Array( _ + Array("start", "office:document-settings", _ + "xmlns:office", "CDATA", "http://openoffice.org/2000/office", _ + "xmlns:config", "CDATA", "http://openoffice.org/2001/config", _ + "xmlns:xlink", "CDATA", "http://www.w3.org/1999/xlink", _ + "office:version", "CDATA", "1.0"), _ + Array("start", "office:settings"), _ + Array("start", "config:config-item-set", _ + "config:name", "CDATA", "configuration-settings"), _ + Array("start", "config:config-item", _ + "config:name", "CDATA", "TopMargin", _ + "config:type", "CDATA", "short"), _ + Array("chars", sMargin), _ + Array("end", "config:config-item"), _ + Array("end", "config:config-item-set"), _ + Array("end", "office:settings"), _ + Array("end", "office:document-settings")) +Exit Sub +ErrHndl: + Test.Exception() +End Sub + +Function CheckImport() As Boolean + out.log("checking of import...") + Dim res As Boolean + Dim margin As String + margin = oDoc.getPropertyValue("TopMargin") + res = margin = sMargin + out.log("checking result: " + res) + CheckImport() = res +End Function +</script:module> |