summaryrefslogtreecommitdiffstats
path: root/android_icu4j/src/main/tests/android
diff options
context:
space:
mode:
Diffstat (limited to 'android_icu4j/src/main/tests/android')
-rw-r--r--android_icu4j/src/main/tests/android/icu/dev/test/bidi/TestBidi.java20
-rw-r--r--android_icu4j/src/main/tests/android/icu/dev/test/format/ListFormatterTest.java34
2 files changed, 52 insertions, 2 deletions
diff --git a/android_icu4j/src/main/tests/android/icu/dev/test/bidi/TestBidi.java b/android_icu4j/src/main/tests/android/icu/dev/test/bidi/TestBidi.java
index 88dee912a..dda7e7718 100644
--- a/android_icu4j/src/main/tests/android/icu/dev/test/bidi/TestBidi.java
+++ b/android_icu4j/src/main/tests/android/icu/dev/test/bidi/TestBidi.java
@@ -529,7 +529,7 @@ public class TestBidi extends BidiFmwk {
bidi.setReorderingMode(Bidi.REORDER_RUNS_ONLY);
bidi.setPara("a \u05d0 b \u05d1 c \u05d2 d ", Bidi.LTR, null);
assertEquals("\nWrong number of runs #4", 14, bidi.countRuns());
-
+
/* test testGetBaseDirection to verify fast string direction detection function */
/* mixed start with L */
String mixedEnglishFirst = "\u0061\u0627\u0032\u06f3\u0061\u0034";
@@ -569,7 +569,7 @@ public class TestBidi extends BidiFmwk {
assertEquals("\nWrong direction through fast detection #12", Bidi.NEUTRAL, Bidi.getBaseDirection(allArabicDigits));
/* null string */
String nullString = null;
- assertEquals("\nWrong direction through fast detection #13", Bidi.NEUTRAL, Bidi.getBaseDirection(nullString));
+ assertEquals("\nWrong direction through fast detection #13", Bidi.NEUTRAL, Bidi.getBaseDirection(nullString));
/* first L (English) others are R (Hebrew etc.) */
String startEnglishOthersHebrew = "\u0071\u0590\u05D5\u05EA\u05F1";
assertEquals("\nWrong direction through fast detection #14", Bidi.LTR, Bidi.getBaseDirection(startEnglishOthersHebrew));
@@ -577,4 +577,20 @@ public class TestBidi extends BidiFmwk {
String lastHebrewOthersEnglishDigit = "\u0031\u0032\u0033\u05F1";
assertEquals("\nWrong direction through fast detection #15", Bidi.RTL, Bidi.getBaseDirection(lastHebrewOthersEnglishDigit));
}
+
+ @Test
+ public void testExplicitLevel0() {
+ // The following used to fail with an error, see ICU ticket #12922.
+ String text = "\u202d\u05d0";
+ byte[] embeddings = new byte[2]; // all 0
+ int flags = Bidi.DIRECTION_DEFAULT_LEFT_TO_RIGHT; // 0x7e
+ Bidi bidi = new Bidi(text.toCharArray(), 0, embeddings, 0, text.length(), flags);
+ assertEquals("resolved level at 0", 1, bidi.getLevelAt(0));
+ assertEquals("resolved level at 1", 1, bidi.getLevelAt(1));
+
+ flags = java.text.Bidi.DIRECTION_DEFAULT_LEFT_TO_RIGHT; // -2
+ java.text.Bidi jb = new java.text.Bidi(text.toCharArray(), 0, embeddings, 0, text.length(), flags);
+ assertEquals("java.text resolved level at 0", 1, jb.getLevelAt(0));
+ assertEquals("java.text resolved level at 1", 1, jb.getLevelAt(1));
+ }
}
diff --git a/android_icu4j/src/main/tests/android/icu/dev/test/format/ListFormatterTest.java b/android_icu4j/src/main/tests/android/icu/dev/test/format/ListFormatterTest.java
index 00ad5a108..7332a7f03 100644
--- a/android_icu4j/src/main/tests/android/icu/dev/test/format/ListFormatterTest.java
+++ b/android_icu4j/src/main/tests/android/icu/dev/test/format/ListFormatterTest.java
@@ -56,6 +56,40 @@ public class ListFormatterTest extends TestFmwk {
}
}
+ // Tests resource loading and inheritance when region sublocale
+ // has only partial data for the listPattern element (overriding
+ // some of the parent data). #12994
+ String[] EnglishGBTestData = {
+ "",
+ "A",
+ "A and B",
+ "A, B and C",
+ "A, B, C and D",
+ "A, B, C, D and E"
+ };
+
+ @Test
+ public void TestEnglishGB() {
+ checkData(ListFormatter.getInstance(new ULocale("en_GB")), EnglishGBTestData);
+ }
+
+ // Tests resource loading and inheritance when region sublocale
+ // has only partial data for the listPattern element (overriding
+ // some of the parent data). #12994
+ String[] ChineseTradHKTestData = {
+ "",
+ "A",
+ "A\u53CAB",
+ "A\u3001B\u53CAC",
+ "A\u3001B\u3001C\u53CAD",
+ "A\u3001B\u3001C\u3001D\u53CAE"
+ };
+
+ @Test
+ public void TestChineseTradHK() {
+ checkData(ListFormatter.getInstance(new ULocale("zh_Hant_HK")), ChineseTradHKTestData);
+ }
+
String[] JapaneseTestData = {
"",
"A",