JDK-8327840 : Automate javax/swing/border/Test4129681.java
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 7,8,11,17,21,23
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2024-03-11
  • Updated: 2024-06-27
  • Resolved: 2024-03-22
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 17 JDK 21 JDK 23 JDK 8
11.0.25-oracleFixed 17.0.13-oracleFixed 21.0.5-oracleFixed 23 b16Fixed 8u431Fixed
Related Reports
Relates :  
Relates :  
Description
The javax/swing/border/Test4129681.java test has a potential to be automatic test.

The test verifies whether the title in a titled border associated with a disabled component renders using disabled colors.

If you render JLabel into a BufferedImage or take a screenshot, you can analyse the color of the pixels, especially if you turn off text antialising.

Instead of real text, you can use a full block character: "█" (U+2588) which will make analysing the pixel colors more robust.
Comments
Fix request (11u) The test only changes - the manual test is automated. The change is not clean since in jdk11u-dev the usage of textblock was removed in the test. Review 11u-dev: https://git.openjdk.org/jdk11u-dev/pull/2785
20-06-2024

Fix request (21u 17u) Clean backport. the test only changes - the manual test is automated. Review 21u-dev: https://git.openjdk.org/jdk21u-dev/pull/730 Review 17u-dev: https://git.openjdk.org/jdk17u-dev/pull/2594
20-06-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk17u-dev/pull/2594 Date: 2024-06-16 08:19:29 +0000
18-06-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk11u-dev/pull/2785 Date: 2024-06-18 02:10:04 +0000
18-06-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk21u-dev/pull/730 Date: 2024-06-15 00:50:33 +0000
15-06-2024

Changeset: 177b8a24 Author: Tejesh R <tr@openjdk.org> Date: 2024-03-22 03:21:35 +0000 URL: https://git.openjdk.org/jdk/commit/177b8a241c11782b302607c0068b15b38112e67c
22-03-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/18336 Date: 2024-03-16 07:43:18 +0000
16-03-2024

If we render the component into BufferedImage, it will render at 100% scale (unless the test code sets a scale transform). A similar approach is used in test/jdk/javax/swing/JRadioButton/4314194/bug4314194.java, see https://github.com/openjdk/jdk/pull/10618#pullrequestreview-1135358214 for JDK-8295007. Although, the test still uses Robot.getPixelColor. There are several tests which paint into BufferedImage and analyse the image. I believe it's a better approach, it's more robust, and the test could be headless, which makes the test complete quicker. See test/jdk/javax/swing/border/LineBorder/ScaledLineBorderTest.java, test/jdk/javax/swing/border/LineBorder/ScaledTextFieldBorderTest.java, test/jdk/javax/swing/border/EtchedBorder/ScaledEtchedBorderTest.java.
13-03-2024

I ran the test and see that it can be automated but we need to pick color appropriately based on scaling. Example of how we can use full block character and capture it for comparison is at test/jdk/javax/swing/plaf/nimbus/TestNimbusTabbedPaneIconPosition.java
13-03-2024