diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2009-03-11 12:11:54 -0700 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-03-11 12:11:54 -0700 |
commit | ab28398a565e5ce8a56cdfd50ac6226e5317cf66 (patch) | |
tree | 589d7add2659de2974805a9def858204999f1fa7 /text | |
parent | 7a237c50c718d326c49da2a449ba6eb0c668837a (diff) | |
download | libcore-ab28398a565e5ce8a56cdfd50ac6226e5317cf66.zip libcore-ab28398a565e5ce8a56cdfd50ac6226e5317cf66.tar.gz libcore-ab28398a565e5ce8a56cdfd50ac6226e5317cf66.tar.bz2 |
auto import from //branches/cupcake/...@137873
Diffstat (limited to 'text')
6 files changed, 54 insertions, 56 deletions
diff --git a/text/src/test/java/org/apache/harmony/text/tests/java/text/BidiTest.java b/text/src/test/java/org/apache/harmony/text/tests/java/text/BidiTest.java index 6562019..e3ea9dc 100644 --- a/text/src/test/java/org/apache/harmony/text/tests/java/text/BidiTest.java +++ b/text/src/test/java/org/apache/harmony/text/tests/java/text/BidiTest.java @@ -1728,7 +1728,7 @@ public class BidiTest extends TestCase { ) public void testCreateLineBidiInvalid() { // regression for HARMONY-1050 - Bidi bidi = new Bidi("str", 1); + Bidi bidi = new Bidi("str", Bidi.DIRECTION_RIGHT_TO_LEFT); try { bidi.createLineBidi(-1, 1); fail("Expected IAE"); @@ -1775,7 +1775,7 @@ public class BidiTest extends TestCase { ) @KnownFailure("Is this a failure or just a different behaviour of ICU?") public void testCreateLineBidi_AndroidFailure() { - Bidi bidi = new Bidi("str", 1); + Bidi bidi = new Bidi("str", Bidi.DIRECTION_RIGHT_TO_LEFT); bidi.createLineBidi(2, 2); } diff --git a/text/src/test/java/org/apache/harmony/text/tests/java/text/CollatorTest.java b/text/src/test/java/org/apache/harmony/text/tests/java/text/CollatorTest.java index 04a2b47..161a2c5 100644 --- a/text/src/test/java/org/apache/harmony/text/tests/java/text/CollatorTest.java +++ b/text/src/test/java/org/apache/harmony/text/tests/java/text/CollatorTest.java @@ -353,14 +353,14 @@ public class CollatorTest extends junit.framework.TestCase { method = "setDecomposition", args = {int.class} ) - @KnownFailure("Already fixed?") + @KnownFailure("uses decomposition even if set to NO_DECOMPOSITION") public void test_setDecompositionI() { Collator c = Collator.getInstance(Locale.FRENCH); c.setStrength(Collator.IDENTICAL); c.setDecomposition(Collator.NO_DECOMPOSITION); - assertTrue("Collator should not be using decomposition", !c.equals( + assertFalse("Collator should not be using decomposition", c.equals( "\u212B", "\u00C5")); // "ANGSTROM SIGN" and "LATIN CAPITAL - // LETTER A WITH RING ABOVE" + // LETTER A WITH RING ABOVE" c.setDecomposition(Collator.CANONICAL_DECOMPOSITION); assertTrue("Collator should be using decomposition", c.equals("\u212B", "\u00C5")); // "ANGSTROM SIGN" and "LATIN CAPITAL LETTER A WITH diff --git a/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatSymbolsTest.java b/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatSymbolsTest.java index 2998eb6..1b2d8bb 100644 --- a/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatSymbolsTest.java +++ b/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatSymbolsTest.java @@ -18,7 +18,6 @@ package org.apache.harmony.text.tests.java.text; import dalvik.annotation.AndroidOnly; -import dalvik.annotation.BrokenTest; import dalvik.annotation.KnownFailure; import dalvik.annotation.TestLevel; import dalvik.annotation.TestTargetClass; @@ -152,7 +151,6 @@ public class DecimalFormatSymbolsTest extends TestCase { assertTrue("Returned incorrect currency", dfsUS.getCurrency() == currency); - // BEGIN android-changed // use cs_CZ instead //Currency currK = Currency.getInstance("KRW"); Currency currC = Currency.getInstance("CZK"); @@ -186,7 +184,6 @@ public class DecimalFormatSymbolsTest extends TestCase { dfs1.getInternationalCurrencySymbol()); dfs1 = new DecimalFormatSymbols(new Locale("de", "AT")); - // END android-changed assertTrue("Test4: Returned incorrect currency", dfs1.getCurrency() == currE); assertEquals("Test4: Returned incorrect currencySymbol", "\u20ac", dfs1 @@ -417,10 +414,8 @@ public class DecimalFormatSymbolsTest extends TestCase { assertTrue("Hash codes of equal object are equal", dfs2 .hashCode() == dfs1.hashCode()); dfs1.setInfinity("infinity_infinity"); - // BEGIN android-changed assertTrue("Hash codes of non-equal objects are equal", dfs2 .hashCode() != dfs1.hashCode()); - // END android-changed } catch (Exception e) { fail("Unexpected exception " + e.toString()); } @@ -545,7 +540,7 @@ public class DecimalFormatSymbolsTest extends TestCase { method = "setInternationalCurrencySymbol", args = {java.lang.String.class} ) - @KnownFailure("getCurrency() doesn't return null. Test passes on RI.") + @KnownFailure("getCurrency() doesn't return null for bogus currency code.") public void test_setInternationalCurrencySymbolLjava_lang_String() { Locale locale = Locale.CANADA; DecimalFormatSymbols dfs = ((DecimalFormat) NumberFormat @@ -734,7 +729,7 @@ public class DecimalFormatSymbolsTest extends TestCase { method = "!SerializationGolden", args = {} ) - @BrokenTest("Deserialized object is not equal to the original object." + + @KnownFailure("Deserialized object is not equal to the original object." + "Test passes on RI.") public void test_RIHarmony_compatible() throws Exception { ObjectInputStream i = null; diff --git a/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatTest.java b/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatTest.java index 4ff54d0..a5ff158 100644 --- a/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatTest.java +++ b/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatTest.java @@ -662,10 +662,11 @@ public class DecimalFormatTest extends TestCase { method = "getMinimumIntegerDigits", args = {} ) - @KnownFailure("Something seems wrong with Android implementation, here!") - public void test_getMaximumIntegerDigits_AndroidFailure() { + @AndroidOnly("second 0 needs to be quoted in icu." + + "(quoting special characters in prefix and suffix necessary)") + public void test_getMaximumIntegerDigits2() { // regression test for HARMONY-878 - assertTrue(new DecimalFormat("0\t0").getMaximumIntegerDigits() > 0); + assertTrue(new DecimalFormat("0\t'0'").getMaximumIntegerDigits() > 0); } @TestTargetNew( @@ -1412,23 +1413,28 @@ public class DecimalFormatTest extends TestCase { method = "applyPattern", args = {java.lang.String.class} ) - @KnownFailure("Something seems wrong with Android implementation, here!") - public void test_applyPatternLjava_lang_String_AndroidFailure() { + @AndroidOnly("icu supports 2 grouping sizes.") + public void test_applyPatternLjava_lang_String2() { DecimalFormat decFormat = new DecimalFormat("#.#"); String [] patterns = {"####.##", "######.######", "000000.000000", "######.000000", "000000.######", " ###.###", "$#####.######", "$$####.######", "%#,##,###,####", "#,##0.00;(#,##0.00)", "##.##-E"}; - String [] expResult = {"#0.##", "#0.######", "#000000.000000", + String [] expResult = {"#0.##", "#0.######", "#000000.000000", "#.000000", "#000000.######", " #0.###", "$#0.######", - "$$#0.######", "%#,####", "#,##0.00;(#,##0.00)", - "#0.##-E"}; + "$$#0.######", + "%#,###,####", // icu only. icu supports two grouping sizes + "#,##0.00;(#,##0.00)", + "#0.##-'E'"}; // icu only. E in the suffix does not need to be + // quoted. This is done automatically. for (int i = 0; i < patterns.length; i++) { decFormat.applyPattern(patterns[i]); - assertEquals("Failed to apply following pattern: " + patterns[i], - expResult[i], decFormat.toPattern()); + String result = decFormat.toPattern(); + assertEquals("Failed to apply following pattern: " + patterns[i] + + " expected: " + expResult[i] + " returned: " + result, + expResult[i], result); } } @@ -2428,6 +2434,7 @@ public class DecimalFormatTest extends TestCase { method = "!SerializationGolden", args = {} ) + @KnownFailure("a regression. This didn't fail before") public void test_serializationHarmonyRICompatible() { NumberFormat nf = NumberFormat.getInstance(Locale.FRANCE); diff --git a/text/src/test/java/org/apache/harmony/text/tests/java/text/RuleBasedCollatorTest.java b/text/src/test/java/org/apache/harmony/text/tests/java/text/RuleBasedCollatorTest.java index 7cdd164..3c864a5 100644 --- a/text/src/test/java/org/apache/harmony/text/tests/java/text/RuleBasedCollatorTest.java +++ b/text/src/test/java/org/apache/harmony/text/tests/java/text/RuleBasedCollatorTest.java @@ -18,7 +18,6 @@ package org.apache.harmony.text.tests.java.text; import dalvik.annotation.AndroidOnly; -import dalvik.annotation.BrokenTest; import dalvik.annotation.KnownFailure; import dalvik.annotation.TestLevel; import dalvik.annotation.TestTargetClass; @@ -151,7 +150,6 @@ public class RuleBasedCollatorTest extends TestCase { method = "equals", args = {java.lang.Object.class} ) - @KnownFailure("Succeeds against RI.") public void testEqualsObject() throws ParseException { String rule = "< a < b < c < d < e"; RuleBasedCollator coll = new RuleBasedCollator(rule); @@ -282,17 +280,17 @@ public class RuleBasedCollatorTest extends TestCase { method = "getCollationElementIterator", args = {java.text.CharacterIterator.class} ) - @KnownFailure("Succeeds against RI.") + @KnownFailure("ICU seems to miss collation data") public void testGetCollationElementIteratorCharacterIterator() throws Exception { { - Locale locale = new Locale("es", "", "TRADITIONAL"); + Locale locale = new Locale("cs", "CZ", ""); RuleBasedCollator coll = (RuleBasedCollator) Collator .getInstance(locale); String text = "cha"; StringCharacterIterator source = new StringCharacterIterator(text); CollationElementIterator iterator = coll .getCollationElementIterator(source); - int[] e_offset = { 0, 1, 2 }; + int[] e_offset = { 0, 2 }; int offset = iterator.getOffset(); int i = 0; assertEquals(e_offset[i++], offset); @@ -407,7 +405,6 @@ public class RuleBasedCollatorTest extends TestCase { method = "getAvailableLocales", args = {} ) - @KnownFailure("Succeeds against RI.") public void testGetAvaiableLocales() { Locale[] locales = Collator.getAvailableLocales(); boolean isUS = false; diff --git a/text/src/test/java/org/apache/harmony/text/tests/java/text/SimpleDateFormatTest.java b/text/src/test/java/org/apache/harmony/text/tests/java/text/SimpleDateFormatTest.java index 821808f..286f080 100644 --- a/text/src/test/java/org/apache/harmony/text/tests/java/text/SimpleDateFormatTest.java +++ b/text/src/test/java/org/apache/harmony/text/tests/java/text/SimpleDateFormatTest.java @@ -17,7 +17,6 @@ package org.apache.harmony.text.tests.java.text; import dalvik.annotation.AndroidOnly; -import dalvik.annotation.BrokenTest; import dalvik.annotation.KnownFailure; import dalvik.annotation.TestLevel; import dalvik.annotation.TestTargetClass; @@ -470,7 +469,8 @@ public class SimpleDateFormatTest extends junit.framework.TestCase { ) @KnownFailure("SimpleDateFormat.format(Date date, " + "StringBuffer toAppendTo, FieldPosition pos) " + - "return incorrect week number for \" W\" pattern. ") + "return incorrect week number for \" W\" pattern. " + + "Also Android doesn't support formatting of PST, EST, ...") public void test_formatLjava_util_DateLjava_lang_StringBufferLjava_text_FieldPosition() { // Test for method java.lang.StringBuffer // java.text.SimpleDateFormat.format(java.util.Date, @@ -607,20 +607,6 @@ public class SimpleDateFormatTest extends junit.framework.TestCase { " 0", DateFormat.HOUR0_FIELD); test.test(" KK", cal, " 03", DateFormat.HOUR0_FIELD); test.test(" KKKK", cal, " 0003", DateFormat.HOUR0_FIELD); - -// Android doesn't support EST/EDT time zones -// format.setTimeZone(TimeZone.getTimeZone("EST")); -// test.test(" z", cal, " EDT", DateFormat.TIMEZONE_FIELD); -// Calendar temp2 = new GregorianCalendar(1999, Calendar.JANUARY, 12); -// test.test(" z", temp2, " EST", DateFormat.TIMEZONE_FIELD); -// test.test(" zz", cal, " EDT", DateFormat.TIMEZONE_FIELD); -// test.test(" zzz", cal, " EDT", DateFormat.TIMEZONE_FIELD); -// test.test(" zzzz", cal, " Eastern Daylight Time", -// DateFormat.TIMEZONE_FIELD); -// test.test(" zzzz", temp2, " Eastern Standard Time", -// DateFormat.TIMEZONE_FIELD); -// test.test(" zzzzz", cal, " Eastern Daylight Time", -// DateFormat.TIMEZONE_FIELD); format.setTimeZone(new SimpleTimeZone(60000, "ONE MINUTE")); test.test(" z", cal, " GMT+00:01", DateFormat.TIMEZONE_FIELD); @@ -647,6 +633,19 @@ public class SimpleDateFormatTest extends junit.framework.TestCase { } catch (Throwable ex) { fail("Expected test to throw NPE, not " + ex.getClass().getName()); } + + format.setTimeZone(TimeZone.getTimeZone("EST")); + test.test(" z", cal, " EDT", DateFormat.TIMEZONE_FIELD); + Calendar temp2 = new GregorianCalendar(1999, Calendar.JANUARY, 12); + test.test(" z", temp2, " EST", DateFormat.TIMEZONE_FIELD); + test.test(" zz", cal, " EDT", DateFormat.TIMEZONE_FIELD); + test.test(" zzz", cal, " EDT", DateFormat.TIMEZONE_FIELD); + test.test(" zzzz", cal, " Eastern Daylight Time", + DateFormat.TIMEZONE_FIELD); + test.test(" zzzz", temp2, " Eastern Standard Time", + DateFormat.TIMEZONE_FIELD); + test.test(" zzzzz", cal, " Eastern Daylight Time", + DateFormat.TIMEZONE_FIELD); } /** @@ -672,6 +671,7 @@ public class SimpleDateFormatTest extends junit.framework.TestCase { args = {java.lang.String.class} ) }) + @KnownFailure("Android doesn't support formatting of PST, EST, ...") public void test_timeZoneFormatting() { // tests specific to formatting of timezones Date summerDate = new GregorianCalendar(1999, Calendar.JUNE, 2, 15, 3, @@ -681,33 +681,32 @@ public class SimpleDateFormatTest extends junit.framework.TestCase { TestFormat test = new TestFormat( "test_formatLjava_util_DateLjava_lang_StringBufferLjava_text_FieldPosition"); -// Android doesn't support this time zone -// test.verifyFormatTimezone("PST", "PDT, Pacific Daylight Time", -// "-0700, -0700", summerDate); -// test.verifyFormatTimezone("PST", "PST, Pacific Standard Time", -// "-0800, -0800", winterDate); - test.verifyFormatTimezone("GMT-7", "GMT-07:00, GMT-07:00", "-0700, -0700", summerDate); test.verifyFormatTimezone("GMT-7", "GMT-07:00, GMT-07:00", "-0700, -0700", winterDate); - // Pacific/Kiritimati is one of the timezones supported only in mJava + // Pacific/Kiritimati is one of the timezones supported only in Java // Android doesn't support this time zone // test.verifyFormatTimezone("Pacific/Kiritimati", "LINT, Line Is. Time", // "+1400, +1400", summerDate); // test.verifyFormatTimezone("Pacific/Kiritimati", "LINT, Line Is. Time", // "+1400, +1400", winterDate); -// test.verifyFormatTimezone("EDT", "EDT, Eastern Daylight Time", -// "-0400, -0400", summerDate); -// test.verifyFormatTimezone("EST", "EST, Eastern Standard Time", -// "-0500, -0500", winterDate); - test.verifyFormatTimezone("GMT+14", "GMT+14:00, GMT+14:00", "+1400, +1400", summerDate); test.verifyFormatTimezone("GMT+14", "GMT+14:00, GMT+14:00", "+1400, +1400", winterDate); + + test.verifyFormatTimezone("PST", "PDT, Pacific Daylight Time", + "-0700, -0700", summerDate); + test.verifyFormatTimezone("PST", "PST, Pacific Standard Time", + "-0800, -0800", winterDate); + + test.verifyFormatTimezone("EDT", "EDT, Eastern Daylight Time", + "-0400, -0400", summerDate); + test.verifyFormatTimezone("EST", "EST, Eastern Standard Time", + "-0500, -0500", winterDate); } /** |