<Swing Dev> RFR: 8273043: [TEST_BUG] Automate NimbusJTreeSelTextColor.java

Alexey Ivanov aivanov at openjdk.java.net
Thu Aug 26 20:47:29 UTC 2021


On Thu, 26 Aug 2021 20:29:11 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:

>> Automated NimbusJTreeSelTextColor.java test which is added under [JDK-8271315](https://bugs.openjdk.java.net/browse/JDK-8271315).
>> 
>> It passes with the recent build of JDK 18.  
>> It fails with JDK 18 build 7 where [JDK-8266510](https://bugs.openjdk.java.net/browse/JDK-8266510) is not fixed yet:
>> 
>> 
>> Exception in thread "main" java.lang.RuntimeException: Unexpected color found: ff000000 at (4, 9);
>> foreground: ffffffff; background: ff39698a - check image.png
>>         at NimbusJTreeSelTextColor.checkColors(NimbusJTreeSelTextColor.java:106)
>>         at NimbusJTreeSelTextColor.main(NimbusJTreeSelTextColor.java:70)
>> 
>> 
>> The line is wrapped for readability. In this case the text is black instead of white.
>
> test/jdk/javax/swing/plaf/nimbus/NimbusJTreeSelTextColor.java line 70:
> 
>> 68:             treeBounds.width -= iconOffset;
>> 69:             treeBounds.width -= 2; // crop selection border on the right
>> 70:             BufferedImage image = robot.createScreenCapture(treeBounds);
> 
> Can we skip the usage of the robot and render it directly to the buffered image? probably this will allow running the test in a headless envirement?

I thought about it yet I didn't try that. It should work. Moreover, the test fails on macOS because the UI gets scaled, rendering to BufferedImage directly could avoid this problem.

-------------

PR: https://git.openjdk.java.net/jdk/pull/5269


More information about the swing-dev mailing list