RFR: 8176501: Method Shape.getBounds2D() incorrectly includes Bezier control points in bounding box [v2]
Jeremy
duke at openjdk.java.net
Mon May 23 08:56:49 UTC 2022
On Sun, 22 May 2022 17:57:27 GMT, Jeremy <duke at openjdk.java.net> wrote:
>> This resolves an occasional unit test failure in Path2D.UnitTest.
>>
>> The previous Path2D#getBounds2D(PathIterator) implementation assumed that after a SEG_CLOSE the next segment would always be a SEG_MOVETO to start a new clearly defined segment. But the Path2D.UnitTest created random paths that didn't follow this expectation.
>>
>> This commit updates #getBounds2D(PathIterator) so it will move the cursor back to the (moveX, moveY) point for the sake of calculating future segments. This appears to resolve the unit test failures.
>>
>> This commit also modifies the unit test so it logs random seeds. This may help developers isolate/reproduce specific failures with more certainty.
>
> Jeremy has updated the pull request incrementally with one additional commit since the last revision:
>
> 8176501: Method Shape.getBounds2D() incorrectly includes Bezier control points in bounding box
>
> Renaming "moveX"/"moveY" to "startX"/"startY" at Laurent's suggestion.
I reworded the variables as Laurent suggested.
Regarding explicitly testing certain paths:
I don't mind adding more test cases, but for me the catch is exactly *which* cases to add? Since we don't have a specific known failure/concern in mind, what should we test? (for ex: an open/closed triangle? a C-shaped cubic bezier curve? something else?)
Also (unrelated):
I ran the current Path2D.UnitTest tonight on my Mac for a few hours. I reached 32,220 iterations without any errors.
-------------
PR: https://git.openjdk.java.net/jdk/pull/8828
More information about the client-libs-dev
mailing list