aboutsummaryrefslogtreecommitdiffstats
path: root/src/testcases/org/apache
diff options
context:
space:
mode:
authorDominik Stadler <centic@apache.org>2020-03-08 20:17:19 +0000
committerDominik Stadler <centic@apache.org>2020-03-08 20:17:19 +0000
commit199895bfc4296d5da2d836f38a844cefc5928a88 (patch)
tree9120de3a7446cceef14715933790c41d824469a6 /src/testcases/org/apache
parent7c2dfd993023d1553a113b28bb3133f622ac9f86 (diff)
downloadpoi-199895bfc4296d5da2d836f38a844cefc5928a88.tar.gz
poi-199895bfc4296d5da2d836f38a844cefc5928a88.zip
Work on bug 64038 and other bugs and add test for 62865
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1874983 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache')
-rw-r--r--src/testcases/org/apache/poi/hssf/usermodel/TestUnfixedBugs.java15
-rw-r--r--src/testcases/org/apache/poi/ss/format/TestCellFormat.java6
2 files changed, 18 insertions, 3 deletions
diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestUnfixedBugs.java b/src/testcases/org/apache/poi/hssf/usermodel/TestUnfixedBugs.java
index 12b9f7ca08..40afff2131 100644
--- a/src/testcases/org/apache/poi/hssf/usermodel/TestUnfixedBugs.java
+++ b/src/testcases/org/apache/poi/hssf/usermodel/TestUnfixedBugs.java
@@ -109,7 +109,13 @@ public final class TestUnfixedBugs {
}
@Test
- public void testDataFormattingWithQuestionMark() {
+ public void testBug62242() {
+ CellFormat cfUK = CellFormat.getInstance("_ * #,##0.00_ ;_ * \\-#,##0.00_ ;_ * \"-\"??_ ;_ @_");
+ assertEquals(" - ", cfUK.apply((double) 0).text);
+ }
+
+ @Test
+ public void testDataFormattingWithQuestionMarkBug62242() {
// The question mark in the format should be replaced by blanks, but
// this is currently not handled when producing the Java formatting and
// so we end up with a trailing zero here
@@ -118,13 +124,16 @@ public final class TestUnfixedBugs {
}
@Test
- public void testDataFormattingWithQuestionMarkAndPound() {
+ public void testDataFormattingWithQuestionMarkAndPoundBug62242() {
char pound = '\u00A3';
// The question mark in the format should be replaced by blanks, but
// this is currently not handled when producing the Java formatting and
// so we end up with a trailing zero here
CellFormat cfUK = CellFormat.getInstance("_-[$£-809]* \"-\"??_-");
- assertEquals(" "+pound+" - ", cfUK.apply((double) 0).text);
+ assertEquals(" "+pound+" - ", cfUK.apply((double) 0).text);
+
+ cfUK = CellFormat.getInstance("_-[$£-809]* \"-\"??_-a");
+ assertEquals(" "+pound+" - a", cfUK.apply((double) 0).text);
}
}
diff --git a/src/testcases/org/apache/poi/ss/format/TestCellFormat.java b/src/testcases/org/apache/poi/ss/format/TestCellFormat.java
index 077c342f10..8234a93e4a 100644
--- a/src/testcases/org/apache/poi/ss/format/TestCellFormat.java
+++ b/src/testcases/org/apache/poi/ss/format/TestCellFormat.java
@@ -1007,4 +1007,10 @@ public class TestCellFormat {
assertNotNull(instance);
assertEquals("01/01/1970", instance.apply(new Date(12345)).text);
}
+
+ @Test
+ public void testBug62865() {
+ CellFormat cf = CellFormat.getInstance("\"ca. \"0");
+ assertEquals("ca. 5", cf.apply((double) 5).text);
+ }
}