Repository navigation
fix(layout): let a row background take effect through TableElement.Add(Row) - #655
Merged
Merged
Conversation
Row.Background was init-only and AddRow/AddHeaderRow build their own rows, so no caller could set it. Add(Row) appends a caller-built row, refusing null and a channel outside 0..1 at the call (ISO 32000-2, 8.6.4.3). AddRow and AddHeaderRow output is unchanged.
…an test ColorRgb said no channel is ever checked at the call; Add(Row) now checks a row background. Row.Background and TableRenderer.Draw describe a row that reaches the table without Add(Row), the fill of a spanning cell, and a cell pushed past the last column. Wrap the added comment lines.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #543
Row.Backgroundisinit-only andAddRow/AddHeaderRowbuild their own rows, so no caller could give a row a background. The renderer already drewcell.Background ?? row.Background; the row half of that was never reachable.What changed
TableElement.Add(Row): appends a row you built withnew Row { Background = ... }and returns it. The table holds the row by reference.ArgumentNullException,ParamNamerow), and a background channel that is NaN, infinite, below 0 or above 1 (ArgumentOutOfRangeException,ParamNamerow,ActualValuethe channel). ISO 32000-2:2020, 8.6.4.3: each DeviceRGB component is a number from 0.0 to 1.0. The check is on the value as given, so 1.000001 is refused although it would be written as1.Background, else the row's, ahead of its border and text. A column the row has no cell for gets no fill; aRowSpancell takes the colour of the row it starts in; a repeated header row repeats its fill.Row,Row(),Row.Background,Row.AddCell(Cell), theAddRow/AddHeaderRowcross-references, andTableRenderer.Draw(a row background can no longer be non-finite there).PublicAPI.Unshipped.txt: one new line, in its own block. No shipped member changes.Compatibility
AddRow()andAddHeaderRow()are unchanged. Differential probe: the same 8 documents (plain, header flag through the bool overload, header row repeated over pages, a cell background with aRowSpan; untagged and tagged) built against the 2.3.3 library and against this build, dates and/IDmasked: all 8 byte-identical. The probe printed2.3.3+1c61fa6...for the old library and the build's own assembly path for the new one.Add(Row)has no 2.3.3 counterpart.Tests (
TableRowBackgroundTests, 42 cases)Exact
rg/re/foperators and rectangles per cell, the order fill, border, text, cell colour winning over row colour, per-row positions, a short row, aRowSpan,/Artifactwrapping in a tagged table, the header row repeated on every continuation page, a data row after a page break, the null background giving the bytes ofAddRow(), reference semantics, an empty row, channels exactly 0 and 1, the overloads ofAddRow, and the refusal theory (null; NaN, +inf, -inf, -1e-9, 1.000001 in each channel) withParamName,ActualValue, the full message and an unchanged table. Oracles, files under a directory made withDirectory.CreateDirectory: pdftoppm pixel probe (filled cell red, unfilled cell white), pdftotext, qpdf--checkand veraPDFua1on a tagged table, veraPDF2u. Each fixture asserts the construct is present before the verdict is read.Full
VellumPdf.Layout.Testsin Release with oracles required: net10.0 1378 total, 0 failed, 2 skipped; net11.0 1378 total, 0 failed, 2 skipped (both skips are Linux-only tests). Release solution build 0 warnings;dotnet format --verify-no-changes, clean-room check andgenerate-roadmap.py --checkexit 0.Mutations (each run in a detached worktree, each fails tests)
Addstores a copy withoutBackgroundRowBackground_fillsEachCellRectangle_withTheRowColour,Add_holdsTheRowByReferenceAdd_aBackgroundOutsideTheRange_*,Add_withTwoBadChannels_namesTheFirstAdd_aNullRow_throwsArgumentNullException_andLeavesTheTableAdd_aBackgroundOutsideTheRange_*Add_acceptsChannelsAtTheRangeEnds,RowBackground_isVisible_inTheRenderedPageAdd_aBackgroundOutsideTheRange_*ParamNameAdd_aBackgroundOutsideTheRange_*CellBackground_winsOverRowBackground_forThatCellOnlyAddRow(bool)creates a row with a backgroundAddRow_overloads_areUnchangedRowBackground_withAColSpan_fillsTheSpannedWidthNot done
The fill is per cell, so a row shorter than the table is not filled across the missing columns; this is documented on
Row.Background. Fill-versus-border order was tested but not mutated.