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

   ## Summary
   
   Follow-up to #1307. Extracts the fixture workbook from 
`BaseTestFormulaEvaluatorCacheNotification` into 
`BaseTestFormulaEvaluatorFixture` (the 17 notification tests are unchanged) and 
adds `BaseTestFormulaEvaluatorRowsAndColumns` with HSSF and XSSF subclasses — 
16 tests that add or remove rows and columns after the formulas have been 
evaluated and check the results.
   
   **In place (no shifter)** — `createRow`/`removeRow`, 
`createCell`/`removeCell`, reported with the per-cell `notifyUpdateCell` / 
`notifySetFormula` / `notifyDeleteCell`:
   - remove a data row; remove both header rows
   - fill the spare row, then extend `SUM`/`SUMPRODUCT`/`COUNTIF` over it
   - add a lookup-table row, then widen the `VLOOKUP` range to reach it
   - remove the whole Cost column (values and the formulas in it); references 
see blanks; putting a cell back is picked up
   - add a Discount column and rewire an existing formula to use it
   
   **Shifted** — `shiftRows`/`shiftColumns` on the data sheet and on the lookup 
sheet:
   - delete header row, spare row, data row (ranges shrink)
   - insert a row inside the data block (ranges grow) vs. below it (ranges 
don't)
   - delete / insert a row on the lookup sheet (cross-sheet range shrinks → 
`#N/A`, grows → new key usable)
   - insert a column inside the data block; delete the Cost column (`#REF!` 
cascades through the chain); insert a column on the lookup sheet
   - each asserts a few rewritten formula strings and the defined name, so a 
failure points at the shifter or the evaluator
   
   ## Cache handling
   
   The evaluator can update its caches for individual cell changes (the 
`notify*` methods) but not for a large operation like a shift, which moves 
cells and rewrites formulas and names across the workbook. So the shift tests 
call `clearAllCachedResultValues()` afterwards (via one `afterShift()` hook) 
and check the fresh evaluation; the in-place tests use only the cell 
notifications. This is documented in the class and section comments.
   
   For the record, with `afterShift()` temporarily made a no-op, exactly the 8 
shift tests fail (stale values in XSSF; mostly `IllegalStateException: value 
changed` in HSSF) and all 8 in-place tests still pass — i.e. the cell-level 
notifications are complete for in-place add/remove, and a full clear is the 
right call after a shift.
   
   ## Test plan
   
   - [x] `TestHSSFFormulaEvaluatorRowsAndColumns`, 
`TestXSSFFormulaEvaluatorRowsAndColumns` (16 each)
   - [x] `TestHSSFFormulaEvaluatorCacheNotification`, 
`TestXSSFFormulaEvaluatorCacheNotification` still pass (17 each)
   - [ ] 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