ICU-3830 make propertiesTests pass with propertiesBasic module, fix UScript
X-SVN-Rev: 15814
This commit is contained in:
parent
e2718d8ad2
commit
5612811355
@ -602,6 +602,10 @@
|
||||
<target name="propertiesTests" depends="propertiesBasic">
|
||||
<copy file="${src.dir}/com/ibm/icu/dev/data/unicode/SpecialCasing.txt"
|
||||
todir="${build.dir}/com/ibm/icu/dev/data/unicode/"/>
|
||||
<!-- TODO this assumes no other target has extracted these files already, revisit -->
|
||||
<unjar src="${src.dir}/com/ibm/icu/impl/data/icudata.jar" dest="${build.dir}">
|
||||
<patternset includes="**/icudt30b/*.brk,**/icudt30b/unames.icu" excludes="**/CVS/**/*"/>
|
||||
</unjar>
|
||||
<javac includes="com/ibm/icu/dev/test/TestFmwk.java,com/ibm/icu/dev/test/TestLog.java,com/ibm/icu/dev/test/TestUtil.java,com/ibm/icu/dev/test/UTF16Util.java,com/ibm/icu/dev/test/TestAll.java,com/ibm/icu/dev/test/lang/**/*.java"
|
||||
excludes="**/CVS/**/*,com/ibm/icu/dev/test/lang/TestUScriptRun.java"
|
||||
srcdir="${src.dir}"
|
||||
|
@ -63,15 +63,23 @@ public class TestUScript extends TestFmwk {
|
||||
numErrors++;
|
||||
}
|
||||
}
|
||||
if(numErrors >0 ){
|
||||
if(noData()){
|
||||
errln("Number of Errors in UScript.getCode() : " + numErrors);
|
||||
}else{
|
||||
warnln("Could not find locale data");
|
||||
reportDataErrors(numErrors);
|
||||
}
|
||||
|
||||
private void reportDataErrors(int numErrors) {
|
||||
if (numErrors >0) {
|
||||
if (isModularBuild()) {
|
||||
// assume missing locale data, so not an error, just a warning
|
||||
if (!noData()) {
|
||||
// if nodata is set don't even warn
|
||||
warnln("Could not find locale data");
|
||||
}
|
||||
} else {
|
||||
errln("encountered " + numErrors + " errors.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void TestMultipleCode(){
|
||||
final String[] testNames = { "ja" ,"ko_KR","zh","zh_TW"};
|
||||
final int[][] expected = {
|
||||
@ -96,15 +104,9 @@ public class TestUScript extends TestFmwk {
|
||||
numErrors++;
|
||||
}
|
||||
}
|
||||
if(numErrors >0 ){
|
||||
if(noData()){
|
||||
errln("Number of Errors in UScript.getCode() : " + numErrors);
|
||||
}else{
|
||||
warnln("Could not find locale data");
|
||||
}
|
||||
}
|
||||
|
||||
reportDataErrors(numErrors);
|
||||
}
|
||||
|
||||
public void TestGetCode(){
|
||||
|
||||
final String[] testNames={
|
||||
@ -168,16 +170,9 @@ public class TestUScript extends TestFmwk {
|
||||
numErrors++;
|
||||
}
|
||||
}
|
||||
if(numErrors >0 ){
|
||||
if (!noData()) {
|
||||
warnln("Could not find locale data");
|
||||
}else{
|
||||
errln("Number of Errors in UScript.getCode() : " + numErrors);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
reportDataErrors(numErrors);
|
||||
}
|
||||
|
||||
public void TestGetName(){
|
||||
|
||||
final int[] testCodes={
|
||||
|
@ -14,6 +14,7 @@ import com.ibm.icu.util.ULocale;
|
||||
import com.ibm.icu.util.UResourceBundle;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.MissingResourceException;
|
||||
|
||||
/**
|
||||
* A class to reflect UTR #24: Script Names
|
||||
@ -274,49 +275,49 @@ public final class UScript {
|
||||
* New script in Unicode 4
|
||||
* @draft ICU 2.6
|
||||
* */
|
||||
public static final int BRAILLE = 46; /* Brai */
|
||||
/**
|
||||
public static final int BRAILLE = 46; /* Brai */
|
||||
/**
|
||||
* Cypriot
|
||||
* New script in Unicode 4
|
||||
* @draft ICU 2.6
|
||||
* */
|
||||
public static final int CYPRIOT = 47; /* Cprt */
|
||||
public static final int CYPRIOT = 47; /* Cprt */
|
||||
/**
|
||||
* Limbu
|
||||
* New script in Unicode 4
|
||||
* @draft ICU 2.6
|
||||
* */
|
||||
public static final int LIMBU = 48; /* Limb */
|
||||
* */
|
||||
public static final int LIMBU = 48; /* Limb */
|
||||
/**
|
||||
* Linear B
|
||||
* New script in Unicode 4
|
||||
* @draft ICU 2.6
|
||||
* */
|
||||
public static final int LINEAR_B = 49; /* Linb */
|
||||
public static final int LINEAR_B = 49; /* Linb */
|
||||
/**
|
||||
* Osmanya
|
||||
* New script in Unicode 4
|
||||
* @draft ICU 2.6
|
||||
* */
|
||||
public static final int OSMANYA = 50; /* Osma */
|
||||
public static final int OSMANYA = 50; /* Osma */
|
||||
/**
|
||||
* Shavian
|
||||
* New script in Unicode 4
|
||||
* @draft ICU 2.6
|
||||
* */
|
||||
public static final int SHAVIAN = 51; /* Shaw */
|
||||
public static final int SHAVIAN = 51; /* Shaw */
|
||||
/**
|
||||
* Tai Le
|
||||
* New script in Unicode 4
|
||||
* @draft ICU 2.6
|
||||
* */
|
||||
public static final int TAI_LE = 52; /* Tale */
|
||||
public static final int TAI_LE = 52; /* Tale */
|
||||
/**
|
||||
* Ugaritic
|
||||
* New script in Unicode 4
|
||||
* @draft ICU 2.6
|
||||
* */
|
||||
public static final int UGARITIC = 53; /* Ugar */
|
||||
public static final int UGARITIC = 53; /* Ugar */
|
||||
/**
|
||||
* New script code in Unicode 4.0.1
|
||||
* @draft ICU 3.0
|
||||
@ -338,10 +339,16 @@ public final class UScript {
|
||||
* @param Locale the locale.
|
||||
*/
|
||||
private static int[] findCodeFromLocale(ULocale locale) {
|
||||
ICUResourceBundle rb = (ICUResourceBundle)UResourceBundle.getBundleInstance(ICUResourceBundle.ICU_BASE_NAME, locale);
|
||||
ICUResourceBundle rb;
|
||||
try {
|
||||
rb = (ICUResourceBundle)UResourceBundle.getBundleInstance(ICUResourceBundle.ICU_BASE_NAME, locale);
|
||||
}
|
||||
catch (MissingResourceException e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// if rb is not a strict fallback of the requested locale, return null
|
||||
if(rb==null || !LocaleUtility.isFallbackOf(rb.getULocale().toString(), locale.toString())){
|
||||
if(!LocaleUtility.isFallbackOf(rb.getULocale().toString(), locale.toString())){
|
||||
return null;
|
||||
}
|
||||
ICUResourceBundle sub = rb.get("LocaleScript");
|
||||
@ -349,9 +356,9 @@ public final class UScript {
|
||||
int[] result = new int[sub.getSize()];
|
||||
int w = 0;
|
||||
for (int i = 0; i < result.length; ++i) {
|
||||
int code = UCharacter.getPropertyValueEnum(UProperty.SCRIPT,
|
||||
sub.getString(i));
|
||||
result[w++] = code;
|
||||
int code = UCharacter.getPropertyValueEnum(UProperty.SCRIPT,
|
||||
sub.getString(i));
|
||||
result[w++] = code;
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user