aboutsummaryrefslogtreecommitdiffstats
path: root/src/testcases/org/apache/poi/ss/formula
diff options
context:
space:
mode:
authorGreg Woolsey <gwoolsey@apache.org>2019-03-18 19:09:11 +0000
committerGreg Woolsey <gwoolsey@apache.org>2019-03-18 19:09:11 +0000
commit82f9c292589bc9dd84c4b9b699129cc191513a03 (patch)
tree5102045fbc39c4a89c29a3d231ddca580835e4ee /src/testcases/org/apache/poi/ss/formula
parent19005a4e63b6855c6cb889ba546781cb43fc22f5 (diff)
downloadpoi-82f9c292589bc9dd84c4b9b699129cc191513a03.tar.gz
poi-82f9c292589bc9dd84c4b9b699129cc191513a03.zip
#60724 - Partial implementation for SUBTOTAL() 'ignore hidden rows' variations
The function still doesn't deal with auto-filtering, but it now handles variations that should skip hidden rows. Taught the evaluation framework to know about hidden rows similar to what was already there for skipping subtotals within subtotal ranges. Added unit test cases. git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1855789 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache/poi/ss/formula')
-rw-r--r--src/testcases/org/apache/poi/ss/formula/functions/TestSubtotal.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/testcases/org/apache/poi/ss/formula/functions/TestSubtotal.java b/src/testcases/org/apache/poi/ss/formula/functions/TestSubtotal.java
index 41ca4b8e98..aa16314379 100644
--- a/src/testcases/org/apache/poi/ss/formula/functions/TestSubtotal.java
+++ b/src/testcases/org/apache/poi/ss/formula/functions/TestSubtotal.java
@@ -376,6 +376,15 @@ public final class TestSubtotal {
confirmExpectedResult(evaluator, "SUBTOTAL(COUNT;B2:B8,C2:C8)", cellC2, 3.0);
confirmExpectedResult(evaluator, "SUBTOTAL(COUNTA;B2:B8,C2:C8)", cellC3, 5.0);
+ // test same functions ignoring hidden rows over a copy of the same data
+ cellC1 = sheet.getRow(11).getCell(3);
+ cellC2 = sheet.getRow(12).getCell(3);
+ cellC3 = sheet.getRow(13).getCell(3);
+ confirmExpectedResult(evaluator, "SUBTOTAL(SUM NO HIDDEN;B22:B28;C22:C28)", cellC1, 17.0);
+ confirmExpectedResult(evaluator, "SUBTOTAL(COUNT NO HIDDEN;B22:B28,C22:C28)", cellC2, 2.0);
+ confirmExpectedResult(evaluator, "SUBTOTAL(COUNTA NO HIDDEN;B22:B28,C22:C28)", cellC3, 4.0);
+
+
workbook.close();
}
@@ -393,7 +402,6 @@ public final class TestSubtotal {
{ "SUBTOTAL(8,B2:B3)", NotImplementedException.class.getName() },
{ "SUBTOTAL(10,B2:B3)", NotImplementedException.class.getName() },
{ "SUBTOTAL(11,B2:B3)", NotImplementedException.class.getName() },
- { "SUBTOTAL(107,B2:B3)", NotImplementedException.class.getName() },
{ "SUBTOTAL(0,B2:B3)", null },
{ "SUBTOTAL(9)", FormulaParseException.class.getName() },
{ "SUBTOTAL()", FormulaParseException.class.getName() },
@@ -404,7 +412,7 @@ public final class TestSubtotal {
try {
a3.setCellFormula(f[0]);
fe.evaluateAll();
- assertEquals(FormulaError.VALUE.getCode(), a3.getErrorCellValue());
+ assertEquals(f[0], FormulaError.VALUE.getCode(), a3.getErrorCellValue());
} catch (Exception e) {
actualEx = e;
}