aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2021-07-28 18:38:21 +0000
committerPJ Fanning <fanningpj@apache.org>2021-07-28 18:38:21 +0000
commit956d58cfb4323ad7c6ce60ea0d228b8fd2de15d8 (patch)
treef667f15ce057d43f0e1669e81401946574aa8da7
parent01b94f181719814e1e1a1e84005cd21b61686e2e (diff)
downloadpoi-956d58cfb4323ad7c6ce60ea0d228b8fd2de15d8.tar.gz
poi-956d58cfb4323ad7c6ce60ea0d228b8fd2de15d8.zip
add broken (disabled) test to show issue with ISO 8601 format
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1891859 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--poi/src/main/java/org/apache/poi/ss/formula/functions/TextFunction.java4
-rw-r--r--poi/src/test/java/org/apache/poi/ss/formula/functions/TestText.java22
2 files changed, 23 insertions, 3 deletions
diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/TextFunction.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/TextFunction.java
index 449d6d7f35..b8b69c3e02 100644
--- a/poi/src/main/java/org/apache/poi/ss/formula/functions/TextFunction.java
+++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/TextFunction.java
@@ -352,8 +352,8 @@ public abstract class TextFunction implements Function {
}
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;
diff --git a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestText.java b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestText.java
index ddcdd35165..cbbfaad11f 100644
--- a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestText.java
+++ b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestText.java
@@ -29,6 +29,7 @@ import org.apache.poi.ss.formula.eval.NumberEval;
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);
+ }
+ }
+
}