summaryrefslogtreecommitdiffstats
path: root/qadevOOo/tests/basic/ifc/container/XContainer/container_XContainer.xba
diff options
context:
space:
mode:
Diffstat (limited to 'qadevOOo/tests/basic/ifc/container/XContainer/container_XContainer.xba')
-rw-r--r--qadevOOo/tests/basic/ifc/container/XContainer/container_XContainer.xba228
1 files changed, 0 insertions, 228 deletions
diff --git a/qadevOOo/tests/basic/ifc/container/XContainer/container_XContainer.xba b/qadevOOo/tests/basic/ifc/container/XContainer/container_XContainer.xba
deleted file mode 100644
index 2dd3e397d408..000000000000
--- a/qadevOOo/tests/basic/ifc/container/XContainer/container_XContainer.xba
+++ /dev/null
@@ -1,228 +0,0 @@
-<?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 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.
-'
-'*************************************************************************
-'*************************************************************************
-
-
-
-'*************************************************************************
-' 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>