RFR: 8328242: Add a log area to the PassFailJFrame

Alexey Ivanov aivanov at openjdk.org
Fri Mar 15 13:13:51 UTC 2024


On Fri, 15 Mar 2024 04:40:35 GMT, Alexander Zvegintsev <azvegint at openjdk.org> wrote:

>> Often manual tests have a text area in the instruction window to print feedback from the test to be evaluated by a tester.
>> I stumbled across another test that needed this, so I decided to make these changes a standard feature.
>> 
>> List of changes:
>> * The log text area can be added below the `Pass` and `Fail` buttons panel.
>> To do this, use the builder methods `logArea()`, `logArea(int rows)`.
>> * `PassFailJFrame.log(message)`, `PassFailJFrame.logClear()` and `PassFailJFrame.logSet()` are added to control this text area. (maybe I missed something?)
>> * added `invokeOnEDTUncheckedException` for easier use of logging methods
>> 
>> So typical usage would be like:
>> 
>>         PassFailJFrame
>>                 .builder()
>>                 .title("GetBoundsResizeTest Instructions")
>>                 .instructions(INSTRUCTIONS)
>>                 .rows(20)
>>                 .columns(70)
>>                 .logArea()
>>                 .build()
>>                 .awaitAndCheck();
>> 
>> 
>> ----
>> 
>> //somewhere in event handlers:
>> PassFailJFrame.log("Very important message");
>
> test/jdk/java/awt/regtesthelpers/PassFailJFrame.java line 406:
> 
>> 404:                                            rows, columns,
>> 405:                                            enableScreenCapture,
>> 406:                                            false, 0),
> 
> It is intentionally added only to the builder to avoid excessive changes to all constructors.
> 
> It seems that the builder produces much cleaner code, so we probably shouldn't spend our time to changing a bunch of `PassFailJFrame` constructors, and at some point we can make the builder the only option available.

Right. We should deprecate all the constructors, or rather remove them altogether and update tests which use them. At this moment, there are 32 tests which use `PassFailJFrame` constructors explicitly.

I submitted [JDK-8328274](https://bugs.openjdk.org/browse/JDK-8328274): _Remove PassFailJFrame constructors in favour of Builder_.

Feel free to re-assign and implement it.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18319#discussion_r1526267646


More information about the client-libs-dev mailing list