You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by fa...@apache.org on 2017/06/23 23:42:26 UTC

svn commit: r1799721 - /poi/trunk/src/testcases/org/apache/poi/ss/usermodel/TestDataFormatter.java

Author: fanningpj
Date: Fri Jun 23 23:42:25 2017
New Revision: 1799721

URL: http://svn.apache.org/viewvc?rev=1799721&view=rev
Log:
Bug 60422 add testtestcase with current LocaleUtil workaround

Modified:
    poi/trunk/src/testcases/org/apache/poi/ss/usermodel/TestDataFormatter.java

Modified: poi/trunk/src/testcases/org/apache/poi/ss/usermodel/TestDataFormatter.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ss/usermodel/TestDataFormatter.java?rev=1799721&r1=1799720&r2=1799721&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/ss/usermodel/TestDataFormatter.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/ss/usermodel/TestDataFormatter.java Fri Jun 23 23:42:25 2017
@@ -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);
+        }
+    }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org