Repository navigation
Commit d8b2587
committed
Port PeachPDF's core forced-break/keep-with-next/orphans-widows tests (Batch 2)
Ports PeachPDF.Tests/Integration/{PageBreakIntegrationTests,BreakPropagationIntegrationTests,
KeepWithNextIntegrationTests,OrphansWidowsIntegrationTests,EarlyBreakLayoutIntegrationTests,
MonolithicContentLayoutIntegrationTests,ResumableBlockLayoutIntegrationTests,
PageMarginPaginationIntegrationTests,FragmentainerCursorIntegrationTests,
EngineRelayoutIdempotencyTests,JustifiedLineAtABreakTests}.cs into a new
HtmlRenderer.IntegrationTest/Fragmentation/ folder, using a real WinForms.HtmlContainer
(reflecting out HtmlContainerInt) with an explicit Container.Location = (0, MarginTop) -
confirmed, the hard way, to be required: HtmlContainerInt.Location defaults to (0,0)
regardless of MarginTop, so PageIndexOf/PageTopOf's grid silently disagrees with where box
geometry actually starts unless Location is set to match.
Dropped per general exclusion rules: directional break values (left/right/recto/verso),
named pages (page property is parse-only - PageNameProperty.cs/HtmlContainerInt has no
NamedPageElements), and PeachPDF's own resumable-pass-rewind architecture (PassRewind,
FragmentainerPasses/PassRewinds counters, CssProxyBox table header proxies) which this port
never built - BreakToken.cs's own doc comment confirms only a forced break-before/after:page
ever produces a real cross-pass token here; InlineFragmentation.ApplyLineBreaking computes an
entire paragraph's lines in one unbounded, side-effect-free call. flex/grid/multicol Theories
dropped outright (no such engines exist; MonolithicContent.RunsAnEngineOfItsOwn narrows to
table only).
11 tests Ignored with specific, empirically-verified reasons - most notably three newly-found
gaps, confirmed by reverting to unignored and observing the actual failure:
- BreakValues.IsForcedBreak treats "always" as a forced break on the modern break-before/
break-after properties too (a deliberate, documented design choice - ported inverted, not
dropped) - but TryGetForcedBreakTarget's own targetTop discards a forced-break box's margin
entirely rather than preserving it, and css-break-3 §3.1 ancestor-propagation only works for
RelocateIfNeeded/EnforceKeepWithNext's real relayout, never for a forced break itself or for
margin-truncation-caused first-child overflow (ContainerLeftBehindTest.cs's own fix doesn't
reach either case).
- CssLayoutEngineTable's row-atomicity shift offsets only each cell's own rectangle, never the
outer <table> box's Location/EffectiveTop, so EnforceKeepWithNext(table) never observes a
row-atomicity relocation and a table's own avoid-chained heading is never pulled along.
- InlineFragmentation.ApplyLineBreaking's widows merge-back can only remove a break entirely
(fully merging two runs), never shift a break point earlier by fewer lines nor fall back to
pushing a run to a fresh page when an in-place merge doesn't fit the current page's remaining
room - producing real, reproducible orphans/widows violations at several swept filler heights
(traced by hand against the algorithm and confirmed by running the tests unignored). A fourth,
narrower gap: OrphansProperty/WidowsProperty use NaturalIntegerConverter (accepts 0) instead
of PositiveIntegerConverter, so "orphans:0" parses instead of falling back to the default (the
resolved ActualOrphans/ActualWidows self-correct via their own > 0 check, so this doesn't
affect real layout, only the raw string property). One further table-specific gap: a
position:absolute child of a table cell loses one line of its own content under a real page
grid, root cause not chased further (out of this batch's scope).
HtmlRenderer.Test: 2426 passed / 129 skipped / 0 failed (unchanged).
HtmlRenderer.IntegrationTest: 246 passed / 93 skipped / 0 failed (+100 passed / +19 skipped).
HtmlRenderer.PdfSharp.Test: 30 passed / 0 failed (unchanged).1 parent 5fbc4e0 commit d8b2587
11 files changed
Lines changed: 3189 additions & 0 deletions
File tree
- Source/Test/HtmlRenderer.IntegrationTest/Fragmentation
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
0 commit comments