2 ' This file is part of the LibreOffice project.
4 ' This Source Code Form is subject to the terms of the Mozilla Public
5 ' License, v. 2.0. If a copy of the MPL was not distributed with this
6 ' file, You can obtain one at http://mozilla.org/MPL/2.0/.
11 Function doUnitTest() As String
14 doUnitTest
= TestUtil
.GetResult()
17 Sub verify_tdf149622()
18 On Error GoTo errorHandler
20 ' Testing fixed-type return value (Handler_handleEvent(...) As Boolean)
22 oHandler
= CreateUnoListener("Handler_", "com.sun.star.awt.XEventHandler")
23 TestUtil
.AssertEqualStrict(oHandler
.handleEvent(0), True, "oHandler.handleEvent(0)")
24 ' Before the fix for tdf#149622, this returned the previous return value
25 TestUtil
.AssertEqualStrict(oHandler
.handleEvent(1), False, "oHandler.handleEvent(1)")
27 ' Testing Variant return value (Transfer_getData)
28 Dim oTransferable
, aId0(0) As Byte, aId1(1) As Byte
29 oTransferable
= CreateUnoListener("Transfer_", "com.sun.star.datatransfer.XSystemTransferable")
30 TestUtil
.AssertEqualStrict(oTransferable
.getData(aId0
), True, "oTransferable.getData(aId0)")
31 ' Before the fix for tdf#149622, this returned the previous return value
32 TestUtil
.AssertEqualStrict(oTransferable
.getData(aId1
), Empty
, "oTransferable.getData(aId1)")
37 TestUtil
.ReportErrorHandler("verify_tdf149622", Err
, Error$, Erl
)
40 Function Handler_handleEvent(Event) As Boolean
41 If Event = 0 Then Handler_handleEvent
= True
42 ' Do not define return value explicitly in Else case
45 Function Transfer_getData(aProcessId())
46 If UBound(aProcessId
) - LBound(aProcessId
) = 0 Then Transfer_getData
= True ' only for 1-element array
47 ' Do not define return value explicitly in Else case