ICU-9105 Fix DateTimePatternGenerator for 'U', integrate Chinese cal data updates from cldrbug 4395, update tests (J)

X-SVN-Rev: 31412
This commit is contained in:
Peter Edberg 2012-02-17 17:19:17 +00:00
parent 6098f00b1f
commit f8869b1d10
5 changed files with 28 additions and 10 deletions

View File

@ -1704,8 +1704,8 @@ public class DateTimePatternGenerator implements Freezable<DateTimePatternGenera
// - "field" is the field from the found pattern.
//
// The adjusted field should consist of characters from the originally requested
// skeleton, except in the case of HOUR or MONTH or WEEKDAY, in which case it should
// consist of characters from the found pattern.
// skeleton, except in the case of HOUR or MONTH or WEEKDAY or YEAR, in which case it
// should consist of characters from the found pattern.
//
// The length of the adjusted field (adjFieldLen) should match that in the originally
// requested skeleton, except that in the following cases the length of the adjusted field
@ -1743,7 +1743,7 @@ public class DateTimePatternGenerator implements Freezable<DateTimePatternGenera
adjFieldLen = fieldBuilder.length();
}
}
char c = (type != HOUR && type != MONTH && type != WEEKDAY)? reqField.charAt(0): fieldBuilder.charAt(0);
char c = (type != HOUR && type != MONTH && type != WEEKDAY && type != YEAR)? reqField.charAt(0): fieldBuilder.charAt(0);
fieldBuilder = new StringBuilder();
for (int i = adjFieldLen; i > 0; --i) fieldBuilder.append(c);
}

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b8fd4d9386e70d4d59a76afbf3b5f139b6ed48abd2f4e49f48896b96b5e5922d
size 7930117
oid sha256:a0ebb8aca35e3abc24835d6e9ca6229a86d314d81f2ffb2a5932a50d04afe0f4
size 7931116

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d6b867b3b48d9c4f777778026fec4c005265efa5412b1015430ec7e99e1522ed
size 92708
oid sha256:0082e2ceb617263b0e2d5badddecabe7c43034a3d3fc23b0c6c1eb1ed792376e
size 92697

View File

@ -3928,8 +3928,8 @@ public class DateFormatTest extends com.ibm.icu.dev.test.TestFmwk {
new MonthPatternItem( "root@calendar=chinese", -3, "ren-chen-4-2", "ren-chen-4bis-2", "ren-chen-5-2" ),
new MonthPatternItem( "root@calendar=chinese", -4, "ren-chen 4 2", "ren-chen 4bis 2", "ren-chen 5 2" ),
new MonthPatternItem( "en@calendar=gregorian", -3, "2012-4-22", "2012-5-22", "2012-6-20" ),
new MonthPatternItem( "en@calendar=chinese", DateFormat.LONG, "ren-chen 4 2", "ren-chen 4bis 2", "ren-chen 5 2" ),
new MonthPatternItem( "en@calendar=chinese", DateFormat.SHORT, "29-4-2", "29-4bis-2", "29-5-2" ),
new MonthPatternItem( "en@calendar=chinese", DateFormat.LONG, "4 2, ren-chen", "4bis 2, ren-chen", "5 2, ren-chen" ),
new MonthPatternItem( "en@calendar=chinese", DateFormat.SHORT, "4/2/29", "4bis/2/29", "5/2/29" ),
new MonthPatternItem( "zh@calendar=chinese", DateFormat.LONG, "\u58EC\u8FB0\u5E74\u56DB\u6708\u4E8C\u65E5",
"\u58EC\u8FB0\u5E74\u95F0\u56DB\u6708\u4E8C\u65E5",
"\u58EC\u8FB0\u5E74\u4E94\u6708\u4E8C\u65E5" ),
@ -3943,7 +3943,7 @@ public class DateFormatTest extends com.ibm.icu.dev.test.TestFmwk {
new MonthPatternItem( "zh_Hant@calendar=chinese", DateFormat.LONG, "\u58EC\u8FB0\u5E74\u56DB\u6708\u4E8C\u65E5",
"\u58EC\u8FB0\u5E74\u958F\u56DB\u6708\u4E8C\u65E5",
"\u58EC\u8FB0\u5E74\u4E94\u6708\u4E8C\u65E5" ),
new MonthPatternItem( "zh_Hant@calendar=chinese", DateFormat.SHORT, "\u58EC\u8FB0-4-2", "\u58EC\u8FB0-\u958F4-2", "\u58EC\u8FB0-5-2" ),
new MonthPatternItem( "zh_Hant@calendar=chinese", DateFormat.SHORT, "\u58EC\u8FB0/4/2", "\u58EC\u8FB0/\u958F4/2", "\u58EC\u8FB0/5/2" ),
new MonthPatternItem( "fr@calendar=chinese", DateFormat.LONG, "2 s\u00ECyu\u00E8 ren-chen", "2 s\u00ECyu\u00E8bis ren-chen", "2 w\u01D4yu\u00E8 ren-chen" ),
new MonthPatternItem( "fr@calendar=chinese", DateFormat.SHORT, "2/4/29", "2/4bis/29", "2/5/29" ),
};

View File

@ -438,6 +438,24 @@ public class DateTimeGeneratorTest extends TestFmwk {
new String[] {"MMMEd", "\u0421\u0440, 13 \u044F\u043D\u0432."},
new String[] {"Ed", "\u0421\u0440, 13"},
new String[] {"jmmssSSS", "23:58:59,123"},
new ULocale("zh@calendar=chinese"),
new String[] {"yM", "\u620A\u5BC5\u5E7411\u6708"},
new String[] {"yMMM", "\u620A\u5BC5\u5E74\u5341\u4E00\u6708"},
new String[] {"yMd", "\u620A\u5BC5\u5E7411\u670826\u65E5"},
new String[] {"yMMMd", "\u620A\u5BC5\u5E74\u5341\u4E00\u670826\u65E5"},
new String[] {"Md", "11-26"},
new String[] {"MMMd", "\u5341\u4E00\u670826\u65E5"},
new String[] {"MMMMd", "\u5341\u4E00\u670826\u65E5"},
new String[] {"yQQQ", "\u620A\u5BC5\u5E744\u5B63"},
new String[] {"hhmm", "\u4E0B\u534811:58"},
new String[] {"HHmm", "23:58"},
new String[] {"jjmm", "\u4E0B\u534811:58"},
new String[] {"mmss", "58:59"},
new String[] {"yyyyMMMM", "\u620A\u5BC5\u5E74\u5341\u4E00\u6708"},
new String[] {"MMMEd", "\u5341\u4E00\u670826\u65E5\u5468\u4E09"},
new String[] {"Ed", "26\u65E5\u5468\u4E09"},
new String[] {"jmmssSSS", "\u4E0B\u534811:58:59.123"},
};
public void DayMonthTest() {