On Tue, 3 Jan 2023 23:05:53 GMT, Harshitha Onkar <[email protected]> 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. > > 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. I don't think it's needed: the stack trace of the exception contains the line number which uniquely identifies the state. For example, an excerpt of test output when it fails: Scaling: 1.00 java.lang.Error: Unexpected color at 62, 24: ffffffff at ScaledEtchedBorderTest.throwUnexpectedColor(ScaledEtchedBorderTest.java:255) at ScaledEtchedBorderTest.checkBorder(ScaledEtchedBorderTest.java:231) at ScaledEtchedBorderTest.checkVerticalBorders(ScaledEtchedBorderTest.java:131) at ScaledEtchedBorderTest.verifyBorderRendering(ScaledEtchedBorderTest.java:99) at ScaledEtchedBorderTest.testScaling(ScaledEtchedBorderTest.java:87) at ScaledEtchedBorderTest.lambda$main$0(ScaledEtchedBorderTest.java:77) at … https://github.com/openjdk/jdk/blob/b78389e8c1e23cb83338387ba20091bf705480e1/test/jdk/javax/swing/border/EtchedBorder/ScaledEtchedBorderTest.java#L221-L232 Line 231 corresponds to the `RIGHT_HIGHLIGHT` state. If you open the `test1.00.png` image, you quickly see, there's _a white line_ below the highlight line which shouldn't be there. Therefore, passing the additional parameter doesn't add much value. ------------- PR: https://git.openjdk.org/jdk/pull/11836
