ICU-5298 test for jb 5298
X-SVN-Rev: 20024
This commit is contained in:
parent
f2d93b6736
commit
9a3f15a7d2
@ -13,6 +13,7 @@
|
||||
package com.ibm.icu.dev.test.collator;
|
||||
|
||||
import com.ibm.icu.dev.test.TestFmwk;
|
||||
import com.ibm.icu.util.ULocale;
|
||||
import com.ibm.icu.util.UResourceBundle;
|
||||
import com.ibm.icu.impl.ICUResourceBundle;
|
||||
import com.ibm.icu.impl.ImplicitCEGenerator;
|
||||
@ -23,7 +24,11 @@ import com.ibm.icu.text.Collator;
|
||||
import com.ibm.icu.text.Normalizer;
|
||||
import com.ibm.icu.text.RuleBasedCollator;
|
||||
import com.ibm.icu.text.UTF16;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.Arrays;
|
||||
import java.util.Locale;
|
||||
import java.util.TreeSet;
|
||||
|
||||
public class CollationMiscTest extends TestFmwk {
|
||||
|
||||
@ -2132,16 +2137,15 @@ public class CollationMiscTest extends TestFmwk {
|
||||
genericLocaleStarter(new Locale("zh","",""), test2);
|
||||
}
|
||||
|
||||
public void
|
||||
TestUpperFirstQuaternary()
|
||||
public void TestUpperFirstQuaternary()
|
||||
{
|
||||
String tests[] = { "B", "b", "Bb", "bB" };
|
||||
String[] att = { "strength", "UpperFirst" };
|
||||
Object attVals[] = { new Integer(Collator.QUATERNARY), new Boolean(true) };
|
||||
genericLocaleStarterWithOptions(new Locale("root","",""), tests, att, attVals);
|
||||
}
|
||||
public void
|
||||
TestJ4960()
|
||||
|
||||
public void TestJ4960()
|
||||
{
|
||||
String tests[] = { "\\u00e2T", "aT" };
|
||||
String att[] = { "strength", "CaseLevel" };
|
||||
@ -2159,4 +2163,42 @@ public class CollationMiscTest extends TestFmwk {
|
||||
// Test whether completely ignorable letters have case level info (they shouldn't)
|
||||
genericRulesStarterWithOptionsAndResult(rule, tests2, att2, attVals2, 0);
|
||||
}
|
||||
|
||||
public void TestJB5298(){
|
||||
ULocale[] locales = Collator.getAvailableULocales();
|
||||
logln("Number of collator locales returned : " + locales.length);
|
||||
// double-check keywords
|
||||
String[] keywords = Collator.getKeywords();
|
||||
if (keywords.length != 1 || !keywords[0].equals("collation")) {
|
||||
throw new IllegalArgumentException("internal collation error");
|
||||
}
|
||||
|
||||
String[] values = Collator.getKeywordValues("collation");
|
||||
|
||||
logln("Number of collator values returned : " + values.length);
|
||||
|
||||
Set foundValues = new TreeSet(Arrays.asList(values));
|
||||
|
||||
for (int i = 0; i < locales.length; ++i) {
|
||||
for (int j = 0; j < values.length; ++j) {
|
||||
ULocale tryLocale = values[j].equals("standard")
|
||||
? locales[i] : new ULocale(locales[i] + "@collation=" + values[j]);
|
||||
// only append if not standard
|
||||
ULocale canon = Collator.getFunctionalEquivalent("collation",tryLocale);
|
||||
if (!canon.equals(tryLocale)) {
|
||||
continue; // has a different
|
||||
}else {// functional equivalent, so skip
|
||||
logln(tryLocale + " : "+canon+", ");
|
||||
}
|
||||
String can = canon.toString();
|
||||
int idx = can.indexOf("@collation=");
|
||||
String val = idx >= 0 ? can.substring(idx+11, can.length()) : "";
|
||||
if(val.length()>0 && !foundValues.contains(val)){
|
||||
errln("Unknown collation found "+ can);
|
||||
}
|
||||
}
|
||||
}
|
||||
logln(" ");
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user