Merge "Make libcore tests pass on MTS on S devices"
diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/CharacterTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/CharacterTest.java
index 944dd03..74bd62d 100644
--- a/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/CharacterTest.java
+++ b/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/CharacterTest.java
@@ -16,6 +16,7 @@
package org.apache.harmony.tests.java.lang;
+import android.icu.util.VersionInfo;
import java.util.Arrays;
import junit.framework.TestCase;
@@ -753,7 +754,9 @@
assertTrue(Character.getType(0x2FFFF) == Character.UNASSIGNED);
assertTrue(Character.getType(0x3134B) == Character.UNASSIGNED);
- assertTrue(Character.getType(0x9FFF) == Character.OTHER_LETTER);
+ byte charType9FFF = VersionInfo.ICU_VERSION.getMajor() >= 70 ? Character.OTHER_LETTER
+ : Character.UNASSIGNED;
+ assertTrue(Character.getType(0x9FFF) == charType9FFF);
assertTrue(Character.getType(0x110000) == Character.UNASSIGNED);
assertTrue(Character.getType(0x0041) == Character.UPPERCASE_LETTER);
diff --git a/luni/src/test/java/libcore/java/text/SimpleDateFormatTest.java b/luni/src/test/java/libcore/java/text/SimpleDateFormatTest.java
index 0291254..4d90116 100644
--- a/luni/src/test/java/libcore/java/text/SimpleDateFormatTest.java
+++ b/luni/src/test/java/libcore/java/text/SimpleDateFormatTest.java
@@ -16,6 +16,7 @@
package libcore.java.text;
+import android.icu.util.VersionInfo;
import libcore.util.Nullable;
import java.text.DateFormat;
import java.text.DateFormatSymbols;
@@ -592,7 +593,10 @@
String timeZonePattern = "zzzz";
int timeZoneStyle = TimeZone.LONG;
doTestFormat(Locale.ENGLISH, timeZoneStyle, timeZonePattern, "Coordinated Universal Time");
- doTestFormat(Locale.FRANCE, timeZoneStyle, timeZonePattern, "temps universel coordonné");
+ doTestFormat(Locale.FRANCE, timeZoneStyle, timeZonePattern,
+ VersionInfo.ICU_VERSION.getMajor() >= 70
+ ? "temps universel coordonné"
+ : "Temps universel coordonné");
doTestFormat(Locale.SIMPLIFIED_CHINESE, timeZoneStyle, timeZonePattern, "协调世界时");
}
@@ -632,7 +636,9 @@
doUtcParsingTest(Locale.ENGLISH, timeZonePattern, timeZoneStyle,
"Coordinated Universal Time");
doUtcParsingTest(Locale.FRENCH, timeZonePattern, timeZoneStyle,
- "temps universel coordonné");
+ VersionInfo.ICU_VERSION.getMajor() >= 70
+ ? "temps universel coordonné"
+ : "Temps universel coordonné");
doUtcParsingTest(Locale.SIMPLIFIED_CHINESE, timeZonePattern, timeZoneStyle,
"协调世界时");
}
diff --git a/luni/src/test/java/libcore/libcore/icu/DateIntervalFormatTest.java b/luni/src/test/java/libcore/libcore/icu/DateIntervalFormatTest.java
index 962f728..c4fcfa0 100644
--- a/luni/src/test/java/libcore/libcore/icu/DateIntervalFormatTest.java
+++ b/luni/src/test/java/libcore/libcore/icu/DateIntervalFormatTest.java
@@ -20,6 +20,7 @@
import android.icu.util.TimeZone;
import android.icu.util.ULocale;
+import android.icu.util.VersionInfo;
import java.util.function.BiFunction;
import static android.icu.util.TimeZone.GMT_ZONE;
@@ -36,6 +37,10 @@
// These are the old CTS tests for DateIntervalFormat.formatDateRange.
public void test_formatDateInterval() throws Exception {
+ // Require min ICU version 70 to provide the expected locale data.
+ if (VersionInfo.ICU_VERSION.getMajor() < 70) {
+ return;
+ }
TimeZone tz = TimeZone.getTimeZone("America/Los_Angeles");
Calendar c = Calendar.getInstance(tz, ULocale.US);
diff --git a/luni/src/test/java/libcore/libcore/icu/LocaleDataTest.java b/luni/src/test/java/libcore/libcore/icu/LocaleDataTest.java
index dda210e..c01583c 100644
--- a/luni/src/test/java/libcore/libcore/icu/LocaleDataTest.java
+++ b/luni/src/test/java/libcore/libcore/icu/LocaleDataTest.java
@@ -23,6 +23,7 @@
import android.icu.text.DateTimePatternGenerator;
+import android.icu.util.VersionInfo;
import java.text.DateFormat;
import java.text.DateFormatSymbols;
import java.text.DecimalFormatSymbols;
@@ -35,6 +36,7 @@
import libcore.icu.LocaleData;
import libcore.junit.util.SwitchTargetSdkVersionRule;
+import org.junit.Assume;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestRule;
@@ -87,6 +89,7 @@
@Test
public void test_ru_RU() throws Exception {
+ Assume.assumeTrue("Require min ICU version 70", VersionInfo.ICU_VERSION.getMajor() >= 70);
LocaleData l = LocaleData.get(new Locale("ru", "RU"));
assertEquals("воскресенье", l.longWeekdayNames[1]);
diff --git a/luni/src/test/resources/libcore/java/nio/charset/encodings_ISO-8859-1.txt b/luni/src/test/resources/libcore/java/nio/charset/encodings_ISO-8859-1.txt
index 41b5236..432d7d6 100644
--- a/luni/src/test/resources/libcore/java/nio/charset/encodings_ISO-8859-1.txt
+++ b/luni/src/test/resources/libcore/java/nio/charset/encodings_ISO-8859-1.txt
@@ -6160,8 +6160,9 @@
6156:true:
6157:true:
6158:true:
+# Disable the test U+180F as the property change
# U+180F Mongolian Nonspacing Mark
-6159:true:
+# 6159:true:
6160:false:
6161:false:
6162:false:
diff --git a/luni/src/test/resources/libcore/java/nio/charset/encodings_US-ASCII.txt b/luni/src/test/resources/libcore/java/nio/charset/encodings_US-ASCII.txt
index 17b4965..9862932 100644
--- a/luni/src/test/resources/libcore/java/nio/charset/encodings_US-ASCII.txt
+++ b/luni/src/test/resources/libcore/java/nio/charset/encodings_US-ASCII.txt
@@ -6160,8 +6160,9 @@
6156:true:
6157:true:
6158:true:
+# Disable the test U+180F as the property change
# U+180F Mongolian Nonspacing Mark
-6159:true:
+# 6159:true:
6160:false:
6161:false:
6162:false:
diff --git a/ojluni/src/test/java/time/test/java/time/format/TestDateTimeFormatterBuilder.java b/ojluni/src/test/java/time/test/java/time/format/TestDateTimeFormatterBuilder.java
index 3d4b1a1..fad6c81 100644
--- a/ojluni/src/test/java/time/test/java/time/format/TestDateTimeFormatterBuilder.java
+++ b/ojluni/src/test/java/time/test/java/time/format/TestDateTimeFormatterBuilder.java
@@ -67,6 +67,7 @@
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
+import android.icu.util.VersionInfo;
import java.text.ParsePosition;
import java.time.LocalDate;
import java.time.YearMonth;
@@ -979,6 +980,10 @@
@Test(dataProvider="localePatterns")
public void test_getLocalizedDateTimePattern(FormatStyle dateStyle, FormatStyle timeStyle,
Chronology chrono, Locale locale, String expected) {
+ // Android-changed: Require ICU 70 to pass the test due to CLDR data change
+ if (VersionInfo.ICU_VERSION.getMajor() < 70) {
+ return;
+ }
String actual = DateTimeFormatterBuilder.getLocalizedDateTimePattern(dateStyle, timeStyle, chrono, locale);
assertEquals(actual, expected, "Pattern " + convertNonAscii(actual));
}