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 2021/07/28 18:38:21 UTC

svn commit: r1891859 - in /poi/trunk/poi/src: main/java/org/apache/poi/ss/formula/functions/TextFunction.java test/java/org/apache/poi/ss/formula/functions/TestText.java

Author: fanningpj
Date: Wed Jul 28 18:38:21 2021
New Revision: 1891859

URL: http://svn.apache.org/viewvc?rev=1891859&view=rev
Log:
add broken (disabled) test to show issue with ISO 8601 format

Modified:
    poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/TextFunction.java
    poi/trunk/poi/src/test/java/org/apache/poi/ss/formula/functions/TestText.java

Modified: poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/TextFunction.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/TextFunction.java?rev=1891859&r1=1891858&r2=1891859&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/TextFunction.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/TextFunction.java Wed Jul 28 18:38:21 2021
@@ -352,8 +352,8 @@ public abstract class TextFunction imple
             }
 
             try {
-            // Ask DataFormatter to handle the String for us
-               String formattedStr = formatter.formatRawCellContents(s0, -1, s1);
+                // Ask DataFormatter to handle the String for us
+                String formattedStr = formatter.formatRawCellContents(s0, -1, s1);
                 return new StringEval(formattedStr);
             } catch (Exception e) {
                 return ErrorEval.VALUE_INVALID;

Modified: poi/trunk/poi/src/test/java/org/apache/poi/ss/formula/functions/TestText.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/test/java/org/apache/poi/ss/formula/functions/TestText.java?rev=1891859&r1=1891858&r2=1891859&view=diff
==============================================================================
--- poi/trunk/poi/src/test/java/org/apache/poi/ss/formula/functions/TestText.java (original)
+++ poi/trunk/poi/src/test/java/org/apache/poi/ss/formula/functions/TestText.java Wed Jul 28 18:38:21 2021
@@ -29,6 +29,7 @@ import org.apache.poi.ss.formula.eval.Nu
 import org.apache.poi.ss.formula.eval.StringEval;
 import org.apache.poi.ss.formula.eval.ValueEval;
 import org.apache.poi.util.LocaleUtil;
+import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 
 /**
@@ -45,7 +46,7 @@ final class TestText {
     }
 
     @Test
-    void testTextWithDeciamlFormatSecondArg() {
+    void testTextWithDecimalFormatSecondArg() {
         ValueEval numArg = new NumberEval(321321.321);
         ValueEval formatArg = new StringEval("#,###.00000");
         ValueEval[] args = { numArg, formatArg };
@@ -136,4 +137,23 @@ final class TestText {
             LocaleUtil.setUserTimeZone(userTZ);
         }
     }
+
+    @Disabled("see https://bz.apache.org/bugzilla/show_bug.cgi?id=65471")
+    @Test
+    void testTextWithISODateTimeFormatSecondArg() {
+        TimeZone userTZ = LocaleUtil.getUserTimeZone();
+        LocaleUtil.setUserTimeZone(TimeZone.getTimeZone("CET"));
+        try {
+            // Test with Java style M=Month
+            ValueEval numArg = new NumberEval(321.321);
+            ValueEval formatArg = new StringEval("yyyy-mm-ddThh:MM:ss");
+            ValueEval[] args = { numArg, formatArg };
+            ValueEval result = TextFunction.TEXT.evaluate(args, -1, (short)-1);
+            ValueEval testResult = new StringEval("1900-11-16T07:42:14");
+            assertEquals(testResult.toString(), result.toString());
+        } finally {
+            LocaleUtil.setUserTimeZone(userTZ);
+        }
+    }
+
 }



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