aboutsummaryrefslogtreecommitdiffstats
path: root/src/testcases/org/apache/poi/hssf/usermodel
diff options
context:
space:
mode:
authorNick Burch <nick@apache.org>2015-10-24 23:34:47 +0000
committerNick Burch <nick@apache.org>2015-10-24 23:34:47 +0000
commitb3f68c4eb4f81cfda99bc449b922c12abf348ade (patch)
treeb78e23301ec7ed5c825854abe91f8387fba4f964 /src/testcases/org/apache/poi/hssf/usermodel
parentcbde002fa1356f53b382b97797229ed209ee522f (diff)
downloadpoi-b3f68c4eb4f81cfda99bc449b922c12abf348ade.tar.gz
poi-b3f68c4eb4f81cfda99bc449b922c12abf348ade.zip
#58532 For Excel cell formats with 3+ parts to them (eg +ve,-ve,0), which
DataFormatter didn't properly support, call out to the alternate CellFormat instead for the formatting. This also allows us to enable some disabled parts of DataFormatter unit tests We still need to rationalise DataFormatter and CellFormatter though, so we only have one set of cell formatting logic... git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1710399 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache/poi/hssf/usermodel')
-rw-r--r--src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDataFormat.java8
-rw-r--r--src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDataFormatter.java10
2 files changed, 14 insertions, 4 deletions
diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDataFormat.java b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDataFormat.java
index 8761ecf104..6b6fc81a5a 100644
--- a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDataFormat.java
+++ b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDataFormat.java
@@ -52,6 +52,14 @@ public final class TestHSSFDataFormat extends BaseTestDataFormat {
}
/**
+ * [Bug 58532] Handle formats that go numnum, numK, numM etc
+ */
+ public void test58532() {
+ HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("FormatKM.xls");
+ doTest58532Core(wb);
+ }
+
+ /**
* Bug 51378: getDataFormatString method call crashes when reading the test file
*/
public void test51378(){
diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDataFormatter.java b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDataFormatter.java
index 85ceee2f9b..f42074e99d 100644
--- a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDataFormatter.java
+++ b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDataFormatter.java
@@ -265,8 +265,8 @@ public final class TestHSSFDataFormatter {
assertTrue( ! "555.47431".equals(fmtval));
// check we found the time properly
- assertTrue("Format came out incorrect - " + fmt + ": " + fmtval + ", but expected to find '11:23'",
- fmtval.indexOf("11:23") > -1);
+ assertTrue("Format came out incorrect - " + fmt + " - found " + fmtval +
+ ", but expected to find '11:23'", fmtval.indexOf("11:23") > -1);
}
// test number formats
@@ -358,8 +358,10 @@ public final class TestHSSFDataFormatter {
Cell cell = it.next();
cell.setCellValue(cell.getNumericCellValue() * Math.random() / 1000000 - 1000);
log(formatter.formatCellValue(cell));
- assertTrue(formatter.formatCellValue(cell).startsWith("Balance "));
- assertTrue(formatter.formatCellValue(cell).endsWith(" USD"));
+
+ String formatted = formatter.formatCellValue(cell);
+ assertTrue("Doesn't start with Balance: " + formatted, formatted.startsWith("Balance "));
+ assertTrue("Doesn't end with USD: " + formatted, formatted.endsWith(" USD"));
}
}