Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / basic / qa / basic_coverage / test_transliteration.bas
blobdd5f24fb4dae04b68ae3f60066deeb4ca7127bd9
1 ' This file is part of the LibreOffice project.
3 ' This Source Code Form is subject to the terms of the Mozilla Public
4 ' License, v. 2.0. If a copy of the MPL was not distributed with this
5 ' file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 Option Explicit
10 Function doUnitTest() As String
11 TestUtil.TestInit
12 verify_testTransliteration
13 doUnitTest = TestUtil.GetResult()
14 End Function
16 Sub verify_testTransliteration
17 On Error GoTo errorHandler
19 Dim oTr As Object, s$, oLoc as new com.sun.star.lang.Locale
21 With oLoc
22 .Country="US"
23 .Language="en"
24 .Variant=""
25 End With
27 s="AB cd. eF. "
28 oTr = CreateUnoService("com.sun.star.i18n.Transliteration")
30 oTr.LoadModuleByImplName("LOWERCASE_UPPERCASE", oLoc)
31 TestUtil.AssertEqual(oTr.transliterateString2String(s, 0, Len(s)), "AB CD. EF. ", "LOWERCASE_UPPERCASE")
33 oTr.LoadModuleByImplName("UPPERCASE_LOWERCASE", oLoc)
34 TestUtil.AssertEqual(oTr.transliterateString2String(s, 0, Len(s)), "ab cd. ef. ", "UPPERCASE_LOWERCASE")
36 oTr.LoadModuleByImplName("TOGGLE_CASE", oLoc)
37 TestUtil.AssertEqual(oTr.transliterateString2String(s, 0, Len(s)), "ab CD. Ef. ", "TOGGLE_CASE")
39 oTr.LoadModuleByImplName("IGNORE_CASE", oLoc)
40 TestUtil.AssertEqual(oTr.transliterateString2String(s, 0, Len(s)), "ab cd. ef. ", "IGNORE_CASE")
42 ' tdf#152520: Without the fix in place, this test would have crashed here
43 oTr.LoadModuleByImplName("TITLE_CASE", oLoc)
44 TestUtil.AssertEqual(oTr.transliterateString2String(s, 0, Len(s)), "Ab cd. ef. ", "TITLE_CASE")
46 oTr.LoadModuleByImplName("SENTENCE_CASE", oLoc)
47 TestUtil.AssertEqual(oTr.transliterateString2String(s, 0, Len(s)), "Ab cd. ef. ", "SENTENCE_CASE")
49 Exit Sub
50 errorHandler:
51 TestUtil.ReportErrorHandler("verify_testTransliteration", Err, Error$, Erl)
52 End Sub