aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Burch <nick@apache.org>2014-07-30 19:02:09 +0000
committerNick Burch <nick@apache.org>2014-07-30 19:02:09 +0000
commit2ac5cfb33bb99b6c5ac670556794f354a19bfe19 (patch)
tree889a0cd424d2a20b2fe190dba464ec8e65f500fd
parenta7df4f8b92d9d7ba610bffda1193ac2b44f44a8a (diff)
downloadpoi-2ac5cfb33bb99b6c5ac670556794f354a19bfe19.tar.gz
poi-2ac5cfb33bb99b6c5ac670556794f354a19bfe19.zip
Unit test to show that bug #53494 has already been fixed
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1614741 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/testcases/org/apache/poi/ss/usermodel/TestDataFormatter.java26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/testcases/org/apache/poi/ss/usermodel/TestDataFormatter.java b/src/testcases/org/apache/poi/ss/usermodel/TestDataFormatter.java
index 20825e576e..06ad051a38 100644
--- a/src/testcases/org/apache/poi/ss/usermodel/TestDataFormatter.java
+++ b/src/testcases/org/apache/poi/ss/usermodel/TestDataFormatter.java
@@ -510,6 +510,32 @@ public class TestDataFormatter extends TestCase {
}
/**
+ * While we don't currently support using a locale code at
+ * the start of a format string to format it differently, we
+ * should at least handle it as it if wasn't there
+ */
+ public void testDatesWithLocales() {
+ DataFormatter dfUS = new DataFormatter(Locale.US, true);
+
+ String dateFormatEnglish = "[$-409]mmmm dd yyyy h:mm AM/PM";
+ String dateFormatChinese = "[$-804]mmmm dd yyyy h:mm AM/PM";
+
+ // Check we format the English one correctly
+ double date = 26995.477777777778;
+ assertEquals(
+ "November 27 1973 11:28 AM",
+ dfUS.formatRawCellContents(date, -1, dateFormatEnglish)
+ );
+
+ // Check that, in the absence of locale support, we handle
+ // the Chinese one the same as the English one
+ assertEquals(
+ "November 27 1973 11:28 AM",
+ dfUS.formatRawCellContents(date, -1, dateFormatChinese)
+ );
+ }
+
+ /**
* TODO Fix these so that they work
*/
public void DISABLEDtestCustomFormats() {