Avoid potential negative array index access to cached text.
[LibreOffice.git] / qadevOOo / tests / java / ifc / i18n / _XExtendedTransliteration.java
blob001936927b407a695e28502f33e0b4ef32b805c3
1 /*
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 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 package ifc.i18n;
20 import com.sun.star.i18n.TransliterationModules;
21 import com.sun.star.i18n.XExtendedTransliteration;
22 import com.sun.star.lang.Locale;
23 import lib.MultiMethodTest;
25 /**
28 public class _XExtendedTransliteration extends MultiMethodTest {
29 public XExtendedTransliteration oObj = null;
30 private final Locale loc = new Locale("en", "US", "") ;
32 @Override
33 public void before() {
34 oObj.loadModule(TransliterationModules.LOWERCASE_UPPERCASE, loc);
37 /**
38 * Check lowercase - uppercase conversion of chars
40 public void _transliterateChar2Char() {
41 boolean result = true;
42 char in = 'a';
43 char out = ' ';
44 try {
45 out = oObj.transliterateChar2Char(in) ;
46 result &= out == 'A';
47 in = '$'; // should not be changed
48 out = oObj.transliterateChar2Char(in) ;
49 result &= out == '$';
51 catch(com.sun.star.i18n.MultipleCharsOutputException e) {
52 e.printStackTrace(log);
54 tRes.tested("transliterateChar2Char()", result);
57 /**
58 * Check lowercase - uppercase conversion of char to string
60 public void _transliterateChar2String() {
61 boolean result = true;
62 char in = 'a';
63 String out = null;
64 out = oObj.transliterateChar2String('a') ;
65 result &= out.equals("A");
66 in = '$'; // should not be changed
67 out = oObj.transliterateChar2String(in) ;
68 result &= out.equals("$");
69 tRes.tested("transliterateChar2String()", result);
72 /**
73 * Check lowercase - uppercase conversion of strings
75 public void _transliterateString2String() {
76 boolean result = true;
77 String in = "aAbBcC";
78 String out = null;
79 out = oObj.transliterateString2String(in, 0, 6) ;
80 result &= out.equals("AABBCC");
81 in = "$"; // should not be changed
82 out = oObj.transliterateString2String(in, 0, 1) ;
83 result &= out.equals("$");
84 tRes.tested("transliterateString2String()", result);