]> granicus.if.org Git - icu/commitdiff
ICU-22201 Add test to verify ICU-22043 on Java
authorFrank Tang <ftang@chromium.org>
Wed, 22 Jun 2022 16:05:15 +0000 (09:05 -0700)
committerFrank Yung-Fong Tang <ftang@google.com>
Tue, 22 Nov 2022 01:42:16 +0000 (17:42 -0800)
icu4j/main/tests/core/src/com/ibm/icu/dev/test/calendar/CalendarRegressionTest.java

index 1d21f063305b4594f30094ccb7c7dd55cee053e2..936ebe4a6210345bdb06ee854aaadd5c0b5045ec 100644 (file)
@@ -2619,5 +2619,26 @@ public class CalendarRegressionTest extends com.ibm.icu.dev.test.TestFmwk {
                          TESTS[i][2], cal.getType());
         }
     }
+
+    void VerifyNoAssertWithSetGregorianChange(String timezone) {
+        TimeZone zone = TimeZone.getTimeZone(timezone);
+        GregorianCalendar cal = new GregorianCalendar(zone, Locale.ENGLISH);
+        cal.setTime(new Date());
+        // The beginning of ECMAScript time, namely -(2**53)
+        long startOfTime = -9007199254740992L;
+
+        cal.setGregorianChange(new Date(startOfTime));
+        cal.get(Calendar.ZONE_OFFSET);
+        cal.get(Calendar.DST_OFFSET);
+    }
+
+    @Test
+    public void TestAsiaManilaAfterSetGregorianChange22043() {
+        VerifyNoAssertWithSetGregorianChange("Asia/Manila");
+        for (String id : TimeZone.getAvailableIDs()) {
+            VerifyNoAssertWithSetGregorianChange(id);
+        }
+    }
+
 }
 //eof