RFR: 8273634: [TEST_BUG] Improve javax/swing/text/ParagraphView/6364882/bug6364882.java

Alexey Ivanov aivanov at openjdk.java.net
Wed Sep 29 16:44:07 UTC 2021


On Wed, 29 Sep 2021 16:09:20 GMT, Phil Race <prr at openjdk.org> wrote:

>> The test is being moved from the closed to open.
>> 
>> I updated the `bug6364882.java` test so that it's headless now. If it fails, the image of the `editorPane` is saved for analysis. I also added more asserts which verify:
>> 
>> • the first three lines are aligned to the right edge;
>> • the fourth line isn't justified and its width is less than 3/4 of the width;
>> • the fifth and sixth lines have width less than that of the fourth line and have the same width.
>> 
>> There's an option to show the UI for visual inspection as well as to save the image even if the test passes; use `-show` and/or `-save` parameters to the test correspondingly.
>> 
>> [1] [JDK-6364882](https://bugs.openjdk.java.net/browse/JDK-6364882): Last line of a paragraph should not be justified
>
> I've looked at the test a tad more and two comments
> 1) if it fails, it dumps an image. You can provide that image
> 2) It is sensitive to the actual font. If your default font for whatever reason is of a size thatonemore or one less word will fit on a line, then it will fail. This does look like a test problem to me.

Thank you, @prrace, for your comments.

1. Unfortunately, it [doesn't save the image](https://github.com/openjdk/jdk/pull/5744#issuecomment-930127270) if an exception is thrown. I overlooked this fact.
2. I agree I should've made it more flexible to accommodate for possible font size differences.

I'll fix these issues and create my own PR for [JDK-8274465](https://bugs.openjdk.java.net/browse/JDK-8274465).

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

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



More information about the client-libs-dev mailing list