diff options
Diffstat (limited to 'qadevOOo/tests/basic/ifc/container')
32 files changed, 1591 insertions, 0 deletions
diff --git a/qadevOOo/tests/basic/ifc/container/XChild/container_XChild.xba b/qadevOOo/tests/basic/ifc/container/XChild/container_XChild.xba new file mode 100644 index 000000000000..b0010d001635 --- /dev/null +++ b/qadevOOo/tests/basic/ifc/container/XChild/container_XChild.xba @@ -0,0 +1,83 @@ +<?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="container_XChild" script:language="StarBasic"> + + +'************************************************************************* +' +' 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: container_XChild.xba,v $ +' +' $Revision: 1.4 $ +' +' 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. +' +'************************************************************************* +'************************************************************************* + +'************************************************************************* +' This Interface/Service test depends on the followingobject relations +' variables, which must be specified in the object creation: + +' ObjectRelation: oObjRelation(0).Name = "cannotSwitchParent" +' ObjectRelation: oObjRelation(0).Value = "configmgr: BasicElement::setParent: cannot move Entry" + +'************************************************************************* + +Sub RunTest() + +'************************************************************************* +' INTERFACE: +' com.sun.star.container.XChild +'************************************************************************* +On Error Goto ErrHndl + + Dim bOK As Boolean + Dim oXInterface As Object + Dim vRaises As Variant + + Test.StartMethod("getParent()") + bOK = isObject(oObj.getParent()) + Test.MethodTested("getParent()", bOK) + + Test.StartMethod("setParent()") + bOK = true + Dim cObjRelation as Variant + cObjRelation = utils.getObjectRelation("cannotSwitchParent") + if isNull(cObjRelation) then + oXInterface = oObj.getParent() + vRaises = oObj.setParent(oXInterface) + bOK = bOK AND isEmpty(vRaises) + else + out.Log(cObjRelation) + end if + Test.MethodTested("setParent()", bOK) + + +Exit Sub +ErrHndl: + Test.Exception() + bOK = false + resume next +End Sub +</script:module> diff --git a/qadevOOo/tests/basic/ifc/container/XChild/script.xlb b/qadevOOo/tests/basic/ifc/container/XChild/script.xlb new file mode 100644 index 000000000000..c2d2f44eccf7 --- /dev/null +++ b/qadevOOo/tests/basic/ifc/container/XChild/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="container_XChild" library:readonly="false" library:passwordprotected="false"> +"<library:element library:name="container_XChild"/> +"</library:library> diff --git a/qadevOOo/tests/basic/ifc/container/XContainer/container_XContainer.xba b/qadevOOo/tests/basic/ifc/container/XContainer/container_XContainer.xba new file mode 100644 index 000000000000..0de958d0497e --- /dev/null +++ b/qadevOOo/tests/basic/ifc/container/XContainer/container_XContainer.xba @@ -0,0 +1,232 @@ +<?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="container_XContainer" script:language="StarBasic"> + + +'************************************************************************* +' +' 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: container_XContainer.xba,v $ +' +' $Revision: 1.7 $ +' +' 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. +' +'************************************************************************* +'************************************************************************* + + + +'************************************************************************* +' This Interface/Service test depends on the following GLOBAL variables, +' which must be specified in the object creation: + +' Global oElementToInsert As Object +' Global oContainer As Object in case if the component tested does +' not support XNameContainer + +'************************************************************************* + +Dim ElIns1 As Integer +Dim ElIns2 As Integer +Dim ElRem1 As Integer +Dim ElRem2 As Integer +Dim ElRep1 As Integer +Dim ElRep2 As Integer + + +Sub RunTest() + +'************************************************************************* +' INTERFACE: +' com.sun.star.container.XContainer +'************************************************************************* +On Error Goto ErrHndl + Dim bOK As Boolean + Dim oListener1 as Object + Dim oListener2 as Object + + oListener1 = createUNOListener("CB1_", "com.sun.star.container.XContainerListener") + oListener2 = createUNOListener("CB2_", "com.sun.star.container.XContainerListener") + bOK = NOT isNULL(oListener1) AND NOT isNULL(oListener2) + Out.Log("Listeners creation : " + bOK) + + Test.StartMethod("addContainerListener()") + bOK = true + oObj.addContainerListener(oListener1) + Out.Log("Listener1 was added") + oObj.addContainerListener(oListener2) + Out.Log("Listener2 was added") + + insertElement() + + Dim bInsOK As Boolean + bInsOK = ElIns1 >= 1 AND ElIns2 >= 1 + Out.Log("... " + bInsOK) + bOK = bOK AND bInsOK + + removeElement() + + bRemOK = ElRem1 >= 1 AND ElRem2 >= 1 + Out.Log("... " + bRemOK) + bOK = bOK AND bRemOK + + Dim bNothingToReplace as Boolean + bNothingToReplace = replaceElement() + + bRepOK = (ElRep1 >= 1 AND ElRep2 >= 1) OR bNothingToReplace + Out.Log("... " + bRepOK) + bOK = bOK AND bRepOK + + Test.MethodTested("addContainerListener()", bOK) + + + Test.StartMethod("removeContainerListener()") + bOK = true + oObj.removeContainerListener(oListener1) + Out.Log("Listener1 was removed") + + insertElement() + + bInsOK = ElIns1 = 0 AND ElIns2 >= 1 + Out.Log("... " + bInsOK) + bOK = bOK AND bInsOK + + removeElement() + + bRemOK = ElRem1 = 0 AND ElRem2 >= 1 + Out.Log("... " + bRemOK) + bOK = bOK AND bRemOK + + bNothingToReplace = replaceElement() + + bRepOK = (ElRep1 = 0 AND ElRep2 >= 1) or bNothingToReplace + Out.Log("... " + bRepOK) + bOK = bOK AND bRepOK + Test.MethodTested("removeContainerListener()", bOK) + + oObj.removeContainerListener(oListener2) + Out.Log("Listener2 was removed") + +Exit Sub +ErrHndl: + Test.Exception() + bOK = false + resume next +End Sub + +Sub insertElement() + Out.Log("Inserting element ... ") + ResetCounters() + if hasUnoInterfaces(oObj, "com.sun.star.container.XNameContainer") then + oObj.InsertByName(cIfcShortName, oElementToInsert) + elseif hasUnoInterfaces(oContainer, "com.sun.star.container.XNameContainer") then + oContainer.InsertByName(cIfcShortName, oElementToInsert) + elseif hasUnoInterfaces(oContainer, "com.sun.star.awt.XControlContainer") then + oContainer.addControl("NewControl", oElementToInsert) + else + Out.LOG("There is nothig to trigger the Listener!") + end if +end Sub + + +Sub removeElement() + Out.Log("Removing element ... ") + ResetCounters() + if hasUnoInterfaces(oObj, "com.sun.star.container.XNameContainer") then + oObj.RemoveByName(cIfcShortName) + elseif hasUnoInterfaces(oContainer, "com.sun.star.container.XNameContainer") then + oContainer.RemoveByName(cIfcShortName) + elseif hasUnoInterfaces(oContainer, "com.sun.star.awt.XControlContainer") then + oContainer.removeControl(oElementToInsert) + end if +end Sub + +Function replaceElement() as Boolean + Out.Log("Replacing element ... ") + ResetCounters() + Dim bNothingToReplace as Boolean + bNothingToReplace = FALSE + Dim old As Variant + if hasUnoInterfaces(oObj, "com.sun.star.container.XIndexReplace") then + old = oObj.getByIndex(0) + oObj.ReplaceByIndex(0, oElementToInsert) + oObj.ReplaceByIndex(0, old) + elseif hasUnoInterfaces(oContainer, "com.sun.star.container.XIndexReplace") then + old = oContainer.getByIndex(0) + oContainer.ReplaceByIndex(0, oElementToInsert) + oContainer.ReplaceByIndex(0, old) + elseif (hasUnoInterfaces(oContainer, "com.sun.star.container.XNameAccess") and _ + hasUnoInterfaces(oContainer, "com.sun.star.container.XNameReplace")) then + Dim cNames() as String + cNames = oObj.getElementNames() + old = oContainer.getByName(cNames(0)) + oContainer.ReplaceByName(cNames(0), oElementToInsert) + oContainer.ReplaceByName(cNames(0), old) + elseif hasUnoInterfaces(oContainer, "com.sun.star.awt.XControlContainer") then + bNothingToReplace = TRUE + else + Out.LOG("There is nothig to trigger the Listener!") + end if + replaceElement() = bNothingToReplace +end Function + +Sub CB1_elementInserted(ev As Object) + Out.Log("CB1 called: element was inserted") + ElIns1 = ElIns1 + 1 +End Sub + +Sub CB1_elementRemoved(ev As Object) + Out.Log("CB1 called: element was removed") + ElRem1 = ElRem1 + 1 +End Sub + +Sub CB1_elementReplaced(ev As Object) + Out.Log("CB1 called: element was replaced") + ElRep1 = ElRep1 + 1 +End Sub + +Sub CB2_elementInserted(ev As Object) + Out.Log("CB2 called: element was inserted") + ElIns2 = ElIns2 + 1 +End Sub + +Sub CB2_elementRemoved(ev As Object) + Out.Log("CB2 called: element was removed") + ElRem2 = ElRem2 + 1 +End Sub + +Sub CB2_elementReplaced(ev As Object) + Out.Log("CB2 called: element was replaced") + ElRep2 = ElRep2 + 1 +End Sub + +Sub ResetCounters() + ElIns1 = 0 + ElIns2 = 0 + ElRem1 = 0 + ElRem2 = 0 + ElRep1 = 0 + ElRep2 = 0 +End Sub +</script:module> diff --git a/qadevOOo/tests/basic/ifc/container/XContainer/script.xlb b/qadevOOo/tests/basic/ifc/container/XContainer/script.xlb new file mode 100644 index 000000000000..91f039fed92a --- /dev/null +++ b/qadevOOo/tests/basic/ifc/container/XContainer/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="container_XContainer" library:readonly="false" library:passwordprotected="false"> +"<library:element library:name="container_XContainer"/> +"</library:library> diff --git a/qadevOOo/tests/basic/ifc/container/XContentEnumerationAccess/container_XContentEnumerationAccess.xba b/qadevOOo/tests/basic/ifc/container/XContentEnumerationAccess/container_XContentEnumerationAccess.xba new file mode 100644 index 000000000000..6783c7e4f61f --- /dev/null +++ b/qadevOOo/tests/basic/ifc/container/XContentEnumerationAccess/container_XContentEnumerationAccess.xba @@ -0,0 +1,69 @@ +<?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="container_XContentEnumerationAccess" script:language="StarBasic"> + + +'************************************************************************* +' +' 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: container_XContentEnumerationAccess.xba,v $ +' +' $Revision: 1.3 $ +' +' 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. +' +'************************************************************************* +'************************************************************************* + + + + + +Sub RunTest() + +'************************************************************************* +' INTERFACE: +' com.sun.star.container.XContentEnumerationAccess +'************************************************************************* +On Error Goto ErrHndl + Dim bOK As Boolean + + Test.StartMethod("getAvailableServiceNames()") + bOK = true + aNames = oObj.getAvailableServiceNames() + bOK = bOK AND NOT isNULL(aNames) + Test.MethodTested("getAvailableServiceNames()", bOK) + + Test.StartMethod("createContentEnumeration()") + bOK = true + oEnum = oObj.createContentEnumeration(aNames(0)) + bOK = bOK AND hasUnoInterfaces(oEnum, "com.sun.star.container.XEnumeration") + Test.MethodTested("createContentEnumeration()", bOK) + +Exit Sub +ErrHndl: + Test.Exception() + bOK = false + resume next +End Sub +</script:module> diff --git a/qadevOOo/tests/basic/ifc/container/XContentEnumerationAccess/script.xlb b/qadevOOo/tests/basic/ifc/container/XContentEnumerationAccess/script.xlb new file mode 100644 index 000000000000..05077a300f27 --- /dev/null +++ b/qadevOOo/tests/basic/ifc/container/XContentEnumerationAccess/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="container_XContentEnumerationAccess" library:readonly="false" library:passwordprotected="false"> +"<library:element library:name="container_XContentEnumerationAccess"/> +"</library:library> diff --git a/qadevOOo/tests/basic/ifc/container/XElementAccess/container_XElementAccess.xba b/qadevOOo/tests/basic/ifc/container/XElementAccess/container_XElementAccess.xba new file mode 100644 index 000000000000..1e77c75140d6 --- /dev/null +++ b/qadevOOo/tests/basic/ifc/container/XElementAccess/container_XElementAccess.xba @@ -0,0 +1,71 @@ +<?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="container_XElementAccess" script:language="StarBasic"> + + +'************************************************************************* +' +' 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: container_XElementAccess.xba,v $ +' +' $Revision: 1.3 $ +' +' 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 RunTest() + +'************************************************************************* +' INTERFACE: +' com.sun.star.container.XElementAccess +'************************************************************************* +On Error Goto ErrHndl + Dim bOK As Boolean + Dim oType As Object + + Test.StartMethod("hasElements()") + bOK = oObj.hasElements() + Test.MethodTested("hasElements()", bOK) + + Test.StartMethod("getElementType()") + bOK = true + oType = oObj.getElementType() + Out.Log("Element type is " & oType.Name) + Test.MethodTested("getElementType()", bOK) + +Exit Sub +ErrHndl: + Test.Exception() + bOK = false + resume next +End Sub +</script:module> diff --git a/qadevOOo/tests/basic/ifc/container/XElementAccess/script.xlb b/qadevOOo/tests/basic/ifc/container/XElementAccess/script.xlb new file mode 100644 index 000000000000..3460dde77388 --- /dev/null +++ b/qadevOOo/tests/basic/ifc/container/XElementAccess/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="container_XElementAccess" library:readonly="false" library:passwordprotected="false"> +"<library:element library:name="container_XElementAccess"/> +"</library:library> diff --git a/qadevOOo/tests/basic/ifc/container/XEnumeration/container_XEnumeration.xba b/qadevOOo/tests/basic/ifc/container/XEnumeration/container_XEnumeration.xba new file mode 100644 index 000000000000..cef00366df17 --- /dev/null +++ b/qadevOOo/tests/basic/ifc/container/XEnumeration/container_XEnumeration.xba @@ -0,0 +1,68 @@ +<?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="container_XEnumeration" script:language="StarBasic"> + + +'************************************************************************* +' +' 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: container_XEnumeration.xba,v $ +' +' $Revision: 1.3 $ +' +' 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 RunTest() + +'************************************************************************* +' INTERFACE: +' com.sun.star.container.XEnumeration +'************************************************************************* +On Error goto ErrHndl + Dim bOK As Boolean + + Test.StartMethod("hasMoreElements()") + bOK = oObj.hasMoreElements() + Test.MethodTested("hasMoreElements()", bOK) + + Test.StartMethod("nextElement()") + bOK = NOT isNULL (oObj.nextElement()) + Test.MethodTested("nextElement()", bOK) + +Exit Sub +ErrHndl: + Test.Exception() + bOK = false + resume next +End Sub +</script:module> diff --git a/qadevOOo/tests/basic/ifc/container/XEnumeration/script.xlb b/qadevOOo/tests/basic/ifc/container/XEnumeration/script.xlb new file mode 100644 index 000000000000..bca9e4edf129 --- /dev/null +++ b/qadevOOo/tests/basic/ifc/container/XEnumeration/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="container_XEnumeration" library:readonly="false" library:passwordprotected="false"> +"<library:element library:name="container_XEnumeration"/> +"</library:library> diff --git a/qadevOOo/tests/basic/ifc/container/XEnumerationAccess/container_XEnumerationAccess.xba b/qadevOOo/tests/basic/ifc/container/XEnumerationAccess/container_XEnumerationAccess.xba new file mode 100644 index 000000000000..353c3a13aec0 --- /dev/null +++ b/qadevOOo/tests/basic/ifc/container/XEnumerationAccess/container_XEnumerationAccess.xba @@ -0,0 +1,68 @@ +<?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="container_XEnumerationAccess" script:language="StarBasic"> + + +'************************************************************************* +' +' 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: container_XEnumerationAccess.xba,v $ +' +' $Revision: 1.3 $ +' +' 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 RunTest() + +'************************************************************************* +' INTERFACE: +' com.sun.star.container.XEnumerationAccess +'************************************************************************* +On Error Goto ErrHndl + Dim oEnum As Object + Dim bOK As Boolean + + Test.StartMethod("createEnumeration()") + bOK = true + oEnum = oObj.createEnumeration() + bOK = bOK AND (NOT isNull(oEnum)) + bOK = bOK AND hasUnoInterfaces(oEnum, "com.sun.star.container.XEnumeration") + Test.MethodTested("createEnumeration()", bOK) + +Exit Sub +ErrHndl: + Test.Exception() + bOK = false + resume next +End Sub +</script:module> diff --git a/qadevOOo/tests/basic/ifc/container/XEnumerationAccess/script.xlb b/qadevOOo/tests/basic/ifc/container/XEnumerationAccess/script.xlb new file mode 100644 index 000000000000..5c72301ebb22 --- /dev/null +++ b/qadevOOo/tests/basic/ifc/container/XEnumerationAccess/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="container_XEnumerationAccess" library:readonly="false" library:passwordprotected="false"> +"<library:element library:name="container_XEnumerationAccess"/> +"</library:library> diff --git a/qadevOOo/tests/basic/ifc/container/XHierarchicalName/container_XHierarchicalName.xba b/qadevOOo/tests/basic/ifc/container/XHierarchicalName/container_XHierarchicalName.xba new file mode 100644 index 000000000000..119d7183acd9 --- /dev/null +++ b/qadevOOo/tests/basic/ifc/container/XHierarchicalName/container_XHierarchicalName.xba @@ -0,0 +1,101 @@ +<?xml version="1.0" encoding="UTF-8"?> +<script:module xmlns:script="http://openoffice.org/2000/script" script:name="container_XHierarchicalName" script:language="StarBasic"> + +'************************************************************************* +' +' 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: container_XHierarchicalName.xba,v $ +' +' $Revision: 1.4 $ +' +' 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. +' +'************************************************************************* +'************************************************************************* + +' This Interface/Service test depends on the followingobject relations +' variables, which must be specified in the object creation: + +' ObjectRelation: oObjRelation(0).Name = "ElementName" +' ObjectRelation: oObjRelation(0).Value = "MyAccessibleElementName" +' ObjectRelation: oObjRelation(1).Name = "HierarchicalName" +' ObjectRelation: oObjRelation(1).Value = "MyHierachicalName" + +'************************************************************************* + +' Be sure that all variables are dimensioned: +option explicit + +Sub RunTest() + +'************************************************************************* +' INTERFACE: +' com.sun.star.container.XHierarchicalName +'************************************************************************* +On Error Goto ErrHndl + Dim bOK As Boolean + + Dim cElemName as Variant + cElemName = utils.getObjectRelation("ElementName") + if isNull(cElemName) then + out.log("Could not get relation 'ElenemtName' -> FALSE") + end if + + Dim cExpName as Variant + cExpName = utils.getObjectRelation("HierarchicalName") + if isNull(cExpName) then + out.log("Could not get relation 'HierarchicalName' -> FALSE") + end if + + Test.StartMethod("getHierarchicalName()") + bOK = TRUE + Dim cHName as String + cHName = oObj.getHierarchicalName() + Dim result as String + result = instr(cHName, cExpName) + if len(result) = 0 then + olt.log("Getting: " + cHName + " but expected it to start with " + _ + cExpName) + bOK = FALSE + end if + Test.MethodTested("getHierarchicalName()", bOK) + + Test.StartMethod("composeHierarchicalName()") + bOK = TRUE + Dim gettedName as String + gettedName = oObj.composeHierarchicalName(cElemName) + result = instr(gettedName, cElemName) + if len(result) = 0 then + olt.log("Getting: " + gettedName + " but expected it to start with " + _ + cElemetName) + bOK = FALSE + end if + Test.MethodTested("composeHierarchicalName()", bOK) + +Exit Sub +ErrHndl: + Test.Exception() + bOK = false + resume next +End Sub +</script:module> diff --git a/qadevOOo/tests/basic/ifc/container/XHierarchicalName/script.xlb b/qadevOOo/tests/basic/ifc/container/XHierarchicalName/script.xlb new file mode 100644 index 000000000000..e9f49c898c1c --- /dev/null +++ b/qadevOOo/tests/basic/ifc/container/XHierarchicalName/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="container_XHierarchicalName" library:readonly="false" library:passwordprotected="false"> + <library:element library:name="container_XHierarchicalName"/> + </library:library> diff --git a/qadevOOo/tests/basic/ifc/container/XHierarchicalNameAccess/container_XHierarchicalNameAccess.xba b/qadevOOo/tests/basic/ifc/container/XHierarchicalNameAccess/container_XHierarchicalNameAccess.xba new file mode 100644 index 000000000000..b160b82d2682 --- /dev/null +++ b/qadevOOo/tests/basic/ifc/container/XHierarchicalNameAccess/container_XHierarchicalNameAccess.xba @@ -0,0 +1,83 @@ +<?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="container_XHierarchicalNameAccess" script:language="StarBasic"> + + +'************************************************************************* +' +' 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: container_XHierarchicalNameAccess.xba,v $ +' +' $Revision: 1.4 $ +' +' 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. +' +'************************************************************************* +'************************************************************************* + +' This Interface/Service test depends on the following object relations +' variables, which must be specified in the object creation: + +' ObjectRelation: oObjRelation(0).Name = "ElementName" +' ObjectRelation: oObjRelation(0).Value = "MyAccessibleElementName" + +Sub RunTest() + +'************************************************************************* +' INTERFACE: +' com.sun.star.container.XHierarchicalNameAccess +'************************************************************************* +On Error Goto ErrHndl + Dim bOK As Boolean + + Dim cObjRelation as Variant + cObjRelation = utils.getObjectRelation("ElementName") + if isNull(cObjRelation) then + cObjRelation = cIfcLongName + end if + + Test.StartMethod("getByHierarchicalName()") + bOK = true + Dim oRet as Variant + oRet = oObj.getByHierarchicalName(cObjRelation) + if TypeName(oRet) = "String" then + out.log("oRet = " + oRet) + bOK = bOK and (oRet = cObjRelation) + else + bOK = bOK AND oRet.Name = cObjRelation + end if + Test.MethodTested("getByHierarchicalName()", bOK) + + Test.StartMethod("hasByHierarchicalName()") + bOK = true + bOK = bOK AND oObj.hasByHierarchicalName(cObjRelation) + bOK = bOK AND NOT oObj.hasByHierarchicalName(cObjRelation + "ThisIsAnInvalidName") + Test.MethodTested("hasByHierarchicalName()", bOK) + +Exit Sub +ErrHndl: + Test.Exception() + bOK = false + resume next +End Sub +</script:module> diff --git a/qadevOOo/tests/basic/ifc/container/XHierarchicalNameAccess/script.xlb b/qadevOOo/tests/basic/ifc/container/XHierarchicalNameAccess/script.xlb new file mode 100644 index 000000000000..26b107612f8b --- /dev/null +++ b/qadevOOo/tests/basic/ifc/container/XHierarchicalNameAccess/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="container_XHierarchicalNameAccess" library:readonly="false" library:passwordprotected="false"> +"<library:element library:name="container_XHierarchicalNameAccess"/> +"</library:library> diff --git a/qadevOOo/tests/basic/ifc/container/XIndexAccess/container_XIndexAccess.xba b/qadevOOo/tests/basic/ifc/container/XIndexAccess/container_XIndexAccess.xba new file mode 100644 index 000000000000..91d75aa9e12c --- /dev/null +++ b/qadevOOo/tests/basic/ifc/container/XIndexAccess/container_XIndexAccess.xba @@ -0,0 +1,77 @@ +<?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="container_XIndexAccess" script:language="StarBasic"> + + +'************************************************************************* +' +' 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: container_XIndexAccess.xba,v $ +' +' $Revision: 1.3 $ +' +' 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 RunTest() + +'************************************************************************* +' INTERFACE: +' com.sun.star.container.XIndexAccess +'************************************************************************* +On Error Goto ErrHndl + Dim nCount As Integer + Dim bOK As Boolean + + Test.StartMethod("getCount()") + bOK = true + nCount = oObj.Count + bOK = bOK AND nCount + Test.MethodTested("getCount()", bOK) + + Test.StartMethod("getByIndex()") + bOK = true + if (nCount) then + bOK = bOK AND NOT isNull(oObj.getByIndex(nCount - 1)) + Test.MethodTested("getByIndex()", bOK) + else + Out.Log("No elements") + end if + + +Exit Sub +ErrHndl: + Test.Exception() + bOK = false + resume next +End Sub +</script:module> diff --git a/qadevOOo/tests/basic/ifc/container/XIndexAccess/script.xlb b/qadevOOo/tests/basic/ifc/container/XIndexAccess/script.xlb new file mode 100644 index 000000000000..a27bd13b282e --- /dev/null +++ b/qadevOOo/tests/basic/ifc/container/XIndexAccess/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="container_XIndexAccess" library:readonly="false" library:passwordprotected="false"> +"<library:element library:name="container_XIndexAccess"/> +"</library:library> diff --git a/qadevOOo/tests/basic/ifc/container/XIndexContainer/container_XIndexContainer.xba b/qadevOOo/tests/basic/ifc/container/XIndexContainer/container_XIndexContainer.xba new file mode 100644 index 000000000000..d6b4d8398a96 --- /dev/null +++ b/qadevOOo/tests/basic/ifc/container/XIndexContainer/container_XIndexContainer.xba @@ -0,0 +1,86 @@ +<?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="container_XIndexContainer" script:language="StarBasic"> + + +'************************************************************************* +' +' 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: container_XIndexContainer.xba,v $ +' +' $Revision: 1.3 $ +' +' 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 + +'************************************************************************* +' This Interface/Service test depends on the following GLOBAL variables, +' which must be specified in the object creation: + +' Global oInstance As Object for InsertByName + +'************************************************************************* + + + + + + +Sub RunTest() + +'************************************************************************* +' INTERFACE: +' com.sun.star.container.XIndexContainer +'************************************************************************* +On Error Goto ErrHndl + + Dim bOK As Boolean + Dim nCount As Integer + + nCount = oObj.count + + Test.StartMethod("insertByIndex()") + bOK = true + oObj.insertByIndex(nCount, oInstance) + bOK = bOK AND (oObj.count > nCount) + Test.MethodTested("insertByIndex()", bOK) + + Test.StartMethod("removeByIndex()") + bOK = true + oObj.removeByIndex(nCount) + bOK = bOK AND (oObj.Count = nCount) + Test.MethodTested("removeByIndex()", bOK) +Exit Sub +ErrHndl: + Test.Exception() + bOK = false + resume next +End Sub +</script:module> diff --git a/qadevOOo/tests/basic/ifc/container/XIndexContainer/script.xlb b/qadevOOo/tests/basic/ifc/container/XIndexContainer/script.xlb new file mode 100644 index 000000000000..085014bd065a --- /dev/null +++ b/qadevOOo/tests/basic/ifc/container/XIndexContainer/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="container_XIndexContainer" library:readonly="false" library:passwordprotected="false"> +"<library:element library:name="container_XIndexContainer"/> +"</library:library> diff --git a/qadevOOo/tests/basic/ifc/container/XIndexReplace/container_XIndexReplace.xba b/qadevOOo/tests/basic/ifc/container/XIndexReplace/container_XIndexReplace.xba new file mode 100644 index 000000000000..3d760ba2f985 --- /dev/null +++ b/qadevOOo/tests/basic/ifc/container/XIndexReplace/container_XIndexReplace.xba @@ -0,0 +1,88 @@ +<?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="container_XIndexReplace" script:language="StarBasic"> + + +'************************************************************************* +' +' 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: container_XIndexReplace.xba,v $ +' +' $Revision: 1.4 $ +' +' 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 + +'************************************************************************* +' This Interface/Service test depends on the following GLOBAL variables, +' which must be specified in the object creation: + +' the Test-Object must contain two diffrent named Objects +' Global oIdxReplaceInstance as Object + +'************************************************************************* + + +Sub RunTest() + +'************************************************************************* +' INTERFACE: +' com.sun.star.container.XIndexReplace +'************************************************************************* +On Error Goto ErrHndl + + Dim bOK As Boolean + Dim nCount As Integer + Dim oOld As Object + Dim oNew As Object + + Test.StartMethod("replaceByIndex()") + bOK = true + + nCount = oObj.count + Out.Log("There are " & nCount & " objects") + oOld = oObj.getByIndex(nCount - 1) + + oObj.replaceByIndex(nCount - 1, oIdxReplaceInstance) + oNew = oObj.getByIndex(nCount - 1) + bOK = bOK AND (oOld.Name <> oNew.Name) + + Test.MethodTested("replaceByIndex()", bOK) + + Out.Log("replace old Object.") + oObj.replaceByIndex(nCount - 1, oOld) + +Exit Sub +ErrHndl: + Test.Exception() + bOK = false + resume next +End Sub +</script:module> diff --git a/qadevOOo/tests/basic/ifc/container/XIndexReplace/script.xlb b/qadevOOo/tests/basic/ifc/container/XIndexReplace/script.xlb new file mode 100644 index 000000000000..568e937677d5 --- /dev/null +++ b/qadevOOo/tests/basic/ifc/container/XIndexReplace/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="container_XIndexReplace" library:readonly="false" library:passwordprotected="false"> +"<library:element library:name="container_XIndexReplace"/> +"</library:library> diff --git a/qadevOOo/tests/basic/ifc/container/XNameAccess/container_XNameAccess.xba b/qadevOOo/tests/basic/ifc/container/XNameAccess/container_XNameAccess.xba new file mode 100644 index 000000000000..bc02cebf5066 --- /dev/null +++ b/qadevOOo/tests/basic/ifc/container/XNameAccess/container_XNameAccess.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="container_XNameAccess" script:language="StarBasic"> + + +'************************************************************************* +' +' 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: container_XNameAccess.xba,v $ +' +' $Revision: 1.4 $ +' +' 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 RunTest() + +'************************************************************************* +' INTERFACE: +' com.sun.star.container.XNameAccess +'************************************************************************* +On Error Goto ErrHndl + Dim aElementNames() As Variant + Dim bOK As Boolean + Dim oElem As Variant + Dim cName As String + + Test.StartMethod("getElementNames()") + bOK = true + aElementnames() = oObj.getElementNames() + if hasUnoInterfaces(oObj, "com.sun.star.container.XIndexAccess") then + bOK = bOK AND (uBound(aElementnames()) = oObj.count - 1) + else + bOK = bOK AND (uBound(aElementnames()) > -1) + end if + Test.MethodTested("getElementNames()", bOK) + + Test.StartMethod("getByName()") + bOK = true + oElem = oObj.getByName(aElementNames(0)) + bOK = bOK AND NOT isNull(oElem) + Test.MethodTested("getByName()", bOK) + + Test.StartMethod("hasByName()") + bOK = true + cName = aElementNames(uBound(aElementNames())) + bOK = bOK AND oObj.hasByName(cName) + Test.MethodTested("hasByName()", bOK) + +Exit Sub +ErrHndl: + Test.Exception() + bOK = false + resume next +End Sub +</script:module> diff --git a/qadevOOo/tests/basic/ifc/container/XNameAccess/script.xlb b/qadevOOo/tests/basic/ifc/container/XNameAccess/script.xlb new file mode 100644 index 000000000000..df0fdb783771 --- /dev/null +++ b/qadevOOo/tests/basic/ifc/container/XNameAccess/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="container_XNameAccess" library:readonly="false" library:passwordprotected="false"> +"<library:element library:name="container_XNameAccess"/> +"</library:library> diff --git a/qadevOOo/tests/basic/ifc/container/XNameContainer/container_XNameContainer.xba b/qadevOOo/tests/basic/ifc/container/XNameContainer/container_XNameContainer.xba new file mode 100644 index 000000000000..269cdae98cbd --- /dev/null +++ b/qadevOOo/tests/basic/ifc/container/XNameContainer/container_XNameContainer.xba @@ -0,0 +1,83 @@ +<?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="container_XNameContainer" script:language="StarBasic"> + + +'************************************************************************* +' +' 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: container_XNameContainer.xba,v $ +' +' $Revision: 1.3 $ +' +' 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 + +'************************************************************************* +' This Interface/Service test depends on the following GLOBAL variables, +' which must be specified in the object creation: + +' Global oInstance As Object instance to insert + +'************************************************************************* + + + + + + +Sub RunTest() + +'************************************************************************* +' INTERFACE: +' com.sun.star.container.XNameContainer +'************************************************************************* +On Error Goto ErrHndl + + Dim bOK As Boolean + + Test.StartMethod("insertByName()") + bOK = true + oObj.insertByName(cIfcShortName, oInstance) + bOK = bOK AND oObj.hasByName(cIfcShortName) + Test.MethodTested("insertByName()", bOK) + + Test.StartMethod("removeByName()") + bOK = true + oObj.removeByName(cIfcShortName) + bOK = bOK AND NOT oObj.hasByName(cIfcShortName) + Test.MethodTested("removeByName()", bOK) +Exit Sub +ErrHndl: + Test.Exception() + bOK = false + resume next +End Sub +</script:module> diff --git a/qadevOOo/tests/basic/ifc/container/XNameContainer/script.xlb b/qadevOOo/tests/basic/ifc/container/XNameContainer/script.xlb new file mode 100644 index 000000000000..69c98b8f0573 --- /dev/null +++ b/qadevOOo/tests/basic/ifc/container/XNameContainer/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="container_XNameContainer" library:readonly="false" library:passwordprotected="false"> +"<library:element library:name="container_XNameContainer"/> +"</library:library> diff --git a/qadevOOo/tests/basic/ifc/container/XNameReplace/container_XNameReplace.xba b/qadevOOo/tests/basic/ifc/container/XNameReplace/container_XNameReplace.xba new file mode 100644 index 000000000000..dff9feba2230 --- /dev/null +++ b/qadevOOo/tests/basic/ifc/container/XNameReplace/container_XNameReplace.xba @@ -0,0 +1,120 @@ +<?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="container_XNameReplace" script:language="StarBasic"> + + +'************************************************************************* +' +' 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: container_XNameReplace.xba,v $ +' +' $Revision: 1.4 $ +' +' 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 + +'************************************************************************* +' This Interface/Service test depends on the following GLOBAL variables, +' which must be specified in the object creation: + +' Global cNameToReplace As String 'name of instance to be replased +' Global oReplaceInstance As Variant 'instance, that will be inserted +' instead old one + +'************************************************************************* + +Sub RunTest() + +'************************************************************************* +' INTERFACE: +' com.sun.star.container.XNameReplace +'************************************************************************* +On Error Goto ErrHndl + Dim bOK As Boolean + Dim oOldObject As Object + Dim cOldObjName As String + Dim oNewControl As Object + Dim cNewObjName As String + Dim NewAddress As Object + Dim InstAddress As Object + Dim cReplInstName As String + + Test.StartMethod("replaceByName()") + bOK = true + + if (cObjectName = "sc.ScCellRangesObj") then + oOldObject = oObj.getByName(cNameToReplace) + InstAddress = oReplaceInstance.getRangeAddress + + oObj.replaceByName(cNameToReplace, oReplaceInstance) + + oNewControl = oObj.getByName(cNameToReplace) + NewAddress = oNewControl.getRangeAddress + + bOK = bOK AND NewAddress.Sheet = InstAddress.Sheet + bOK = bOK AND NewAddress.StartColumn = InstAddress.StartColumn + bOK = bOK AND NewAddress.EndColumn = InstAddress.EndColumn + bOK = bOK AND NewAddress.StartRow = InstAddress.StartRow + bOK = bOK AND NewAddress.EndRow = InstAddress.EndRow + + elseif typename(oReplaceInstance) = "String" then + Dim oNewObj as Variant + Dim oOldObj as Variant + oOldObj = oObj.getByName(cNameToReplace) + oObj.replaceByName(cNameToReplace, oReplaceInstance) + oNewObj = oObj.getByName(cNameToReplace) + bOK = bOK and not PropertyTester.equals(oOldObj, oNewObj) + else + oOldObject = oObj.getByName(cNameToReplace) + cReplInstName = oReplaceInstance.Name + Out.Log("ReplaceInstance.name = '" & cReplInstName & "'") + cOldObjName = oOldObject.Name + Out.Log("OldObject.name = '" & cOldObjName & "'") + + oObj.replaceByName(cNameToReplace, oReplaceInstance) + oNewControl = oObj.getByName(cNameToReplace) + + cReplInstName = oReplaceInstance.Name + Out.Log("ReplaceInstance.name = '" & cReplInstName & "'") + cNewObjName = oNewControl.Name + Out.Log("NewObject.name = '" & cNewObjName & "'") + + bOK = bOK AND (oReplaceInstance.Name = cNameToReplace) + end if + + Test.MethodTested("replaceByName()", bOK) + +Exit Sub +ErrHndl: + Test.Exception() + bOK = false + resume next +End Sub +</script:module> diff --git a/qadevOOo/tests/basic/ifc/container/XNameReplace/script.xlb b/qadevOOo/tests/basic/ifc/container/XNameReplace/script.xlb new file mode 100644 index 000000000000..268ac95bb0f9 --- /dev/null +++ b/qadevOOo/tests/basic/ifc/container/XNameReplace/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="container_XNameReplace" library:readonly="false" library:passwordprotected="false"> +"<library:element library:name="container_XNameReplace"/> +"</library:library> diff --git a/qadevOOo/tests/basic/ifc/container/XNamed/container_XNamed.xba b/qadevOOo/tests/basic/ifc/container/XNamed/container_XNamed.xba new file mode 100644 index 000000000000..231ffbc8a80e --- /dev/null +++ b/qadevOOo/tests/basic/ifc/container/XNamed/container_XNamed.xba @@ -0,0 +1,115 @@ +<?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="container_XNamed" script:language="StarBasic"> + + +'************************************************************************* +' +' 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: container_XNamed.xba,v $ +' +' $Revision: 1.3 $ +' +' 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 + +'************************************************************************* +' This Interface/Service test depends on the following GLOBAL variables, +' which must be specified in the object creation: + +' Global cNameToSet As String "fixed" if name is fixed + +'************************************************************************* + + + + + +Sub RunTest() + +'************************************************************************* +' INTERFACE: +' com.sun.star.container.XNamed +'************************************************************************* +On Error Goto ErrHndl + Dim bOK As Boolean + Dim cName As String, cNewName As String + + if VarType(cNameToSet) = 8 then + if cNameToSet = "" then + cNewName = cIfcShortName + else + cNewName = cNameToSet + endif + else + cNewName = cIfcShortName + endif + + Test.StartMethod("getName()") + bOK = true + cName = oObj.getName() + Out.Log("Name is '" + cName + "'") + bOK = bOK AND NOT isNULL(cName) + bOK = bOK AND (VarType(oObj.Name) = 8 ) + Test.MethodTested("getName()", bOK) + + Test.StartMethod("setName()") + bOK = true + Out.Log("nameToSet is '" + cNewName + "'") + + if (cNewName = "fixed") then + Out.Log("Object " + cObjectName + " has fixed name.") + on error goto ex1: + Out.Log("Trying to change fixed name") + oObj.setName(cNewName) + Out.Log("After setting name, oObj.Name is '" + oObj.Name + "'") + bOK = bOK AND oObj.Name <> cNameToSet + if (NOT bOK) then Out.Log("Fixed name was changed! - FAILED") + goto cont1: + ex1: + Out.Log("Expected exception - OK") + resume next + cont1: + else + oObj.setName(cNewName) + Out.Log("After setting name, oObj.Name is '" + oObj.Name + "'") + bOK = bOK AND (cName <> oObj.Name) + oObj.Name = cName + bOK = bOK AND (cName = oObj.Name) + end if + Test.MethodTested("setName()", bOK) + +Exit Sub +ErrHndl: + Test.Exception() + bOK = false + resume next +End Sub +</script:module> diff --git a/qadevOOo/tests/basic/ifc/container/XNamed/script.xlb b/qadevOOo/tests/basic/ifc/container/XNamed/script.xlb new file mode 100644 index 000000000000..6feab3be05c3 --- /dev/null +++ b/qadevOOo/tests/basic/ifc/container/XNamed/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="container_XNamed" library:readonly="false" library:passwordprotected="false"> +"<library:element library:name="container_XNamed"/> +"</library:library> diff --git a/qadevOOo/tests/basic/ifc/container/XSet/container_XSet.xba b/qadevOOo/tests/basic/ifc/container/XSet/container_XSet.xba new file mode 100644 index 000000000000..82a18dd6359c --- /dev/null +++ b/qadevOOo/tests/basic/ifc/container/XSet/container_XSet.xba @@ -0,0 +1,82 @@ +<?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="container_XSet" script:language="StarBasic"> + + +'************************************************************************* +' +' 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: container_XSet.xba,v $ +' +' $Revision: 1.3 $ +' +' 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. +' +'************************************************************************* +'************************************************************************* + + + + + +Sub RunTest() + +'************************************************************************* +' INTERFACE: +' com.sun.star.container.XSet +'************************************************************************* +On Error Goto ErrHndl + Dim bOK As Boolean + + Out.Log("Creating enumeration... ") + oEnum = oObj.createEnumeration() + if oEnum.hasMoreElements then + oElem = oEnum.nextElement + end if + bOK = bOK AND NOT inNULL(oElem) + Out.Log("Enumeration creationg - " & bOK) + + Test.StartMethod("has()") + bOK = true + bOK = bOK AND oObj.has(oElem) + Test.MethodTested("has()", bOK) + + Test.StartMethod("remove()") + bOK = true + oObj.remove(oElem) + bOK = bOK AND NOT oObj.has(oElem) + Test.MethodTested("remove()", bOK) + + Test.StartMethod("insert()") + bOK = true + oObj.insert(oElem) + bOK = bOK AND oObj.has(oElem) + Test.MethodTested("insert()", bOK) + +Exit Sub +ErrHndl: + Test.Exception() + bOK = false + resume next +End Sub +</script:module> diff --git a/qadevOOo/tests/basic/ifc/container/XSet/script.xlb b/qadevOOo/tests/basic/ifc/container/XSet/script.xlb new file mode 100644 index 000000000000..2ccfbb891f4e --- /dev/null +++ b/qadevOOo/tests/basic/ifc/container/XSet/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="container_XSet" library:readonly="false" library:passwordprotected="false"> +"<library:element library:name="container_XSet"/> +"</library:library> |