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
16 Private Declare Function QueryPerformanceCounter
Lib "kernel32" (ByRef lpPerformanceCount
As Currency) As Long
17 Private Declare Function QueryPerformanceFrequency
Lib "kernel32" (ByRef lpFrequency
As Currency) As Long
19 Function doUnitTest() As String
22 doUnitTest
= TestUtil
.GetResult()
25 Sub verify_win32compat()
27 Dim count_a
As Currency
28 Dim count_b
As Currency
31 On Error GoTo errorHandler
33 success
= QueryPerformanceFrequency(freq
)
34 TestUtil
.Assert(success
<> 0, "QueryPerformanceFrequency")
35 TestUtil
.Assert(freq
> 0, "QueryPerformanceFrequency", "perf. frequency is incorrect " & freq
)
37 success
= QueryPerformanceCounter(count_a
)
38 TestUtil
.Assert(success
<> 0, "QueryPerformanceCounter(count_a)")
40 success
= QueryPerformanceCounter(count_b
)
41 TestUtil
.Assert(success
<> 0, "QueryPerformanceCounter(count_b)")
42 TestUtil
.Assert(count_a
< count_b
, "count mismatch " & count_a
& " is > " & count_b
)
46 TestUtil
.ReportErrorHandler("verify_win32compat", Err
, Error$, Erl
)