Files
loongoffice/basic/qa/vba_tests/collection.vb
Eike Rathke 07a2afa490 Resolves: tdf#110003 tdf#143128 handle lowercase ß vs uppercase ẞ folding
Change lowercase ß U+00DF LATIN SMALL LETTER SHARP S from
LowerToUpper, ToUpper: SS
ToTitle: Ss
FullFolding: ss
to
LowerToUpper, ToUpper: ẞ  U+1E9E
ToTitle: ẞ  U+1E9E
FullFolding: ss

Add uppercase ẞ U+1E9E LATIN CAPITAL LETTER SHARP S
UpperToLower, ToLower: ß  U+00DF
FullFolding: ss

Adjust BASIC Collection test to new reality.

Change-Id: I198e06985b81a71e5de94bf7fab7a0dbaf10baef
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124988
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins
2021-11-11 01:27:47 +01:00

76 lines
2.5 KiB
VB.net

'
' This file is part of the LibreOffice project.
'
' This Source Code Form is subject to the terms of the Mozilla Public
' License, v. 2.0. If a copy of the MPL was not distributed with this
' file, You can obtain one at http://mozilla.org/MPL/2.0/.
'
Option VBASupport 1
Option Explicit
Function doUnitTest() As String
TestUtil.TestInit
verify_testCollection
doUnitTest = TestUtil.GetResult()
End Function
Sub verify_testCollection()
Dim a As Collection
Dim b As Collection
On Error Resume Next
Set a = New Collection
a.Add 1, "D"
a.Add 2, "d"
a.Add 3, "Д" ' uppercase Cyrillic script De
a.Add 4, "д" ' lowercase Cyrillic script De
On Error GoTo 0
On Error Resume Next
Set b = New Collection
b.Add 1, "SS"
b.Add 2, "ss"
b.Add 3, "" ' uppercase German Eszett
b.Add 4, "ß" ' lowercase German Eszett
On Error GoTo 0
On Error GoTo errorHandler
' tdf#144245 - case-insensitive operation for non-ASCII characters
' Without the fix in place, this test would have failed with
' - Expected: 2
' - Actual : 3
TestUtil.AssertEqual(a.Count, 2, "a.Count")
' tdf#144245 - case-insensitive operation for non-ASCII item access
' Without the fix in place, this test would have failed with
' - Expected: 1 for d, 3 for lowercase Cyrillic script De (д)
' - Actual : 2 for d, 4 for lowercase Cyrillic script De (д)
TestUtil.AssertEqual(a.Item("D"), 1, "a.Item(""D"")")
TestUtil.AssertEqual(a.Item("d"), 1, "a.Item(""d"")")
TestUtil.AssertEqual(a.Item("Д"), 3, "a.Item(""Д"")")
TestUtil.AssertEqual(a.Item("д"), 3, "a.Item(""д"")")
' tdf#144245 - German Eszett is uppercased to a two-character 'SS'.
' This test should fail after tdf#110003 has been fixed since the lowercase and the uppercase
' German Eszett should be matched to the same index.
' Before the fix of tdf#110003
'TestUtil.AssertEqual(b.Count, 3, "b.Count")
' After the fix of tdf#110003
TestUtil.AssertEqual(b.Count, 2, "b.Count")
TestUtil.AssertEqual(b.Item("SS"), 1, "b.Item(""SS"")")
TestUtil.AssertEqual(b.Item("ss"), 1, "b.Item(""ss"")")
TestUtil.AssertEqual(b.Item(""), 3, "b.Item("""")")
' Before the fix of tdf#110003
'TestUtil.AssertEqual(b.Item("ß"), 4, "b.Item(""ß"")")
' After the fix of tdf#110003
TestUtil.AssertEqual(b.Item("ß"), 3, "b.Item(""ß"")")
Exit Sub
errorHandler:
TestUtil.ReportErrorHandler("verify_testCollection", Err, Error$, Erl)
End Sub