aboutsummaryrefslogtreecommitdiffstats
path: root/src/testcases
diff options
context:
space:
mode:
Diffstat (limited to 'src/testcases')
-rw-r--r--src/testcases/org/apache/poi/hssf/HSSFTestDataSamples.java1
-rw-r--r--src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java27
-rw-r--r--src/testcases/org/apache/poi/hssf/usermodel/TestHSSFFormulaEvaluator.java5
-rw-r--r--src/testcases/org/apache/poi/hssf/usermodel/TestUnfixedBugs.java19
4 files changed, 36 insertions, 16 deletions
diff --git a/src/testcases/org/apache/poi/hssf/HSSFTestDataSamples.java b/src/testcases/org/apache/poi/hssf/HSSFTestDataSamples.java
index f684676e91..ecbf890ab1 100644
--- a/src/testcases/org/apache/poi/hssf/HSSFTestDataSamples.java
+++ b/src/testcases/org/apache/poi/hssf/HSSFTestDataSamples.java
@@ -58,7 +58,6 @@ public final class HSSFTestDataSamples {
* Useful for verifying that the serialisation round trip
*/
public static HSSFWorkbook writeOutAndReadBack(HSSFWorkbook original) {
-
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream(4096);
original.write(baos);
diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java b/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
index c4c024a7e3..9421b56348 100644
--- a/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
+++ b/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
@@ -2383,6 +2383,31 @@ public final class TestBugs extends BaseTestBugzillaIssues {
writeOutAndReadBack(workbook);
}
+ /**
+ * Note - part of this test is still failing, see
+ * {@link TestUnfixedBugs#test49612()}
+ */
+ @Test
+ public void bug49612_part() throws IOException {
+ HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("49612.xls");
+ HSSFSheet sh = wb.getSheetAt(0);
+ HSSFRow row = sh.getRow(0);
+ HSSFCell c1 = row.getCell(2);
+ HSSFCell d1 = row.getCell(3);
+ HSSFCell e1 = row.getCell(2);
+
+ assertEquals("SUM(BOB+JIM)", c1.getCellFormula());
+
+ // Problem 1: See TestUnfixedBugs#test49612()
+ // Problem 2: TestUnfixedBugs#test49612()
+
+ // Problem 3: These used to fail, now pass
+ HSSFFormulaEvaluator eval = new HSSFFormulaEvaluator(wb);
+ assertEquals("evaluating c1", 30.0, eval.evaluate(c1).getNumberValue(), 0.001);
+ assertEquals("evaluating d1", 30.0, eval.evaluate(d1).getNumberValue(), 0.001);
+ assertEquals("evaluating e1", 30.0, eval.evaluate(e1).getNumberValue(), 0.001);
+ }
+
@Test
public void bug51675(){
final List<Short> list = new ArrayList<Short>();
@@ -2640,7 +2665,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
assertEquals("Defines!NR_To_A1", cRefSName.getCellFormula());
- // TODO How does Excel know to prefix this with the filename?
+ // TODO Correct this, so that the filename is shown too, see bug #56742
// This is what Excel itself shows
//assertEquals("'56737.xls'!NR_Global_B2", cRefWName.getCellFormula());
// TODO This isn't right, but it's what we currently generate....
diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFFormulaEvaluator.java b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFFormulaEvaluator.java
index 20ce8fa806..2388f88aed 100644
--- a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFFormulaEvaluator.java
+++ b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFFormulaEvaluator.java
@@ -197,9 +197,8 @@ public final class TestHSSFFormulaEvaluator extends BaseTestFormulaEvaluator {
assertEquals(Cell.CELL_TYPE_FORMULA, cell.getCellType());
assertEquals(Cell.CELL_TYPE_NUMERIC, cell.getCachedFormulaResultType());
assertEquals(36.90, cell.getNumericCellValue(), 0.0001);
- // WARNING - this is wrong!
- // The file name should be showing, but bug #45970 is fixed
- // we seem to loose it
+ // TODO Correct this!
+ // The file name should be shown too, see bug #56742
assertEquals("Cost*Markup_Cost", cell.getCellFormula());
diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestUnfixedBugs.java b/src/testcases/org/apache/poi/hssf/usermodel/TestUnfixedBugs.java
index e62909eddf..7b101affeb 100644
--- a/src/testcases/org/apache/poi/hssf/usermodel/TestUnfixedBugs.java
+++ b/src/testcases/org/apache/poi/hssf/usermodel/TestUnfixedBugs.java
@@ -18,7 +18,6 @@
package org.apache.poi.hssf.usermodel;
import java.io.IOException;
-import java.io.UnsupportedEncodingException;
import junit.framework.AssertionFailedError;
import junit.framework.TestCase;
@@ -50,6 +49,10 @@ public final class TestUnfixedBugs extends TestCase {
}
}
+ /**
+ * Note - some parts of this bug have been fixed, and have been
+ * transfered over to {@link TestBugs#bug49612_part()}
+ */
public void test49612() throws IOException {
HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("49612.xls");
HSSFSheet sh = wb.getSheetAt(0);
@@ -60,21 +63,15 @@ public final class TestUnfixedBugs extends TestCase {
assertEquals("SUM(BOB+JIM)", c1.getCellFormula());
- // Problem 1: java.lang.ArrayIndexOutOfBoundsException in org.apache.poi.hssf.model.LinkTable$ExternalBookBlock.getNameText
+ // Problem 1: Filename missing, see bug #56742
assertEquals("SUM('49612.xls'!BOB+'49612.xls'!JIM)", d1.getCellFormula());
- //Problem 2
+ //Problem 2: Filename missing, see bug #56742
//junit.framework.ComparisonFailure:
//Expected :SUM('49612.xls'!BOB+'49612.xls'!JIM)
//Actual :SUM(BOB+JIM)
assertEquals("SUM('49612.xls'!BOB+'49612.xls'!JIM)", e1.getCellFormula());
-
- HSSFFormulaEvaluator eval = new HSSFFormulaEvaluator(wb);
- assertEquals("evaluating c1", 30., eval.evaluate(c1).getNumberValue());
-
- //Problem 3: java.lang.RuntimeException: Unexpected arg eval type (org.apache.poi.hssf.record.formula.eval.NameXEval)
- assertEquals("evaluating d1", 30., eval.evaluate(d1).getNumberValue());
-
- assertEquals("evaluating e1", 30., eval.evaluate(e1).getNumberValue());
+
+ // Problem 3 - fixed and transfered
}
}