From 2e2e29c3e70abebaf4e56cadffeed37ccf862836 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 (cherry-picked from commit 38a0b85afd4231f46fac59e59ee38729bd5154c4) Change-Id: I1a369baeeac929ef010e7906e92544b9f483f02c --- luni/src/test/java/libcore/java/text/OldDateFormatTest.java | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'luni') diff --git a/luni/src/test/java/libcore/java/text/OldDateFormatTest.java b/luni/src/test/java/libcore/java/text/OldDateFormatTest.java index df388d3..1bd1d0c 100644 --- a/luni/src/test/java/libcore/java/text/OldDateFormatTest.java +++ b/luni/src/test/java/libcore/java/text/OldDateFormatTest.java @@ -86,6 +86,8 @@ public class OldDateFormatTest extends junit.framework.TestCase { */ public void test_formatLjava_util_Date() { try { + // This test assumes a default DateFormat.is24Hour setting. + DateFormat.is24Hour = null; DateFormat format = DateFormat.getDateTimeInstance( DateFormat.SHORT, DateFormat.SHORT, Locale.US); Date current = new Date(); @@ -104,6 +106,8 @@ public class OldDateFormatTest extends junit.framework.TestCase { */ public void test_formatLjava_lang_ObjectLjava_lang_StringBufferLjava_text_FieldPosition() { try { + // This test assumes a default DateFormat.is24Hour setting. + DateFormat.is24Hour = null; DateFormat format = DateFormat.getDateTimeInstance( DateFormat.SHORT, DateFormat.SHORT, Locale.US); Date current = new Date(); @@ -204,6 +208,8 @@ public class OldDateFormatTest extends junit.framework.TestCase { * java.text.DateFormat#parse(String) */ public void test_parseLString() throws Exception { + // This test assumes a default DateFormat.is24Hour setting. + DateFormat.is24Hour = null; DateFormat format = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, Locale.US); try { -- cgit v1.1