From: Nick Burch Date: Fri, 25 Jul 2014 15:49:35 +0000 (+0000) Subject: Split the reference and area tests for #55906 X-Git-Tag: REL_3_11_BETA1~36 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8cf36ccc1ad2f6b600ff661f72b5f21e6352cb16;p=poi.git Split the reference and area tests for #55906 git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1613454 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFFormulaEvaluation.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFFormulaEvaluation.java index 9199058ffb..9542c92691 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFFormulaEvaluation.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFFormulaEvaluation.java @@ -184,8 +184,8 @@ public final class TestXSSFFormulaEvaluation extends BaseTestFormulaEvaluator { * Sheets 1 through Sheet 3). * This test, based on common test files for HSSF and XSSF, checks * that we can correctly evaluate these - * - * DISABLED pending support, see bug #55906 + * + * TODO Fix this to pass for XSSF too, currently only passes for HSSF... */ public void DISABLEDtestMultiSheetReferencesHSSFandXSSF() throws Exception { Workbook[] wbs = new Workbook[] { @@ -201,7 +201,7 @@ public final class TestXSSFFormulaEvaluation extends BaseTestFormulaEvaluator { Cell sumF = s1.getRow(2).getCell(0); assertNotNull(sumF); assertEquals("SUM(Sheet1:Sheet3!A1)", sumF.getCellFormula()); - assertEquals("66.0", evaluator.evaluate(sumF).formatAsString()); + assertEquals("Failed for " + wb.getClass(), "66.0", evaluator.evaluate(sumF).formatAsString()); // Various Stats formulas on numbers @@ -241,7 +241,26 @@ public final class TestXSSFFormulaEvaluation extends BaseTestFormulaEvaluator { assertNotNull(countA_3F); assertEquals("COUNTA(Sheet1:Sheet3!E1)", countA_3F.getCellFormula()); assertEquals("3.0", evaluator.evaluate(countA_3F).formatAsString()); - + } + } + /** + * A handful of functions (such as SUM, COUNTA, MIN) support + * multi-sheet areas (eg Sheet1:Sheet3!A1:B2 = Cell A1 to Cell B2, + * from Sheets 1 through Sheet 3). + * This test, based on common test files for HSSF and XSSF, checks + * that we can correctly evaluate these + * + * DISABLED pending support, see bug #55906 + */ + public void DISABLEDtestMultiSheetAreasHSSFandXSSF() throws Exception { + Workbook[] wbs = new Workbook[] { + HSSFTestDataSamples.openSampleWorkbook("55906-MultiSheetRefs.xls"), + XSSFTestDataSamples.openSampleWorkbook("55906-MultiSheetRefs.xlsx") + }; + for (Workbook wb : wbs) { + FormulaEvaluator evaluator = wb.getCreationHelper().createFormulaEvaluator(); + Sheet s1 = wb.getSheetAt(0); + // SUM over a range Cell sumFA = s1.getRow(2).getCell(7);