pjfanning opened a new pull request, #1314:
URL: https://github.com/apache/poi/pull/1314

   ## Summary
   
   Hidden rows are the one piece of sheet state besides cell contents that the 
evaluator consults: `SUBTOTAL` with a function code above 100 skips values in 
hidden rows (`EvaluationSheet.isRowHidden` → 
`LazyAreaEval`/`LazyRefEval.isRowHidden` → `MultiOperandNumericFunction`, 
`Count`, `Counta`, `Subtotal`). Existing coverage was one HSSF test over 
`SubtotalsNested.xls` with codes 109/102/103 and the rows already hidden in the 
file.
   
   Adds `BaseTestFormulaEvaluatorHiddenRows` with HSSF and XSSF subclasses on 
the shared fixture (8 tests each):
   
   - **hiding after evaluation is not a cell change** — no `notify*` describes 
it; results are stale until `clearAllCachedResultValues()` (documented in the 
class and an `afterVisibilityChange()` hook, like `afterShift()` in the 
rows/columns tests); codes 1–11 and every other function keep counting hidden 
rows
   - **every aggregate code above 100** (101–106, 109) with one and then two 
rows hidden
   - **single-cell arguments** — `SUBTOTAL(109,A2,A3,A4)` takes the 
`LazyRefEval` branch in `Subtotal.evaluate`, a different path from areas
   - **hidden rows on another sheet** — `SUBTOTAL(109,Prices!B2:B4)`; hidden 
Data rows don't affect a Prices range; `VLOOKUP` ignores visibility
   - **results flow through dependents**, and cell notifications keep working 
alongside (a change in a hidden row is tracked, it just doesn't count)
   - **nested subtotals** ignored whether hidden or not
   - **collapsed outline group** hides its rows and `SUBTOTAL 1xx` follows
   - **hidden columns and missing rows are not hidden rows**
   
   Also replaces `assertTrue(set.contains(..))` in 
`classifierIsAskedAboutEveryCellRead` with Hamcrest `hasItems` / 
`not(hasItem(..))` / `everyItem`.
   
   ## Found on the way (not fixed here)
   
   `XSSFSheet.setRowGroupCollapsed(row, false)` does not unhide the group's 
rows. `XSSFSheet.isRowGroupHiddenByParent` inspects the *first row of the 
group* (hidden because it is collapsed) where HSSF's `RowRecordsAggregate` 
inspects the row *before* the group, so it always answers "hidden by parent" 
and `expandRow` skips the unhide loop. `TestXSSFSheet.setRowGroupCollapsed` 
currently asserts the rows stay hidden after expanding. The outline test here 
therefore only covers collapsing; I'll send the fix, with the expand assertion, 
separately.
   
   ## Test plan
   
   - [x] `TestHSSFFormulaEvaluatorHiddenRows`, 
`TestXSSFFormulaEvaluatorHiddenRows` (8 each)
   - [x] `TestHSSFFormulaEvaluatorStabilityClassifier`, 
`TestXSSFFormulaEvaluatorStabilityClassifier` still pass
   - [ ] CI
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to