Update bug reference numbers, and bring over part of a test from unfixed that is now working (rest remains broken)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1611728 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6e37f73018
commit
3fd7c0d258
@ -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);
|
||||
|
@ -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....
|
||||
|
@ -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());
|
||||
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user