mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-08 06:53:45 +00:00
ICU-5134 fix regression test case JDK1.3 compatibility problem
X-SVN-Rev: 20093
This commit is contained in:
parent
8d03700669
commit
5344e1c8fd
2 changed files with 22 additions and 20 deletions
|
@ -12,6 +12,7 @@ src/com/ibm/icu/dev/test/format/NumberFormatTest.java
|
|||
src/com/ibm/icu/dev/test/format/NumberRegression.java
|
||||
src/com/ibm/icu/dev/test/format/RbnfTest.java
|
||||
src/com/ibm/icu/dev/test/timezone/TimeZoneAliasTest.java
|
||||
src/com/ibm/icu/dev/test/timezone/TimeZoneRegression.java
|
||||
src/com/ibm/icu/dev/test/util/ICUResourceBundleTest.java
|
||||
src/com/ibm/icu/dev/test/util/UtilityTest.java
|
||||
src/com/ibm/icu/dev/test/util/UnicodeMap.java
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
//##header
|
||||
/**
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2000-2006, International Business Machines Corporation and *
|
||||
|
@ -1005,7 +1006,7 @@ public class TimeZoneRegression extends TestFmwk {
|
|||
*/
|
||||
public void TestJ5134() {
|
||||
GregorianCalendar testCal = (GregorianCalendar)Calendar.getInstance();
|
||||
TimeZone icuEastern = TimeZone.getTimeZone("America/New_York");
|
||||
TimeZone icuEastern = TimeZone.getTimeZone("America/New_York");
|
||||
testCal.setTimeZone(icuEastern);
|
||||
testCal.set(1900, Calendar.JANUARY, 1, 0, 0, 0);
|
||||
long time = testCal.getTimeInMillis();
|
||||
|
@ -1019,28 +1020,28 @@ public class TimeZoneRegression extends TestFmwk {
|
|||
errln("FAIL: DST is observed in time zone America/New_York on Jan 1, 1900");
|
||||
}
|
||||
|
||||
//#ifndef FOUNDATION
|
||||
java.util.TimeZone jdkEastern = java.util.TimeZone.getTimeZone("America/New_York");
|
||||
if (!(jdkEastern instanceof java.util.SimpleTimeZone)) {
|
||||
// Compare offset and DST observation with JDK and ICU for 50 years since 1900
|
||||
testCal.add(Calendar.YEAR, 50);
|
||||
long endTime = testCal.getTimeInMillis();
|
||||
int jdkOffset;
|
||||
boolean isDstJdk;
|
||||
while (time < endTime) {
|
||||
offset = icuEastern.getOffset(time);
|
||||
jdkOffset = jdkEastern.getOffset(time);
|
||||
if (offset != jdkOffset) {
|
||||
errln("FAIL: Incompatible UTC offset -> JDK:" + jdkOffset + "/ICU:" + offset + " [" + time + "]");
|
||||
}
|
||||
Date d = new Date(time);
|
||||
isDst = icuEastern.inDaylightTime(d);
|
||||
isDstJdk = jdkEastern.inDaylightTime(d);
|
||||
if (isDst != isDstJdk) {
|
||||
errln("FAIL: Incompatible DST -> JDK:" + isDstJdk + "/ICU:" + isDst + " [" + time + "]");
|
||||
}
|
||||
time += 24*60*60*1000L; // increment 1 day
|
||||
// Compare offset and DST observation with JDK and ICU for 50 years since 1900
|
||||
testCal.add(Calendar.YEAR, 50);
|
||||
long endTime = testCal.getTimeInMillis();
|
||||
int jdkOffset;
|
||||
boolean isDstJdk;
|
||||
while (time < endTime) {
|
||||
offset = icuEastern.getOffset(time);
|
||||
jdkOffset = jdkEastern.getOffset(time);
|
||||
if (offset != jdkOffset) {
|
||||
errln("FAIL: Incompatible UTC offset -> JDK:" + jdkOffset + "/ICU:" + offset + " [" + time + "]");
|
||||
}
|
||||
Date d = new Date(time);
|
||||
isDst = icuEastern.inDaylightTime(d);
|
||||
isDstJdk = jdkEastern.inDaylightTime(d);
|
||||
if (isDst != isDstJdk) {
|
||||
errln("FAIL: Incompatible DST -> JDK:" + isDstJdk + "/ICU:" + isDst + " [" + time + "]");
|
||||
}
|
||||
time += 24*60*60*1000L; // increment 1 day
|
||||
}
|
||||
//#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue