From 38a0b85afd4231f46fac59e59ee38729bd5154c4 Mon Sep 17 00:00:00 2001 From: Neil Fuller Date: Tue, 9 Jun 2015 16:19:32 +0100 Subject: Explicitly set DateFormat.is24Hour value needed by tests Some tests fail under CTS if the device is set to use the 24 hour clock. The tests that depend on the value of the setting are now being explicit. Bug: 20899571 Bug: 20937589 Bug: 20939139 Bug: 20378566 Bug: 21585934 Bug: https://code.google.com/p/android/issues/detail?id=162384 Change-Id: I0f03f54b76dc5d343a2c842434412ff59908b129 --- .../harmony/tests/java/text/MessageFormatTest.java | 3 +++ .../tests/java/text/Support_MessageFormat.java | 5 +++++ .../apache/harmony/tests/java/util/DateTest.java | 21 ++++++++++++--------- 3 files changed, 20 insertions(+), 9 deletions(-) (limited to 'harmony-tests/src/test') diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/java/text/MessageFormatTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/java/text/MessageFormatTest.java index 0920714..e666c97 100644 --- a/harmony-tests/src/test/java/org/apache/harmony/tests/java/text/MessageFormatTest.java +++ b/harmony-tests/src/test/java/org/apache/harmony/tests/java/text/MessageFormatTest.java @@ -184,6 +184,9 @@ public class MessageFormatTest extends TestCase { } public void test_parseLjava_lang_String() throws ParseException { + // This test assumes a default DateFormat.is24Hour setting. + DateFormat.is24Hour = null; + String pattern = "A {3, number, currency} B {2, time} C {0, number, percent} D {4} E {1,choice,0#off|1#on} F {0, date}"; MessageFormat mf = new MessageFormat(pattern); String sToParse = "A $12,345.00 B 9:56:07 AM C 3,200% D 1/15/70 9:56 AM E on F Jan 1, 1970"; diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/java/text/Support_MessageFormat.java b/harmony-tests/src/test/java/org/apache/harmony/tests/java/text/Support_MessageFormat.java index 8003b88..b8b0cee 100644 --- a/harmony-tests/src/test/java/org/apache/harmony/tests/java/text/Support_MessageFormat.java +++ b/harmony-tests/src/test/java/org/apache/harmony/tests/java/text/Support_MessageFormat.java @@ -44,6 +44,8 @@ public class Support_MessageFormat extends Support_Format { } public void t_format_with_FieldPosition() { + // This test assumes a default DateFormat.is24Hour setting. + DateFormat.is24Hour = null; String pattern = "On {4,date} at {3,time}, he ate {2,number, integer} hamburger{2,choice,1#|1