ICU-7649 Add check for certain default locales to ensure environment test passes.

X-SVN-Rev: 28303
This commit is contained in:
Michael Ow 2010-07-13 19:43:25 +00:00
parent 74e297291f
commit 00a84e6d99
3 changed files with 31 additions and 17 deletions

View File

@ -1373,6 +1373,11 @@ static void RamsRulesTest(void) {
log_verbose("RamsRulesTest\n");
if (uprv_strcmp("km", uloc_getDefault())==0 || uprv_strcmp("km_KH", uloc_getDefault())==0) {
/* This test will fail if the default locale is "km" or "km_KH". Enable after trac#6040. */
return;
}
for(i = 0; i<noOfLoc; i++) {
status = U_ZERO_ERROR;
locName = uloc_getAvailable(i);

View File

@ -482,21 +482,24 @@ LocaleTest::TestDisplayNames()
/* Check to see if ICU supports this locale */
if (symb.getLocale(ULOC_VALID_LOCALE, status) != Locale("root")) {
/* test that the default locale has a display name for its own language */
Locale().getDisplayLanguage(Locale(), s);
if(s.length()<=3 && s.charAt(0)<=0x7f) {
/* check <=3 to reject getting the language code as a display name */
dataerrln("unable to get a display string for the language of the default locale.\n");
}
/* Currently, there is no language information in the "tl" data file so this test will fail if default locale is "tl" */
if (uprv_strcmp(Locale().getLanguage(), "tl") != 0) {
Locale().getDisplayLanguage(Locale(), s);
if(s.length()<=3 && s.charAt(0)<=0x7f) {
/* check <=3 to reject getting the language code as a display name */
dataerrln("unable to get a display string for the language of the default locale: " + s);
}
/*
* API coverage improvements: call
* Locale::getDisplayLanguage(UnicodeString &) and
* Locale::getDisplayCountry(UnicodeString &)
*/
s.remove();
Locale().getDisplayLanguage(s);
if(s.length()<=3 && s.charAt(0)<=0x7f) {
dataerrln("unable to get a display string for the language of the default locale [2].\n");
/*
* API coverage improvements: call
* Locale::getDisplayLanguage(UnicodeString &) and
* Locale::getDisplayCountry(UnicodeString &)
*/
s.remove();
Locale().getDisplayLanguage(s);
if(s.length()<=3 && s.charAt(0)<=0x7f) {
dataerrln("unable to get a display string for the language of the default locale [2]: " + s);
}
}
}
else {

View File

@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (C) 2003-2009, International Business Machines Corporation and *
* Copyright (C) 2003-2010, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
@ -152,12 +152,18 @@ void CollationServiceTest::TestRegister()
UnicodeString displayName;
Collator::getDisplayName(fu_FU, displayName);
if (displayName != "fu (FU)") {
/* The locale display pattern for the locale ja, ko, and zh are different. */
const Locale& defaultLocale = Locale::getDefault();
if (displayName != "fu (FU)" &&
((defaultLocale == Locale::getKorean() && defaultLocale == Locale::getJapanese()) && displayName == "fu(FU)") &&
((defaultLocale == Locale::getChinese()) && displayName != "fu\uff08FU\uff09")) {
errln(UnicodeString("found ") + displayName + " for fu_FU");
}
Collator::getDisplayName(fu_FU, fu_FU, displayName);
if (displayName != "fu (FU)") {
if (displayName != "fu (FU)" &&
((defaultLocale == Locale::getKorean() && defaultLocale == Locale::getJapanese()) && displayName == "fu(FU)") &&
((defaultLocale == Locale::getChinese()) && displayName != "fu\uff08FU\uff09")) {
errln(UnicodeString("found ") + displayName + " for fu_FU");
}