RFR: 8160755: closed/com/sun/java/swing/plaf/gtk/6492108/bug6492108.java test fails in GTK L&F

Abhishek Kumar abhiscxk at openjdk.org
Fri May 24 16:39:17 UTC 2024


bug6492108.java test always fails in GTK L&F in single as well as dual screen linux machines. Since this test was not marked as "headful" in it's initial version, it never failed but after the fix of JDK-8287051 this test was problem listed as it always
failed which is captured in the JBS.
The reason of failure is the pixel color mismatch between JEditorPane and JTextArea/JTextPane which is caused by the JEditorPane's default opaque value which is false for GTK3 https://github.com/kumarabhi006/jdk/blob/c642f44bbe1e4cdbc23496a34ddaae30990ce7c0/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java#L767.
In initial load JEditorPane, JTextArea and JTextPane components are opaque https://github.com/kumarabhi006/jdk/blame/6c7656678916ff3f5c9fc70efcbb69ce76801458/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java#L718 but after the fix for JDK-8145547 the implementation was changed to provide conditional support for GTK3 on linux where few components like Editor Pane, Formatted text Field, Password Field etc are opaque only if the GTKversion is not 3 https://github.com/kumarabhi006/jdk/blame/73d2181d56063f6015e4fc42e130591bee39bc36/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java#L746C21-L746C21.
JTextPane's issue was observed by JDK-8218479 and then the default opacity is set to true for JTextPane irrespective of GTK version https://github.com/kumarabhi006/jdk/blame/c642f44bbe1e4cdbc23496a34ddaae30990ce7c0/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java#L750C16-L750C16.
Extending the fix in isOpaque() method in GTKStyle.java for JEditorPane similar to JTextPane resolves the issue.

Test verified in both single and dual screen linux machines.

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

Commit messages:
 - JEditorPane issue fix and test moved to open

Changes: https://git.openjdk.org/jdk/pull/19381/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19381&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8160755
  Stats: 167 lines in 2 files changed: 164 ins; 1 del; 2 mod
  Patch: https://git.openjdk.org/jdk/pull/19381.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/19381/head:pull/19381

PR: https://git.openjdk.org/jdk/pull/19381


More information about the client-libs-dev mailing list