| 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 |
' We link to shlwapi in many places, so safe to rely on it here |
| 12 |
Declare Function PathFindExtensionA Lib "Shlwapi" (ByVal pszPath As String) As String |
| 13 |
|
| 14 |
Function doUnitTest() As String |
| 15 |
TestUtil.TestInit |
| 16 |
verify_testPathFindExtensionA |
| 17 |
doUnitTest = TestUtil.GetResult() |
| 18 |
End Function |
| 19 |
|
| 20 |
Sub verify_testPathFindExtensionA() |
| 21 |
On Error GoTo errorHandler |
| 22 |
|
| 23 |
' Only test on Windows |
| 24 |
If (GetGUIType() <> 1) Then |
| 25 |
TestUtil.Assert(True) ' The test passed |
| 26 |
Exit Sub |
| 27 |
End If |
| 28 |
|
| 29 |
' Without the fix for tdf#147364 in place, the next call would crash in 64-bit version with |
| 30 |
' *** Exception 0xc0000005 occurred *** |
| 31 |
TestUtil.AssertEqual(PathFindExtensionA("filename.ext"), ".ext", "PathFindExtensionA(""filename.ext"")") |
| 32 |
|
| 33 |
Exit Sub |
| 34 |
errorHandler: |
| 35 |
TestUtil.ReportErrorHandler("verify_testPathFindExtensionA", Err, Error$, Erl) |
| 36 |
End Sub |