ICU-9392 japanese calendar minimum era should be 0

X-SVN-Rev: 32253
This commit is contained in:
Peter Edberg 2012-08-27 23:21:33 +00:00
parent 944ff6eeaf
commit d7a3235efb
2 changed files with 13 additions and 3 deletions

View file

@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (C) 2003-2009, International Business Machines Corporation and *
* Copyright (C) 2003-2009,2012, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*
@ -478,7 +478,7 @@ int32_t JapaneseCalendar::handleGetLimit(UCalendarDateFields field, ELimitType l
switch(field) {
case UCAL_ERA:
if (limitType == UCAL_LIMIT_MINIMUM || limitType == UCAL_LIMIT_GREATEST_MINIMUM) {
return 1;
return 0;
}
return kCurrentEra;
case UCAL_YEAR:

View file

@ -455,7 +455,7 @@ static void TestCalendar()
if ( U_SUCCESS(status) ) {
const char * calType = ucal_getType(caldef, &status);
if ( U_SUCCESS(status) && calType != NULL ) {
if ( strcmp( calType, ucalGetTypeTestPtr->expectedResult ) != 0 ) {
if ( uprv_strcmp( calType, ucalGetTypeTestPtr->expectedResult ) != 0 ) {
log_err("FAIL: ucal_open %s type %d does not return %s calendar\n", localeToDisplay,
ucalGetTypeTestPtr->calType, ucalGetTypeTestPtr->expectedResult);
}
@ -2040,6 +2040,16 @@ void TestAddRollEra0AndEraBounds() {
}
}
status = U_ZERO_ERROR;
ucal_clear(ucalTest);
{
int32_t eraMin = ucal_getLimit(ucalTest, UCAL_ERA, UCAL_MINIMUM, &status);
const char * calType = ucal_getType(ucalTest, &status);
if (eraMin != 0 && uprv_strcmp(calType, "chinese") != 0) {
log_err("FAIL: ucal_getLimit returns minimum era %d (should be 0) for calType %s, error %s\n", eraMin, calType, u_errorName(status));
}
}
status = U_ZERO_ERROR;
ucal_clear(ucalTest);
ucal_set(ucalTest, UCAL_YEAR, 1);