aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2017-06-23 23:42:25 +0000
committerPJ Fanning <fanningpj@apache.org>2017-06-23 23:42:25 +0000
commit9856c7c6633e91767f5834ccd140897c89c83396 (patch)
tree492b9712e890f7c9597d266656930464b56215f4
parent8f0cea061eb5102a59bee0b2fe1c6c8754741f9e (diff)
downloadpoi-9856c7c6633e91767f5834ccd140897c89c83396.tar.gz
poi-9856c7c6633e91767f5834ccd140897c89c83396.zip
Bug 60422 add testtestcase with current LocaleUtil workaround
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1799721 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/testcases/org/apache/poi/ss/usermodel/TestDataFormatter.java21
1 files changed, 21 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 b4f3b7dde4..03b8398e3e 100644
--- a/src/testcases/org/apache/poi/ss/usermodel/TestDataFormatter.java
+++ b/src/testcases/org/apache/poi/ss/usermodel/TestDataFormatter.java
@@ -851,4 +851,25 @@ public class TestDataFormatter {
assertEquals("08:51", dfUS.formatRawCellContents(42605.368761574071, -1, "hh:mm"));
assertEquals("51:01", dfUS.formatRawCellContents(42605.368761574071, -1, "mm:ss"));
}
+
+ /**
+ * bug 60422 : DataFormatter has issues with a specific NumberFormat in Germany default locale
+ * Currently, this test only passes if you set LocaleUtil.setUserLocale(Locale.ROOT) or Locale.US.
+ */
+ @Test
+ public void testBug60422() {
+ Locale defaultLocale = Locale.getDefault();
+ Locale.setDefault(Locale.GERMANY);
+ LocaleUtil.setUserLocale(Locale.ROOT);
+ try {
+ char euro = '\u20AC';
+ DataFormatter df = new DataFormatter();
+ String formatString = String.format(
+ "_-* #,##0.00\\ \"%s\"_-;\\-* #,##0.00\\ \"%s\"_-;_-* \"-\"??\\ \"%s\"_-;_-@_-",
+ euro, euro, euro);
+ assertEquals("4.33 " + euro, df.formatRawCellContents(4.33, 178, formatString));
+ } finally {
+ Locale.setDefault(defaultLocale);
+ }
+ }
}