RFR: 8286093: java/awt/geom/Path2D/UnitTest.java failed with "RuntimeException: 2D bounds too small" [v3]
Jeremy
duke at openjdk.java.net
Tue May 24 20:31:32 UTC 2022
> 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 with a new target base due to a merge or a rebase. The pull request now contains 29 commits:
- Merge remote-tracking branch 'origin/master' into JDK-8176501
- Merge pull request #2 from openjdk/master
Merge openjdk/jdk
- 8176501: Method Shape.getBounds2D() incorrectly includes Bezier control points in bounding box
Renaming "moveX"/"moveY" to "startX"/"startY" at Laurent's suggestion.
- Merge branch 'master' into JDK-8176501
# Conflicts:
# src/java.desktop/share/classes/java/awt/geom/Path2D.java
# test/jdk/java/awt/geom/Path2D/UnitTest.java
- Merge pull request #1 from openjdk/master
Merge openjdk/jdk into mickleness/jdk
- 8176501: Method Shape.getBounds2D() incorrectly includes Bezier control points in bounding box
Restoring original behavior. The "10_000_000 : 10_000_000" line should never have been committed.
- 8176501: Method Shape.getBounds2D() incorrectly includes Bezier control points in bounding box
This resolves occasional unit test failures in java.awt.geom.Path2D.UnitTest. (For ex, see seeds 4603421469924484958L, 4596019360892069260L, 4604586530476373958L, 4603766396818608126L)
The problem appears to be that the UnitTest class randomly creates PathIterator segments in a way that can place lines/quads/cubics immediately after a SEG_CLOSE. That is: after a SEG_CLOSE there was no SEG_MOVETO as new segments followed.
The previous Path2D#getBounds2D(PathIterator) method assumed each subpath *always* started with a SEG_MOVETO. (I don't know if this is formally stated in a specification anywhere or not?) The unit test failures show this is a bad assumption.
With this change: when a SEG_CLOSE is encountered: we reset the cursor to the last (moveX, moveY) point. This appears to resolve the unit test failures, which suggests this is consistent with what existing awt.geom classes also do.
- 8176501: Method Shape.getBounds2D() incorrectly includes Bezier control points in bounding box
Turn on "verbose" mode before running any tests
- 8176501: Method Shape.getBounds2D() incorrectly includes Bezier control points in bounding box
Isolating 4 test case failures to focus on.
- 8176501: Method Shape.getBounds2D() incorrectly includes Bezier control points in bounding box
Modify the unit test so we log random seeds. Because these unit tests use random numbers: failures can appear randomly. With this commit: we'll log the random seeds so we can easily reproduce specific failures. Also we'll be able to say with certainty if we fixed a failure or not.
- ... and 19 more: https://git.openjdk.java.net/jdk/compare/9b7e42c0...3d1cbc94
-------------
Changes: https://git.openjdk.java.net/jdk/pull/8828/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=8828&range=02
Stats: 68 lines in 2 files changed: 37 ins; 5 del; 26 mod
Patch: https://git.openjdk.java.net/jdk/pull/8828.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/8828/head:pull/8828
PR: https://git.openjdk.java.net/jdk/pull/8828
More information about the client-libs-dev
mailing list