RFR: 8299553: Make ScaledEtchedBorderTest.java comprehensive
Harshitha Onkar
honkar at openjdk.org
Tue Jan 3 23:14:51 UTC 2023
On Tue, 3 Jan 2023 19:59:38 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:
> The `ScaledEtchedBorderTest.java` test ([JDK-8279614](https://bugs.openjdk.org/browse/JDK-8279614)) verifies that the thickness of lines of `EtchedBorder` is consistent. The component inside had the same background color as the frame. Yet if there's another component the background of which is different, that background could be seen.
>
> The updated test covers the scenario reported in [JDK-8294921](https://bugs.openjdk.org/browse/JDK-8294921).
>
> The bug itself is fixed by refactoring [JDK-8294680](https://bugs.openjdk.org/browse/JDK-8294680) the border rendering code which uses a more precise coordinate calculation, see #11571. Thus, I contribute the test under a separate bugid.
>
> I also modified `ScaledLineBorderTest.java` so that the location of the child panels is saved when they're created as done in `ScaledTextFieldBorderTest.java` in #11498. I removed the unused `Component` import after this modification from both tests.
Tested all 3 tests, it works as expected.
Minor inline suggestions added that are applicable for all 3 tests.
test/jdk/javax/swing/border/EtchedBorder/ScaledEtchedBorderTest.java line 239:
> 237: }
> 238:
> 239: private enum State {
enum declaration can be moved before its first usage (before `checkBorder()`)
test/jdk/javax/swing/border/EtchedBorder/ScaledEtchedBorderTest.java line 250:
> 248: throw new Error(
> 249: String.format("Wrong border thickness at %d, %d: %d vs %d",
> 250: x, y, borderThickness, thickness));
Same as above - including state value in error msg can be helpful here.
test/jdk/javax/swing/border/EtchedBorder/ScaledEtchedBorderTest.java line 256:
> 254: throw new Error(
> 255: String.format("Unexpected color at %d, %d: %08x",
> 256: x, y, color));
Since `throwUnexpectedColor()` is called commonly for different state values, including the state value in the error msg could be useful for debugging purpose.
-------------
Changes requested by honkar (Committer).
PR: https://git.openjdk.org/jdk/pull/11836
More information about the client-libs-dev
mailing list