diff options
Diffstat (limited to 'qadevOOo/tests/basic/ifc/io')
24 files changed, 1604 insertions, 0 deletions
diff --git a/qadevOOo/tests/basic/ifc/io/XActiveDataControl/io_XActiveDataControl.xba b/qadevOOo/tests/basic/ifc/io/XActiveDataControl/io_XActiveDataControl.xba new file mode 100644 index 000000000000..b62d12cabbf0 --- /dev/null +++ b/qadevOOo/tests/basic/ifc/io/XActiveDataControl/io_XActiveDataControl.xba @@ -0,0 +1,204 @@ +<?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="io_XActiveDataControl" 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 oPipe As Object +' - Global PumpOUTFileName As String + +'************************************************************************* + + + + +Dim oListener1 As Object +Dim oListener2 As Object +Dim CB1Started As Integer +Dim CB1Closed As Integer +Dim CB1Terminated As Integer +Dim CB1Error As Integer +Dim CB2Started As Integer +Dim CB2Closed As Integer +Dim CB2Terminated As Integer +Dim CB2Error As Integer + + +Sub RunTest() + +'************************************************************************* +' INTERFACE: +' com.sun.star.io.XActiveDataControl +'************************************************************************* +On Error Goto ErrHndl + Dim bOK As Boolean + Dim iSize As Integer + + oFileAcc = createUnoService("com.sun.star.ucb.SimpleFileAccess") + + Dim aBytes(10) As Integer + for i = 0 to ubound(aBytes()) + aBytes(i) = i * 3 + next i + + Test.StartMethod("start()") + Test.StartMethod("terminate()") + bOK = true + + Out.Log("Writing some bytes to Pipe") + + oPipe.writeBytes(aBytes()) + + Out.Log("The pump was not started yet. So, PumpOUT should be of zero size") + Out.Log("Terminating a pipe to have an opportunity to get a file size") + oObj.terminate() + + iSize = oFileAcc.getSize(PumpOUTFileName) + Out.Log("Size of file is " & iSize) + bOK = bOK AND iSize = 0 + DisposeObj() + CreateObj() + + Out.Log("Writing bytes again (because object was destroyed)") + oPipe.writeBytes(aBytes()) + Out.Log("... and starting pump") + oObj.start() + wait(100) + Out.Log("Now PumpOUT should have size " & ubound(aBytes()) + 1) + Out.Log("Terminating a pipe to have an opportunity to get a file size") + oObj.terminate() + iSize = oFileAcc.getSize(PumpOUTFileName) + Out.Log("Size of file is " & iSize) + bOK = bOK AND iSize = ubound(aBytes()) + 1 + + Test.MethodTested("start()", bOK) + Test.MethodTested("terminate()", bOK) + + DisposeObj() + CreateObj() + ResetCounters() + + oListener1 = createUnoListener("CB1_", "com.sun.star.io.XStreamListener") + oListener2 = createUnoListener("CB2_", "com.sun.star.io.XStreamListener") + + Test.StartMethod("addListener()") + bOK = true + Out.Log("adding two listeners") + oObj.addListener(oListener1) + oObj.addListener(oListener2) + oPipe.writeBytes(aBytes()) + oObj.start() + wait(100) ' for listeners to change counters + bOK = CB1Started = 1 AND CB2Started = 1 + Test.MethodTested("addListener()", bOK) + + DisposeObj() + CreateObj() + ResetCounters() + + Test.StartMethod("removeListener()") + bOK = true + Out.Log("adding two listeners") + oObj.addListener(oListener1) + oObj.addListener(oListener2) + Out.Log("Removing first listener...") + oObj.removeListener(oListener1) + oPipe.writeBytes(aBytes()) + oObj.start() + wait(100) + bOK = CB1Started = 0 AND CB2Started = 1 + Test.MethodTested("removeListener()", bOK) + DisposeObj() + CreateObj() + +Exit Sub +ErrHndl: + Test.Exception() + bOK = false + resume next +End Sub + +Sub ResetCounters() + CB1Started = 0 + CB1Closed = 0 + CB1Terminated = 0 + CB1Error = 0 + CB2Started = 0 + CB2Closed = 0 + CB2Terminated = 0 + CB2Error = 0 +End Sub + +Sub CB1_Started() + Out.Log("CB1_Started called") + CB1Started = CB1Started + 1 +End Sub + +Sub CB2_Started() + Out.Log("CB2_Started called") + CB2Started = CB2Started + 1 +End Sub + +Sub CB1_Closed() + Out.Log("CB1_Closed called") + CB1Closed = CB1Closed + 1 +End Sub + +Sub CB2_Closed() + Out.Log("CB2_Closed called") + CB2Closed = CB2Closed + 1 +End Sub + +Sub CB1_Terminated() + Out.Log("CB1_Terminated called") + CB1Terminated = CB1Terminated + 1 +End Sub + +Sub CB2_Terminated() + Out.Log("CB2_Terminated called") + CB2Terminated = CB2Terminated + 1 +End Sub + +Sub CB1_Error(aError As Object) + Out.Log("CB1_Error called") + CB1Error = CB1Error + 1 +End Sub + +Sub CB2_Error(aError As Object) + Out.Log("CB2_Error called") + CB2Error = CB2Error + 1 +End Sub +</script:module> diff --git a/qadevOOo/tests/basic/ifc/io/XActiveDataControl/script.xlb b/qadevOOo/tests/basic/ifc/io/XActiveDataControl/script.xlb new file mode 100644 index 000000000000..8492bc4365c6 --- /dev/null +++ b/qadevOOo/tests/basic/ifc/io/XActiveDataControl/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="io_XActiveDataControl" library:readonly="false" library:passwordprotected="false"> +"<library:element library:name="io_XActiveDataControl"/> +"</library:library> diff --git a/qadevOOo/tests/basic/ifc/io/XActiveDataSink/io_XActiveDataSink.xba b/qadevOOo/tests/basic/ifc/io/XActiveDataSink/io_XActiveDataSink.xba new file mode 100644 index 000000000000..d28d501553cd --- /dev/null +++ b/qadevOOo/tests/basic/ifc/io/XActiveDataSink/io_XActiveDataSink.xba @@ -0,0 +1,112 @@ +<?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="io_XActiveDataSink" 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 RunTest() + +'************************************************************************* +' INTERFACE: +' com.sun.star.io.XActiveDataSink +'************************************************************************* +On Error Goto ErrHndl + Dim bOK As Boolean + Dim oIS As Object, oPipe As Object, oGetPipe As Object + Dim aData As Variant, aGetData As Variant + Dim bytesRead As Variant + + ResetStreams() + Test.StartMethod("getInputStream()") + bOK = true + oIS = oObj.getInputStream() + bOK = bOK AND hasUnoInterfaces(oIS, "com.sun.star.io.XInputStream") + Test.MethodTested("getInputStream()", bOK) + + Test.StartMethod("setInputStream()") + bOK = true + oPipe = createUnoService("com.sun.star.io.Pipe") + aData = Array(23, 65, 32, 119) + oPipe.writeBytes(aData) + oObj.setInputStream(oPipe) + oGetPipe = oObj.getInputStream() + aGetData = dimArray(ubound(aData()) + bytesRead = oGetPipe.readBytes(aGetData(), ubound(aData()) + 1) + Out.Log("Reading bytes: " + bytesRead) + + bOK = bOK AND cmpArrays(aData, aGetData) + + Out.Log("Setting old input stream ...") + oObj.setInputStream(oIS) + + Test.MethodTested("setInputStream()", bOK) +Exit Sub +ErrHndl: + Test.Exception() + bOK = false + resume next +End Sub + +Function cmpArrays(arr1 As Variant, arr2 As Variant) As Boolean +On Error Goto ErrHndl + Dim bRet As Boolean + Dim i As Integer + + bRet = true + if (isNull(arr1) OR isNull(arr2)) then + bRet = false + Out.Log("One of arrays is null") + else + if (ubound(arr1()) <> ubound(arr2())) then + Out.Log("UBOUND of 1st array is " + ubound(arr1()) + _ + "UBOUND of 2nd array is " + ubound(arr2())) + bRet = false + else + for i = 0 to ubound(arr1()) + Out.Log("(" + i + "): " + arr1(i) + "-" + arr2(i)) + bRet = bRet AND (arr1(i) = arr2(i)) + next i + end if + end if + + cmpArrays() = bRet +exit Function +ErrHndl: + Test.Exception() + cmpArrays() = false +End Function +</script:module> diff --git a/qadevOOo/tests/basic/ifc/io/XActiveDataSink/script.xlb b/qadevOOo/tests/basic/ifc/io/XActiveDataSink/script.xlb new file mode 100644 index 000000000000..b85797766d3e --- /dev/null +++ b/qadevOOo/tests/basic/ifc/io/XActiveDataSink/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="io_XActiveDataSink" library:readonly="false" library:passwordprotected="false"> +"<library:element library:name="io_XActiveDataSink"/> +"</library:library> diff --git a/qadevOOo/tests/basic/ifc/io/XActiveDataSource/io_XActiveDataSource.xba b/qadevOOo/tests/basic/ifc/io/XActiveDataSource/io_XActiveDataSource.xba new file mode 100644 index 000000000000..3bd00f2bd4ad --- /dev/null +++ b/qadevOOo/tests/basic/ifc/io/XActiveDataSource/io_XActiveDataSource.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="io_XActiveDataSource" 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 RunTest() + +'************************************************************************* +' INTERFACE: +' com.sun.star.io.XActiveDataSource +'************************************************************************* +On Error Goto ErrHndl + Dim bOK As Boolean + Dim oOS As Object + + Test.StartMethod("getOutputStream()") + bOK = true + oOS = oObj.getOutputStream() + bOK = bOK AND hasUnoInterfaces(oOS, "com.sun.star.io.XOutputStream") + Test.MethodTested("getOutputStream()", bOK) + + Test.StartMethod("setOutputStream()") + bOK = true + oObj.setOutputStream(oOS) + Test.MethodTested("setOutputStream()", bOK) + +Exit Sub +ErrHndl: + Test.Exception() + bOK = false + resume next +End Sub +</script:module> diff --git a/qadevOOo/tests/basic/ifc/io/XActiveDataSource/script.xlb b/qadevOOo/tests/basic/ifc/io/XActiveDataSource/script.xlb new file mode 100644 index 000000000000..8dd0873e6226 --- /dev/null +++ b/qadevOOo/tests/basic/ifc/io/XActiveDataSource/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="io_XActiveDataSource" library:readonly="false" library:passwordprotected="false"> +"<library:element library:name="io_XActiveDataSource"/> +"</library:library> diff --git a/qadevOOo/tests/basic/ifc/io/XConnectable/io_XConnectable.xba b/qadevOOo/tests/basic/ifc/io/XConnectable/io_XConnectable.xba new file mode 100644 index 000000000000..a30e570dea38 --- /dev/null +++ b/qadevOOo/tests/basic/ifc/io/XConnectable/io_XConnectable.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="io_XConnectable" 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. +' +'************************************************************************* +'************************************************************************* + + + + + +Sub RunTest() + +'************************************************************************* +' INTERFACE: +' com.sun.star.io.XConnectable +'************************************************************************* +On Error Goto ErrHndl + Dim bOK As Boolean + + Test.StartMethod("setPredecessor()") + bOK = true + oObj.setPredecessor(oObj) + Test.MethodTested("setPredecessor()", bOK) + + Test.StartMethod("getPredecessor()") + bOK = true + oPr = oObj.getPredecessor() + bOK = bOK AND hasUnoInterfaces(oPr, "com.sun.star.io.XConnectable") + Test.MethodTested("getPredecessor()", bOK) + + Test.StartMethod("setSuccessor()") + bOK = true + oObj.setSuccessor(oObj) + Test.MethodTested("setSuccessor()", bOK) + + Test.StartMethod("getSuccessor()") + bOK = true + oSc = oObj.getSuccessor() + bOK = bOK AND hasUnoInterfaces(oSc, "com.sun.star.io.XConnectable") + Test.MethodTested("getSuccessor()", bOK) + + ResetStreams() + +Exit Sub +ErrHndl: + Test.Exception() + bOK = false + resume next +End Sub +</script:module> diff --git a/qadevOOo/tests/basic/ifc/io/XConnectable/script.xlb b/qadevOOo/tests/basic/ifc/io/XConnectable/script.xlb new file mode 100644 index 000000000000..b0feddcc80d4 --- /dev/null +++ b/qadevOOo/tests/basic/ifc/io/XConnectable/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="io_XConnectable" library:readonly="false" library:passwordprotected="false"> +"<library:element library:name="io_XConnectable"/> +"</library:library> diff --git a/qadevOOo/tests/basic/ifc/io/XDataInputStream/io_XDataInputStream.xba b/qadevOOo/tests/basic/ifc/io/XDataInputStream/io_XDataInputStream.xba new file mode 100644 index 000000000000..989ceed4875e --- /dev/null +++ b/qadevOOo/tests/basic/ifc/io/XDataInputStream/io_XDataInputStream.xba @@ -0,0 +1,170 @@ +<?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="io_XDataInputStream" 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. +' +'************************************************************************* +'************************************************************************* + + + + + +Sub RunTest() + +'************************************************************************* +' INTERFACE: +' com.sun.star.io.XDataInputStream +'************************************************************************* +On Error Goto ErrHndl + Dim bOK As Boolean + Dim DataTypes(10) As String + Dim Data(10) As Variant + Dim oTypeConvertor As Object + + bOK = true + + oTypeConvertor = createUnoService("com.sun.star.script.Converter") + + DataTypes(0) = "byte" + Data(0) = 65 + DataTypes(1) = "boolean" + Data(1) = true + DataTypes(2) = "double" + Data(2) = 10.567 + DataTypes(3) = "long" + Data(3) = 12345678 + DataTypes(4) = "char" + Data(4) = oTypeConvertor.convertToSimpleType(89, com.sun.star.uno.TypeClass.CHAR) + DataTypes(5) = "short" + Data(5) = 233 + DataTypes(6) = "UTF" + Data(6) = "UTF String" + DataTypes(7) = "float" + Data(7) = -233.15 + DataTypes(8) = "Hyper" + Data(8) = 98765432123456 + + Out.Log("Writing data first... ") + + oOutStream = getOutStream() + + for i = 0 to ubound(Data()) + select case DataTypes(i) + case "boolean" + oOutStream.writeBoolean(Data(i)) + case "byte" + oOutStream.writeByte(Data(i)) + case "char" + oOutStream.writeChar(Data(i)) + case "short" + oOutStream.writeShort(Data(i)) + case "long" + oOutStream.writeLong(Data(i)) + case "Hyper" + oOutStream.writeHyper(Data(i)) + case "float" + oOutStream.writeFloat(Data(i)) + case "double" + oOutStream.writeDouble(Data(i)) + case "UTF" + oOutStream.writeUTF(Data(i)) + end select + next i + + Out.Log("then reading and comparering... ") + + ResetStreams() + + for i = 0 to ubound(Data()) + select case DataTypes(i) + case "boolean" + Dim bVar As Boolean + bVar = oObj.readBoolean() + Out.Log("Expected boolean '" & Data(i) & "', actual is '" & bVar & "'") + bOK = bOK AND Data(i) = bVar + Test.MethodTested("readBoolean()", bOK) + case "byte" + Dim iByteVar As Integer + iByteVar = oObj.readByte() + Out.Log("Expected byte '" & int(Data(i)) & "', actual is '" & int(iByteVar) & "'") + bOK = bOK AND Data(i) = iByteVar + Test.MethodTested("readByte()", bOK) + case "char" + Dim cCharVar As Integer + cCharVar = oObj.readChar() + Out.Log("Expected char '" & chr(Data(i)) & "', actual is '" & chr(cCharVar) & "'") + bOK = bOK AND Data(i) = cCharVar + Test.MethodTested("readChar()", bOK) + case "short" + Dim iShortVar As Integer + iShortVar = oObj.readShort() + Out.Log("Expected short '" & int(Data(i)) & "', actual is '" & int(iShortVar) & "'") + bOK = bOK AND Data(i) = iShortVar + Test.MethodTested("readShort()", bOK) + case "long" + Dim iLongVar As Long + iLongVar = oObj.readLong() + Out.Log("Expected long '" & Data(i) & "', actual is '" & iLongVar & "'") + bOK = bOK AND Data(i) = iLongVar + Test.MethodTested("readLong()", bOK) + case "Hyper" + Dim iHyperVar As Variant + iHyperVar = oObj.readHyper() + Out.Log("Expected hyper '" & Data(i) & "', actual is '" & iHyperVar & "'") + bOK = bOK AND Data(i) = iHyperVar + Test.MethodTested("readHyper()", bOK) + case "float" + Dim dFloatVar As Double + dFloatVar = oObj.readFloat() + Out.Log("Expected float '" & Data(i) & "', actual is '" & dFloatVar & "'") + bOK = bOK AND (abs(Data(i) - dFloatVar) < 0.00001) + Test.MethodTested("readFloat()", bOK) + case "double" + Dim dDoubleVar As Double + dDoubleVar = oObj.readDouble() + Out.Log("Expected double '" & Data(i) & "', actual is '" & dDoubleVar & "'") + bOK = bOK AND Data(i) = dDoubleVar + Test.MethodTested("readDouble()", bOK) + case "UTF" + Dim cUTFVar As String + cUTFVar = oObj.readUTF() + Out.Log("Expected UTF '" & Data(i) & "', actual is '" & cUTFVar & "'") + bOK = bOK AND Data(i) = cUTFVar + Test.MethodTested("readUTF()", bOK) + end select + next i + + ResetStreams() +Exit Sub +ErrHndl: + Test.Exception() + bOK = false + resume next +End Sub +</script:module> diff --git a/qadevOOo/tests/basic/ifc/io/XDataInputStream/script.xlb b/qadevOOo/tests/basic/ifc/io/XDataInputStream/script.xlb new file mode 100644 index 000000000000..c3623319e6ed --- /dev/null +++ b/qadevOOo/tests/basic/ifc/io/XDataInputStream/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="io_XDataInputStream" library:readonly="false" library:passwordprotected="false"> +"<library:element library:name="io_XDataInputStream"/> +"</library:library> diff --git a/qadevOOo/tests/basic/ifc/io/XDataOutputStream/io_XDataOutputStream.xba b/qadevOOo/tests/basic/ifc/io/XDataOutputStream/io_XDataOutputStream.xba new file mode 100644 index 000000000000..6ec09d17c2cd --- /dev/null +++ b/qadevOOo/tests/basic/ifc/io/XDataOutputStream/io_XDataOutputStream.xba @@ -0,0 +1,173 @@ +<?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="io_XDataOutputStream" 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 RunTest() + +'************************************************************************* +' INTERFACE: +' com.sun.star.io.XDataOutputStream +'************************************************************************* +On Error Goto ErrHndl + Dim bOK As Boolean + Dim DataTypes(10) As String + Dim Data(10) As Variant + Dim oTypeConvertor As Object + Dim i As Integer + Dim oInputStream As Object + + bOK = true + + oTypeConvertor = createUnoService("com.sun.star.script.Converter") + + DataTypes(0) = "byte" + Data(0) = 65 + DataTypes(1) = "boolean" + Data(1) = true + DataTypes(2) = "double" + Data(2) = 10.567 + DataTypes(3) = "long" + Data(3) = 12345678 + DataTypes(4) = "char" + Data(4) = oTypeConvertor.convertToSimpleType(89, com.sun.star.uno.TypeClass.CHAR) + DataTypes(5) = "short" + Data(5) = 233 + DataTypes(6) = "UTF" + Data(6) = "UTF String" + DataTypes(7) = "float" + Data(7) = -233.15 + DataTypes(8) = "Hyper" + Data(8) = 98765432123456 + + Out.Log("Writing data first... ") + + for i = 0 to ubound(Data()) + select case DataTypes(i) + case "boolean" + oObj.writeBoolean(Data(i)) + case "byte" + oObj.writeByte(Data(i)) + case "char" + oObj.writeChar(Data(i)) + case "short" + oObj.writeShort(Data(i)) + case "long" + oObj.writeLong(Data(i)) + case "Hyper" + oObj.writeHyper(Data(i)) + case "float" + oObj.writeFloat(Data(i)) + case "double" + oObj.writeDouble(Data(i)) + case "UTF" + oObj.writeUTF(Data(i)) + end select + next i + + Out.Log("then reading and comparering... ") + + oInputStream = getInStream() + + for i = 0 to ubound(Data()) + select case DataTypes(i) + case "boolean" + Dim bVar As Boolean + bVar = oInputStream.readBoolean() + Out.Log("Expected boolean '" + Data(i) + "', actual is '" + bVar + "'") + bOK = bOK AND Data(i) = bVar + Test.MethodTested("writeBoolean()", bOK) + case "byte" + Dim iByteVar As Integer + iByteVar = oInputStream.readByte() + Out.Log("Expected byte '" + int(Data(i)) + "', actual is '" + int(iByteVar) + "'") + bOK = bOK AND Data(i) = iByteVar + Test.MethodTested("writeByte()", bOK) + case "char" + Dim cCharVar As Integer + cCharVar = oInputStream.readChar() + Out.Log("Expected char '" + chr(Data(i)) + "', actual is '" + chr(cCharVar) + "'") + bOK = bOK AND Data(i) = cCharVar + Test.MethodTested("writeChar()", bOK) + case "short" + Dim iShortVar As Integer + iShortVar = oInputStream.readShort() + Out.Log("Expected short '" + int(Data(i)) + "', actual is '" + int(iShortVar) + "'") + bOK = bOK AND Data(i) = iShortVar + Test.MethodTested("writeShort()", bOK) + case "long" + Dim iLongVar As Long + iLongVar = oInputStream.readLong() + Out.Log("Expected long '" + Data(i) + "', actual is '" + iLongVar + "'") + bOK = bOK AND Data(i) = iLongVar + Test.MethodTested("writeLong()", bOK) + case "Hyper" + Dim iHyperVar As Variant + iHyperVar = oInputStream.readHyper() + Out.Log("Expected hyper '" + Data(i) + "', actual is '" + iHyperVar + "'") + bOK = bOK AND Data(i) = iHyperVar + Test.MethodTested("writeHyper()", bOK) + case "float" + Dim dFloatVar As Double + dFloatVar = oInputStream.readFloat() + Out.Log("Expected float '" + Data(i) + "', actual is '" + dFloatVar + "'") + bOK = bOK AND (abs(Data(i) - dFloatVar) < 0.00001) + Test.MethodTested("writeFloat()", bOK) + case "double" + Dim dDoubleVar As Double + dDoubleVar = oInputStream.readDouble() + Out.Log("Expected double '" + Data(i) + "', actual is '" + dDoubleVar + "'") + bOK = bOK AND Data(i) = dDoubleVar + Test.MethodTested("writeDouble()", bOK) + case "UTF" + Dim cUTFVar As Variant + cUTFVar = oInputStream.readUTF() + Out.Log("Expected UTF '" + Data(i) + "', actual is '" + cUTFVar + "'") + bOK = bOK AND Data(i) = cUTFVar + Test.MethodTested("writeUTF()", bOK) + end select + next i + + ResetStreams() +Exit Sub +ErrHndl: + Test.Exception() + bOK = false + resume next +End Sub +</script:module> diff --git a/qadevOOo/tests/basic/ifc/io/XDataOutputStream/script.xlb b/qadevOOo/tests/basic/ifc/io/XDataOutputStream/script.xlb new file mode 100644 index 000000000000..95fc351c043e --- /dev/null +++ b/qadevOOo/tests/basic/ifc/io/XDataOutputStream/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="io_XDataOutputStream" library:readonly="false" library:passwordprotected="false"> +"<library:element library:name="io_XDataOutputStream"/> +"</library:library> diff --git a/qadevOOo/tests/basic/ifc/io/XInputStream/io_XInputStream.xba b/qadevOOo/tests/basic/ifc/io/XInputStream/io_XInputStream.xba new file mode 100644 index 000000000000..f4fae54389ea --- /dev/null +++ b/qadevOOo/tests/basic/ifc/io/XInputStream/io_XInputStream.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="io_XInputStream" 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. +' +'************************************************************************* +'************************************************************************* + + + + + +Sub RunTest() + +'************************************************************************* +' INTERFACE: +' com.sun.star.io.XInputStream +'************************************************************************* +On Error Goto ErrHndl + Dim bOK As Boolean + Dim Bytes(10) As Integer + Dim rBytes(10) As Integer + Dim oOutputStream As Object + Dim i As Integer + Dim nRead As Integer + + Out.Log("First writeBytes()...") + bOK = true + + for i = 0 to ubound(Bytes()) + Bytes(i) = i + next i + + oOutputStream = getOutStream() + oOutputStream.writeBytes(Bytes()) + + if (cObjectName <> "stm.Pipe") then ResetStreams() + + Test.StartMethod("readBytes()") + bOK = true + nRead = oObj.readBytes(Bytes(), 5) + bOK = bOK AND nRead = 5 + for i = 0 to 4 + Out.Log("Expected " & i & ", actual is " & int(Bytes(i))) + bOK = bOK AND Bytes(i) = i + next i + Test.MethodTested("readBytes()", bOK) + + Test.StartMethod("skipBytes()") + bOK = true + oObj.skipBytes(2) + nRead = oObj.readBytes(Bytes(), 2) + Out.Log("Expected " & 7 & ", actual is " & int(Bytes(0))) + bOK = bOK AND Bytes(0) = 7 + Test.MethodTested("skipBytes()", bOK) + + Test.StartMethod("available()") + bOK = true + iAvail = oObj.available() + Out.Log("bytes available without blocking: " & iAvail) + bOK = bOK AND iAvail >= 0 + Test.MethodTested("available()", bOK) + + Test.StartMethod("readSomeBytes()") + bOK = true + nRead = oObj.readSomeBytes(Bytes(), 10) + Out.Log("Can read " & nRead & " bytes.") + for i = 0 to ubound(Bytes()) + Out.Log(int(Bytes(i))) + next i + bOK = bOK AND ubound(Bytes()) = 1 + bOK = bOK AND nRead = 2 + bOK = bOK AND Bytes(0) = 9 + bOK = bOK AND Bytes(1) = 10 + Test.MethodTested("readSomeBytes()", bOK) + + Test.StartMethod("closeInput()") + bOK = true + Out.Log("This method is called in main module.") + Test.MethodTested("closeInput()", bOK) + + ResetStreams() + +Exit Sub +ErrHndl: + Test.Exception() + bOK = false + resume next +End Sub +</script:module> diff --git a/qadevOOo/tests/basic/ifc/io/XInputStream/script.xlb b/qadevOOo/tests/basic/ifc/io/XInputStream/script.xlb new file mode 100644 index 000000000000..7154ab2bb35b --- /dev/null +++ b/qadevOOo/tests/basic/ifc/io/XInputStream/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="io_XInputStream" library:readonly="false" library:passwordprotected="false"> +"<library:element library:name="io_XInputStream"/> +"</library:library> diff --git a/qadevOOo/tests/basic/ifc/io/XMarkableStream/io_XMarkableStream.xba b/qadevOOo/tests/basic/ifc/io/XMarkableStream/io_XMarkableStream.xba new file mode 100644 index 000000000000..3062fedbe093 --- /dev/null +++ b/qadevOOo/tests/basic/ifc/io/XMarkableStream/io_XMarkableStream.xba @@ -0,0 +1,253 @@ +<?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="io_XMarkableStream" 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 RunTest() + +'************************************************************************* +' INTERFACE: +' com.sun.star.io.XMarkableStream +'************************************************************************* +On Error Goto ErrHndl + Dim bOK As Boolean + Dim Bytes(20) As Integer + Dim rBytes(0) + Dim lastRByte As Integer + Dim i As Integer + Dim oOutStream As Object + Dim oInStream As Object + Dim iMark1 As Integer + Dim iMark2 As Integer + Dim iByte As Integer + Dim iBytes As Integer + Dim iByteAfterMark As Integer + Dim iByteAfterMark1 As Integer + Dim iByteAfterMark2 As Integer + Dim iOffset As Integer + Dim sFileStr As String + + if (cObjectName = "stm.MarkableInputStream" OR cObjectName = "stm.ObjectInputStream") then + + for i = 0 to ubound(Bytes()) + Bytes(i) = i * 2 + next i + + Out.Log("First reset streams and write some bytes...") + oOutStream = getOutStream() + oOutStream.writeBytes(Bytes()) + ResetStreams() + + Test.StartMethod("createMark()") + bOK = true + Out.Log("Skip 3 bytes.") + oObj.skipBytes(3) + iMark1 = oObj.createMark() + Out.Log("Mark" + iMark1 + " was created.") + + oObj.readBytes(rBytes(), 1) + iByteAfterMark1 = rBytes(0) + Out.Log("Byte after Mark" + iMark1 + " is " + int(iByteAfterMark1)) + + Out.Log("Skip 5 bytes.") + oObj.skipBytes(5) + iMark2 = oObj.createMark() + Out.Log("Mark" + iMark2 + " was created.") + + oObj.readBytes(rBytes(), 1) + iByteAfterMark2 = rBytes(0) + Out.Log("Byte after Mark" + iMark2 + " is " + int(iByteAfterMark2)) + + Out.Log("Skip 7 bytes.") + oObj.skipBytes(7) + oObj.readBytes(rBytes(), 1) + lastRByte = rBytes(0) + + Out.Log("Jump to Mark" + iMark2) + oObj.jumpToMark(iMark2) + oObj.readBytes(rBytes(), 1) + iByteAfterMark = rBytes(0) + Out.Log("Byte after Mark" + iMark2 + " is " + int(iByteAfterMark) + ", expected " + int(iByteAfterMark2)) + bOK = bOK AND iByteAfterMark = iByteAfterMark2 + + Out.Log("Jump to Mark" + iMark1) + oObj.jumpToMark(iMark1) + oObj.readBytes(rBytes(), 1) + iByteAfterMark = rBytes(0) + Out.Log("Byte after Mark" + iMark1 + " is " + int(iByteAfterMark) + ", expected " + int(iByteAfterMark1)) + bOK = bOK AND iByteAfterMark = iByteAfterMark1 + + Test.MethodTested("createMark()", bOK) + Test.MethodTested("jumpToMark()", bOK) + + Test.StartMethod("offsetToMark()") + bOK = true + iOffset = oObj.offsetToMark(iMark2) + Out.Log("Offset from current position to Mark" + iMark2 + " is " + iOffset) + bOK = bOK AND iOffset = -5 + Test.MethodTested("offsetToMark()", bOK) + + Test.StartMethod("deleteMark()") + bOK = true + Out.Log("Delete Mark" + iMark1) + oObj.deleteMark(iMark1) + On Error goto ErrHndl1 + Out.Log("Trying to jump to deleted mark") + oObj.jumpToMark(iMark1) + Out.Log("No exception occured. FAILED") + bOK = false + goto Cont1 + ErrHndl1: + Out.Log("Expected exception: " + error) + Cont1: + Test.MethodTested("deleteMark()", bOK) + + Test.StartMethod("jumpToFurthest()") + bOK = true + oObj.readBytes(rBytes(), 1) + iByte = rBytes(0) + Out.Log("Perform a reading operation from the current position. Byte " + int(iByte) + " was read.") + Out.Log("Changing position.") + oObj.jumpToMark(iMark2) + Out.Log("Changing position with jumpToFurthest()") + oObj.jumpToFurthest() + oObj.readBytes(rBytes(), 1) + Out.Log("From the current position byte " + int(rBytes(0)) + " was read. Expected byte is " + int(lastRByte) + 2) + bOK = bOK AND lastRByte + 2 = rBytes(0) + Test.MethodTested("jumpToFurthest()", bOK) + else + bOK = true + Out.Log("Write 3 bytes to stream") + ReDim Bytes(2) As Integer + for i = 0 to ubound(Bytes()) + Bytes(i) = i + next i + oObj.writeBytes(Bytes()) + Out.Log("Creating a Mark.") + iMark1 = oObj.createMark() + Out.Log("Write 4 bytes to stream") + ReDim Bytes(3) As Integer + for i = 0 to ubound(Bytes()) + Bytes(i) = i + 3 + next i + oObj.writeBytes(Bytes()) + Out.Log("Creating a Mark.") + iMark2 = oObj.createMark() + + iOffset = oObj.offsetToMark(iMark1) + Out.Log("Offset from current position to Mark" + iMark1 + " is " + iOffset) + bOK = bOK AND iOffset = 4 + Test.MethodTested("offsetToMark()", bOK) + + Out.Log("Write 5 bytes to stream") + ReDim Bytes(4) As Integer + for i = 0 to ubound(Bytes()) + Bytes(i) = i + 7 + next i + oObj.writeBytes(Bytes()) + + Out.Log("Testing jumpToMark()") + Out.Log("Testing deleteMark()") + bOK = true + Out.Log("Deleting Mark1") + oObj.deleteMark(iMark2) + On Error goto ErrHndl2 + Out.Log("Trying to jump to Mark1") + oObj.jumpToMark(iMark2) + Out.Log("No exception occured - FAILED") + bOK = false + goto Cont2 + ErrHndl2: + Out.Log("Expected exception: " + error) + Cont2: + + Test.MethodTested("deleteMark()", bOK) + + bOK = true + + Out.Log("Jump to Mark0") + oObj.jumpToMark(iMark1) + Test.MethodTested("jumpToMark()", bOK) + Test.MethodTested("createMark()", bOK) + + bOK = true + Out.Log("Write 2 bytes to stream") + ReDim Bytes(1) As Integer + + for i = 0 to ubound(Bytes()) + Bytes(i) = i + 12 + next i + + oObj.writeBytes(Bytes()) + Out.Log("Changing position") + oObj.jumpToMark(iMark1) + Out.Log("Changing position with jumpToFurthest()") + oObj.jumpToFurthest() + + Out.Log("Write 2 bytes to stream") + ReDim Bytes(1) As Integer + for i = 0 to ubound(Bytes()) + Bytes(i) = i + 14 + next i + oObj.writeBytes(Bytes()) + + Out.Log("Comparing file with expected {0, 1, 2, 12, 13, 5, 6, 7, 8, 9, 10, 11, 14, 15}") + oInStream = getInStream() + iBytes = oInStream.readBytes(rBytes(), 20) + Out.Log("There are " + iBytes + " in stream:") + sFileStr = "" + int(rBytes(0)) + for i = 1 to ubound(rBytes()) + sFileStr = sFileStr + ", " + int(rBytes(i)) + next i + Out.Log("They are {" + sFileStr + "}") + bOK = bOK AND sFileStr = "0, 1, 2, 12, 13, 5, 6, 7, 8, 9, 10, 11, 14, 15" + + Test.MethodTested("jumpToFurthest()", bOK) + end if + + ResetStreams() + DisposeObj() + CreateObj() + +Exit Sub +ErrHndl: + Test.Exception() + bOK = false + resume next +End Sub +</script:module> diff --git a/qadevOOo/tests/basic/ifc/io/XMarkableStream/script.xlb b/qadevOOo/tests/basic/ifc/io/XMarkableStream/script.xlb new file mode 100644 index 000000000000..0cccb2f8f56c --- /dev/null +++ b/qadevOOo/tests/basic/ifc/io/XMarkableStream/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="io_XMarkableStream" library:readonly="false" library:passwordprotected="false"> +"<library:element library:name="io_XMarkableStream"/> +"</library:library> diff --git a/qadevOOo/tests/basic/ifc/io/XObjectInputStream/io_XObjectInputStream.xba b/qadevOOo/tests/basic/ifc/io/XObjectInputStream/io_XObjectInputStream.xba new file mode 100644 index 000000000000..c12c8ce0180e --- /dev/null +++ b/qadevOOo/tests/basic/ifc/io/XObjectInputStream/io_XObjectInputStream.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="io_XObjectInputStream" 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. +' +'************************************************************************* +'************************************************************************* + + + + + +Sub RunTest() + +'************************************************************************* +' INTERFACE: +' com.sun.star.io.XObjectInputStream +'************************************************************************* +On Error Goto ErrHndl + Dim bOK As Boolean + + + Dim oObjToWrite As Object + oObjToWrite = createUnoService("com.sun.star.awt.UnoControlButtonModel") + oObjToWrite.Label = "XObjectInputStream" + + Out.Log("Writing object with label " & oObjToWrite.Label ) + + oOutStream = getOutStream() + oOutStream.writeObject(oObjToWrite) + + ResetStreams() + + Test.StartMethod("readObject()") + bOK = true + + if (bOK) then + oReadObj = oObj.readObject() + + Out.Log("Object with label " & oReadObj.Label & " was read") + bOK = bOK AND oReadObj.Label = "XObjectInputStream" + end if + + Test.MethodTested("readObject()", bOK) + + ResetStreams() + +Exit Sub +ErrHndl: + Test.Exception() + bOK = false + resume next +End Sub +</script:module> diff --git a/qadevOOo/tests/basic/ifc/io/XObjectInputStream/script.xlb b/qadevOOo/tests/basic/ifc/io/XObjectInputStream/script.xlb new file mode 100644 index 000000000000..08c456872069 --- /dev/null +++ b/qadevOOo/tests/basic/ifc/io/XObjectInputStream/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="io_XObjectInputStream" library:readonly="false" library:passwordprotected="false"> +"<library:element library:name="io_XObjectInputStream"/> +"</library:library> diff --git a/qadevOOo/tests/basic/ifc/io/XObjectOutputStream/io_XObjectOutputStream.xba b/qadevOOo/tests/basic/ifc/io/XObjectOutputStream/io_XObjectOutputStream.xba new file mode 100644 index 000000000000..0f3f1f6bc97c --- /dev/null +++ b/qadevOOo/tests/basic/ifc/io/XObjectOutputStream/io_XObjectOutputStream.xba @@ -0,0 +1,75 @@ +<?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="io_XObjectOutputStream" 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. +' +'************************************************************************* +'************************************************************************* + + + + + +Sub RunTest() + +'************************************************************************* +' INTERFACE: +' com.sun.star.io.XObjectOutputStream +'************************************************************************* +On Error Goto ErrHndl + Dim bOK As Boolean + + Dim oObjToWrite As Object + oObjToWrite = createUnoService("com.sun.star.awt.UnoControlButtonModel") + oObjToWrite.Label = "XObjectOutputStream" + + Out.Log("Writing object with label " & oObjToWrite.Label ) + + Test.StartMethod("writeObject()") + bOK = true + oObj.writeObject(oObjToWrite) + + if (bOK) then + inStream = getInStream() + oReadObj = inStream.readObject() + + Out.Log("Object with label " & oReadObj.Label & " was read") + bOK = bOK AND oReadObj.Label = "XObjectOutputStream" + end if + + Test.MethodTested("writeObject()", bOK) + + ResetStreams() + +Exit Sub +ErrHndl: + Test.Exception() + bOK = false + resume next +End Sub +</script:module> diff --git a/qadevOOo/tests/basic/ifc/io/XObjectOutputStream/script.xlb b/qadevOOo/tests/basic/ifc/io/XObjectOutputStream/script.xlb new file mode 100644 index 000000000000..84af6a647208 --- /dev/null +++ b/qadevOOo/tests/basic/ifc/io/XObjectOutputStream/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="io_XObjectOutputStream" library:readonly="false" library:passwordprotected="false"> +"<library:element library:name="io_XObjectOutputStream"/> +"</library:library> diff --git a/qadevOOo/tests/basic/ifc/io/XOutputStream/io_XOutputStream.xba b/qadevOOo/tests/basic/ifc/io/XOutputStream/io_XOutputStream.xba new file mode 100644 index 000000000000..f88bb41866c8 --- /dev/null +++ b/qadevOOo/tests/basic/ifc/io/XOutputStream/io_XOutputStream.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="io_XOutputStream" 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. +' +'************************************************************************* +'************************************************************************* + + + + + + +Sub RunTest() + +'************************************************************************* +' INTERFACE: +' com.sun.star.io.XOutputStream +'************************************************************************* +On Error Goto ErrHndl + Dim bOK As Boolean + Dim Bytes(10) As Integer + Dim rBytes(10) As Integer + + Test.StartMethod("writeBytes()") + bOK = true + + for i = 0 to ubound(Bytes()) + Bytes(i) = i + next i + oObj.writeBytes(Bytes()) + + oInputStream = getInStream() + iBytesRead = oInputStream.readBytes(rBytes(), ubound(Bytes()) + 1) + Out.Log("" & iBytesRead & " bytes were read") + bOK = bOK AND iBytesRead = ubound(Bytes()) + 1 + + for i = 0 to ubound(rBytes()) + Out.Log("Expected " & Bytes(i) & ", actual is " & int(rBytes(i))) + bOK = bOK AND Bytes(i) = rBytes(i) + next i + + Test.MethodTested("writeBytes()", bOK) + + Test.StartMethod("flush()") + bOK = true + oObj.flush() + Test.MethodTested("flush()", bOK) + + Test.StartMethod("closeOutput()") + bOK = true + Out.Log("This method is called in main module.") + Test.MethodTested("closeOutput()", bOK) + + ResetStreams() + +Exit Sub +ErrHndl: + Test.Exception() + bOK = false + resume next +End Sub +</script:module> diff --git a/qadevOOo/tests/basic/ifc/io/XOutputStream/script.xlb b/qadevOOo/tests/basic/ifc/io/XOutputStream/script.xlb new file mode 100644 index 000000000000..38a1f413e6d9 --- /dev/null +++ b/qadevOOo/tests/basic/ifc/io/XOutputStream/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="io_XOutputStream" library:readonly="false" library:passwordprotected="false"> +"<library:element library:name="io_XOutputStream"/> +"</library:library> diff --git a/qadevOOo/tests/basic/ifc/io/XPersistObject/io_XPersistObject.xba b/qadevOOo/tests/basic/ifc/io/XPersistObject/io_XPersistObject.xba new file mode 100644 index 000000000000..11b00b9e7dce --- /dev/null +++ b/qadevOOo/tests/basic/ifc/io/XPersistObject/io_XPersistObject.xba @@ -0,0 +1,130 @@ +<?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="io_XPersistObject" 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 + +'************************************************************************* +' This Interface/Service test depends on the following GLOBAL variables, +' which must be specified in the object creation: + +' - Global oPersistInstance As Object + +'************************************************************************* + + + + + +Sub RunTest() + +'************************************************************************* +' INTERFACE: +' com.sun.star.io.XPersistObject +'************************************************************************* +On Error Goto ErrHndl + Dim bOK As Boolean + Dim oMarkIn, oMarkOut, oOutStrm, oInStrm As Object + Dim oDummy, oCopy, oPipe As Object + Dim uuidString As String + Dim UUID(), UUIDnew() As Variant + Dim i As Integer + + if isNull(oPersistInstance) Then + Out.Log("oPersistInstance is Empty! No oPersistInstance in main created?") + Exit Sub + end if + + Test.StartMethod("getServiceName()") + bOK = true + bOK = bOK AND (VarType(oObj.getServiceName()) = 8) + Test.MethodTested("getServiceName()", bOK) + + if (hasUnoInterfaces(oObj,"com.sun.star.lang.XTypeProvider")) then + 'get ImplementationID + Out.Log("Before writing object, rememeber it's implementation ID.") + uuidString = "" + UUID = oObj.getImplementationId() + for i = 0 to ubound(UUID()) + uuidString = uuidString & UUID(i) & "; " + next i + Out.Log("ImplementationID: " & uuidString) + endif + + oDummy = oPersistInstance + oPipe = createUNOService("com.sun.star.io.Pipe") + oMarkOut = createUNOService("com.sun.star.io.MarkableOutputStream") + oMarkIn = createUNOService("com.sun.star.io.MarkableInputStream") + oOutStrm = createUNOService("com.sun.star.io.ObjectOutputStream") + oInStrm = createUNOService("com.sun.star.io.ObjectInputStream") + + 'made chain + oOutStrm.setOutputStream(oMarkOut) + oMarkOut.setOutputStream(oPipe) + oMarkIn.setInputStream(oPipe) + oInStrm.setInputStream(oMarkIn) + + Test.StartMethod("write()") + Test.StartMethod("read()") + bOK = true + 'write dummy + oOutStrm.writeObject(oDummy) + oObj.write(oOutStrm) + 'read copy + oCopy = oInStrm.readObject() + oObj.read(oInStrm) + + if (hasUnoInterfaces(oObj,"com.sun.star.lang.XTypeProvider")) then + Out.Log("After reading object, get it's implementation ID.") + uuidString = "" + UUIDnew = oObj.getImplementationId() + for i = 0 to ubound(UUID()) + bOK = bOK AND (UUID(i) = UUIDnew(i)) + uuidString = uuidString & UUIDnew(i) & "; " + next i + Out.Log("ImplementationID: " & uuidString) + endif + + Test.MethodTested("write()", bOK) + Test.MethodTested("read()", bOK) + + ReCreateObj() +Exit Sub +ErrHndl: + Test.Exception() + bOK = false + resume next +End Sub +</script:module> diff --git a/qadevOOo/tests/basic/ifc/io/XPersistObject/script.xlb b/qadevOOo/tests/basic/ifc/io/XPersistObject/script.xlb new file mode 100644 index 000000000000..baaea2bba562 --- /dev/null +++ b/qadevOOo/tests/basic/ifc/io/XPersistObject/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="io_XPersistObject" library:readonly="false" library:passwordprotected="false"> +"<library:element library:name="io_XPersistObject"/> +"</library:library> |