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/.
8 ' Test built-in compatibility versions of methods whose absence
9 ' is really felt in VBA, and large numbers of macros import from
12 ' This module tests different signatures for the same methods.
18 Private Type LARGE_INTEGER
23 Private Declare Function QueryPerformanceCounter
Lib "kernel32" (lpPerformanceCount
As LARGE_INTEGER
) As Long
24 Private Declare Function QueryPerformanceFrequency
Lib "kernel32" (lpFrequency
As LARGE_INTEGER
) As Long
26 Function doUnitTest() As String
29 doUnitTest
= TestUtil
.GetResult()
32 Function convertLarge(scratch
As LARGE_INTEGER
) As Double
34 ret
= scratch
.highpart
35 ret
= ret
* 65536 * 65536
36 ret
= ret
+ scratch
.lowpart
40 Sub verify_win32compatb()
41 Dim scratch
as LARGE_INTEGER
47 On Error GoTo errorHandler
49 success
= QueryPerformanceFrequency(scratch
)
50 TestUtil
.Assert(success
<> 0, "QueryPerformanceFrequency")
51 freq
= convertLarge(scratch
)
52 TestUtil
.Assert(freq
> 0, "QueryPerformanceFrequency", "perf. frequency is incorrect " & freq
)
54 success
= QueryPerformanceCounter(scratch
)
55 TestUtil
.Assert(success
<> 0, "QueryPerformanceCounter")
56 count_a
= convertLarge(scratch
)
58 ' success = QueryPerformanceCounter(scratch)
59 ' TestUtil.Assert(success <> 0, "fetching performance count")
60 ' count_b = convertLarge(scratch)
61 ' TestUtil.Assert(count_a < count_b, "count mismatch " & count_a & " is > " & count_b)
65 TestUtil
.ReportErrorHandler("verify_win32compatb", Err
, Error$, Erl
)