mirror of https://github.com/apache/poi.git
More disabled unit tests relating to external workbook formula references
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1636626 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
10e9daf4eb
commit
36142247f4
|
@ -168,12 +168,12 @@ public final class TestXSSFFormulaEvaluation extends BaseTestFormulaEvaluator {
|
||||||
assertEquals("142.0", evaluator.evaluate(cXSL_gNR).formatAsString());
|
assertEquals("142.0", evaluator.evaluate(cXSL_gNR).formatAsString());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
// Now add a formula that refers to a different workbook again
|
// Now add a formula that refers to yet another (different) workbook
|
||||||
Cell cXSLX_nw_cell = rXSLX.createCell(42);
|
Cell cXSLX_nw_cell = rXSLX.createCell(42);
|
||||||
cXSLX_nw_cell.setCellFormula("[alt.xslx]Sheet1!$A$1");
|
cXSLX_nw_cell.setCellFormula("[alt.xlsx]Sheet1!$A$1");
|
||||||
|
|
||||||
// Check it - TODO Is this correct? Or should it become [2]Sheet1!$A$1 ?
|
// Check it - TODO Is this correct? Or should it become [2]Sheet1!$A$1 ?
|
||||||
assertEquals("[alt.xslx]Sheet1!$A$1", cXSLX_nw_cell.getCellFormula());
|
assertEquals("[alt.xlsx]Sheet1!$A$1", cXSLX_nw_cell.getCellFormula());
|
||||||
|
|
||||||
// Evaluate it, without a link to that workbook
|
// Evaluate it, without a link to that workbook
|
||||||
try {
|
try {
|
||||||
|
@ -184,7 +184,7 @@ public final class TestXSSFFormulaEvaluation extends BaseTestFormulaEvaluator {
|
||||||
// Add a link, check it does
|
// Add a link, check it does
|
||||||
Workbook alt = new XSSFWorkbook();
|
Workbook alt = new XSSFWorkbook();
|
||||||
alt.createSheet().createRow(0).createCell(0).setCellValue("In another workbook");
|
alt.createSheet().createRow(0).createCell(0).setCellValue("In another workbook");
|
||||||
evaluators.put("alt.xslx", alt.getCreationHelper().createFormulaEvaluator());
|
evaluators.put("alt.xlsx", alt.getCreationHelper().createFormulaEvaluator());
|
||||||
evaluator.setupReferencedWorkbooks(evaluators);
|
evaluator.setupReferencedWorkbooks(evaluators);
|
||||||
|
|
||||||
evaluator.evaluate(cXSLX_nw_cell);
|
evaluator.evaluate(cXSLX_nw_cell);
|
||||||
|
|
|
@ -230,6 +230,36 @@ public final class TestHSSFFormulaEvaluator extends BaseTestFormulaEvaluator {
|
||||||
assertEquals(Cell.CELL_TYPE_FORMULA, cell.getCellType());
|
assertEquals(Cell.CELL_TYPE_FORMULA, cell.getCellType());
|
||||||
assertEquals(Cell.CELL_TYPE_NUMERIC, cell.getCachedFormulaResultType());
|
assertEquals(Cell.CELL_TYPE_NUMERIC, cell.getCachedFormulaResultType());
|
||||||
assertEquals(36.90, cell.getNumericCellValue(), 0.0001);
|
assertEquals(36.90, cell.getNumericCellValue(), 0.0001);
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Now add a formula that refers to yet another (different) workbook
|
||||||
|
cell = wb.getSheetAt(0).getRow(1).createCell(42);
|
||||||
|
cell.setCellFormula("[alt.xls]Sheet1!$A$1");
|
||||||
|
|
||||||
|
// Check it - TODO Is this correct? Or should it become [2]Sheet1!$A$1 ?
|
||||||
|
assertEquals("[alt.xls]Sheet1!$A$1", cell.getCellFormula());
|
||||||
|
|
||||||
|
// Evaluate it, without a link to that workbook
|
||||||
|
try {
|
||||||
|
eval.evaluate(cell);
|
||||||
|
fail("No cached value and no link to workbook, shouldn't evaluate");
|
||||||
|
} catch(Exception e) {}
|
||||||
|
|
||||||
|
// Add a link, check it does
|
||||||
|
HSSFWorkbook alt = new HSSFWorkbook();
|
||||||
|
alt.createSheet().createRow(0).createCell(0).setCellValue("In another workbook");
|
||||||
|
HSSFFormulaEvaluator.setupEnvironment(
|
||||||
|
new String[] { "XRefCalc.xls", "XRefCalcData.xls", "alt.xls" },
|
||||||
|
new HSSFFormulaEvaluator[] {
|
||||||
|
eval,
|
||||||
|
new HSSFFormulaEvaluator(wbData),
|
||||||
|
new HSSFFormulaEvaluator(alt)
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
eval.evaluate(cell);
|
||||||
|
assertEquals("In another workbook", cell.getStringCellValue());
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSharedFormulas(){
|
public void testSharedFormulas(){
|
||||||
|
|
Loading…
Reference in New Issue