From e833477ed6d37a8cb4568be80579174e5aa62d8e Mon Sep 17 00:00:00 2001 From: John Emmons Date: Mon, 9 May 2011 17:15:27 +0000 Subject: [PATCH] ICU-7427 Add testcase to cover leap year incrementing X-SVN-Rev: 30064 --- .../ibm/icu/dev/test/calendar/IslamicTest.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/calendar/IslamicTest.java b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/calendar/IslamicTest.java index 00e44c3d6d..b2b2496e46 100644 --- a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/calendar/IslamicTest.java +++ b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/calendar/IslamicTest.java @@ -1,6 +1,6 @@ /* ******************************************************************************* - * Copyright (C) 1996-2010, International Business Machines Corporation and * + * Copyright (C) 1996-2011, International Business Machines Corporation and * * others. All Rights Reserved. * ******************************************************************************* */ @@ -155,6 +155,19 @@ public class IslamicTest extends CalendarTest { doTheoreticalLimitsTest(islamic2, true); } + public void Test7427() { + // Test the add month in a leap year problem as reported in ticket #7427 + IslamicCalendar cal = new IslamicCalendar(); + cal.clear(); + cal.set(IslamicCalendar.YEAR,1431); + cal.set(IslamicCalendar.MONTH, IslamicCalendar.DHU_AL_HIJJAH); + cal.add(IslamicCalendar.MONTH,1); + if ( cal.get(IslamicCalendar.MONTH) != IslamicCalendar.MUHARRAM || + ( cal.get(IslamicCalendar.YEAR) != 1432 )) { + errln("Error incrementing month at the end of a leap year. Expected Month:0 Year:1432 - Got Month:" + + cal.get(IslamicCalendar.MONTH) + " Year:" + cal.get(IslamicCalendar.YEAR)); + } + } public void TestCoverage() { { // new IslamicCalendar(TimeZone)