1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 package ifc.i18n;
24 
25 import com.sun.star.i18n.TransliterationModules;
26 import com.sun.star.i18n.XExtendedTransliteration;
27 import com.sun.star.lang.Locale;
28 import lib.MultiMethodTest;
29 
30 /**
31  *
32  */
33 public class _XExtendedTransliteration extends MultiMethodTest {
34     public XExtendedTransliteration oObj = null;
35 //    private Locale loc = new Locale("ja", "JP", "") ;
36     private Locale loc = new Locale("en", "US", "") ;
37 
before()38     public void before() {
39         oObj.loadModule(TransliterationModules.LOWERCASE_UPPERCASE, loc);
40     }
41 
42     /**
43      * Check lowercase - uppercase conversion of chars
44      */
_transliterateChar2Char()45     public void _transliterateChar2Char() {
46         boolean result = true;
47         char in = 'a';
48         char out = ' ';
49         try {
50             out = oObj.transliterateChar2Char(in) ;
51             result &= out == 'A';
52             in = '$'; // should not be changed
53             out = oObj.transliterateChar2Char(in) ;
54             result &= out == '$';
55         }
56         catch(com.sun.star.i18n.MultipleCharsOutputException e) {
57             e.printStackTrace((java.io.PrintWriter)log);
58         }
59         tRes.tested("transliterateChar2Char()", result);
60     }
61 
62     /**
63      * Check lowercase - uppercase conversion of char to string
64      */
_transliterateChar2String()65     public void _transliterateChar2String() {
66         boolean result = true;
67         char in = 'a';
68         String out = null;
69         out = oObj.transliterateChar2String('a') ;
70         result &= out.equals("A");
71         in = '$'; // should not be changed
72         out = oObj.transliterateChar2String(in) ;
73         result &= out.equals("$");
74         tRes.tested("transliterateChar2String()", result);
75     }
76 
77     /**
78      * Check lowercase - uppercase conversion of strings
79      */
_transliterateString2String()80     public void _transliterateString2String() {
81         boolean result = true;
82         String in = "aAbBcC";
83         String out = null;
84         out = oObj.transliterateString2String(in, 0, 6) ;
85         result &= out.equals("AABBCC");
86         in = "$"; // should not be changed
87         out = oObj.transliterateString2String(in, 0, 1) ;
88         result &= out.equals("$");
89         tRes.tested("transliterateString2String()", result);
90     }
91 }
92