ICU-2323 Add test for creating Transliterators from data returned by UScript
X-SVN-Rev: 9956
This commit is contained in:
parent
85b31f659c
commit
42ed47e383
@ -8,6 +8,9 @@
|
||||
package com.ibm.icu.dev.test.lang;
|
||||
|
||||
import com.ibm.icu.lang.UScript;
|
||||
import com.ibm.icu.lang.UScriptRun;
|
||||
import com.ibm.icu.text.Transliterator;
|
||||
import com.ibm.icu.text.UnicodeSet;
|
||||
import com.ibm.icu.dev.test.TestFmwk;
|
||||
import java.util.Locale;
|
||||
|
||||
@ -268,13 +271,46 @@ public class TestUScript extends TestFmwk{
|
||||
}
|
||||
public void TestAllCodepoints(){
|
||||
int code;
|
||||
String oldId="";
|
||||
String oldAbbrId="";
|
||||
for( int i =0; i <= 0x10ffff; i++){
|
||||
code =UScript.INVALID_CODE;
|
||||
code = UScript.getScript(i);
|
||||
if(code==UScript.INVALID_CODE){
|
||||
errln("UScript.getScript for codepoint 0x"+ hex(i)+" failed");
|
||||
}
|
||||
String id =UScript.getName(code);
|
||||
String abbr = UScript.getShortName(code);
|
||||
String newId ="[:"+id+":];NFD";
|
||||
String newAbbrId ="[:"+abbr+":];NFD";
|
||||
if(!oldId.equals(newId)){
|
||||
try{
|
||||
Transliterator t = Transliterator.getInstance(newId);
|
||||
if(t==null){
|
||||
errln("Failed to create transliterator for "+hex(i)+
|
||||
" script code: " +id);
|
||||
}
|
||||
}catch(Exception e){
|
||||
errln("Failed to create transliterator for "+hex(i)
|
||||
+" script code: " +id
|
||||
+ " Exception: "+e.getMessage());
|
||||
}
|
||||
}
|
||||
oldId = newId;
|
||||
if(!oldAbbrId.equals(newAbbrId)){
|
||||
try{
|
||||
Transliterator t = Transliterator.getInstance(newAbbrId);
|
||||
if(t==null){
|
||||
errln("Failed to create transliterator for "+hex(i)+
|
||||
" script code: " +abbr);
|
||||
}
|
||||
}catch(Exception e){
|
||||
errln("Failed to create transliterator for "+hex(i)
|
||||
+" script code: " +abbr
|
||||
+ " Exception: "+e.getMessage());
|
||||
}
|
||||
}
|
||||
oldAbbrId = newAbbrId;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user