JDK-8160720 : javax/swing/SwingUtilities/TestBadBreak/TestBadBreak.java
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 9,10,11
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2016-07-01
  • Updated: 2025-07-25
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.
Other
tbdUnresolved
Related Reports
Duplicate :  
Relates :  
Sub Tasks
JDK-8362461 :  
Description
I don't know about  JDK-8073710 but for me the test fails apparently because some content of too big buffered images appeared different outside of a JLabel area.
A printout from the test reports that two JFrames have exactly the same dimensions:
frame0,200,200,200x90,layout=java.awt.BorderLayout,title=,resizable,normal,defaultCloseOperation=HIDE_ON_CLOSE,rootPane=javax.swing.JRootPane[,6,28,188x56 etc.

and the test fails at (0,56) -- as you can see 56 is the height of the rootPane.

I think the test should be someway changed since there's no point in researching why exactly these images are different: I even suspect there's nothing wrong with it -- the painting of the frame itself is not finished yet.
Comments
According to the discussion in the code review, this is a product bug. [1] “I think the test does something wrong. Now I see how uiScale affects rendering. The test does not paint JLabel directly to the image but rather in its overridden paintComponent. So uiScale controls the size of the component or rather where the break occurs. “For me on Windows with 200% scaling, in the first image ‘…’ is painted over the transparent background whereas in the second image ‘…’ is over the components opaque background. “The test passes with uiScale=1 but I see no ‘…’ at all. Both images are clipped at “.1”. “As far as I understand, the purpose of the test is to make sure combining diacritics does not affect string clipping, and it occurs at the same position whether a composite character is used of a decomposed one. Yet no clipping occurs at all with uiScale=1. This looks wrong even though the test passes successfully. And when the test fails with uiScale=2, the images suggest there's a product bug because the string is clipped differently.” [2] “If you change the size of the frames manually, the combining case works as expected: as soon as the string does not fit in the width, it gets clipped, two characters “/ä” (or rather two glyphs) are replaced with “…”. But if you slowly change the width of the frame with precomposed character, three characters “3/ä” disappear; if you continue shrinking the frame, there's always a gap between the “…” and the edge of the frame. Yet in the other frame, another character gets clipped only when “…” touches the edge. (I used uiScale=4 for testing, it makes the font larger and it's easier to see the difference.) “So, this is a product bug.” [1] https://github.com/openjdk/jdk/pull/2502#issuecomment-777793614 [2] https://github.com/openjdk/jdk/pull/2502#issuecomment-784498282
22-07-2025

This test fails for me on Windows 11 with 200% scale. ----------System.out:(0/0)---------- ----------System.err:(11/596)---------- java.lang.RuntimeException: Wrong color at TestBadBreak.main(TestBadBreak.java:63) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) at java.base/java.lang.reflect.Method.invoke(Method.java:565) at com.sun.javatest.regtest.agent.MainWrapper$MainTask.run(MainWrapper.java:138) at java.base/java.lang.Thread.run(Thread.java:1447) JavaTest Message: Test threw exception: java.lang.RuntimeException: Wrong color JavaTest Message: shutting down test I tested mainline and 21u.
22-07-2025

fails on windows 7 with jdk10+11 at 120dpi java.lang.RuntimeException: Wrong color at TestBadBreak.main(TestBadBreak.java:63) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:564) at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:115) at java.base/java.lang.Thread.run(Thread.java:844) JavaTest Message: Test threw exception: java.lang.RuntimeException: Wrong color JavaTest Message: shutting down test STATUS:Failed.`main' threw exception: java.lang.RuntimeException: Wrong color
24-01-2018