Debian Codegraph @

basic/qa/basic_coverage/test_tdf149622.bas

raw
1 '
2 ' This file is part of the LibreOffice project.
3 '
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/.
7 '
8
9 Option Explicit
10
11 Function doUnitTest() As String
12 TestUtil.TestInit
13 verify_tdf149622()
14 doUnitTest = TestUtil.GetResult()
15 End Function
16
17 Sub verify_tdf149622()
18 On Error GoTo errorHandler
19
20 ' Testing fixed-type return value (Handler_handleEvent(...) As Boolean)
21 Dim oHandler
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)")
26
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)")
33
34 Exit Sub
35
36 errorHandler:
37 TestUtil.ReportErrorHandler("verify_tdf149622", Err, Error$, Erl)
38 End Sub
39
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
43 End Function
44
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
48 End Function