RFR: JDK-8290469: Add new positioning options to PassFailJFrame test framework [v4]

Alexey Ivanov aivanov at openjdk.org
Tue Aug 2 20:10:42 UTC 2022


On Thu, 21 Jul 2022 00:27:04 GMT, Harshitha Onkar <honkar at openjdk.org> wrote:

>> Additional position setting (TOP_LEFT_CORNER) and a method to obtain bounds of test instruction frame are added to PassFailJFrame to handle positioning of multiple test frames.
>> 
>> In scenarios where multiple test windows might be present, the test windows might overlap the instruction frame. In order to fix this TOP_LEFT_CORNER position option is added that positions the test instruction frame at top left corner with main test window below it.
>> 
>> Additionally `getInstructionFrameBounds()` is added to obtain the position and dimensions of test instruction frame.
>
> Harshitha Onkar has updated the pull request incrementally with one additional commit since the last revision:
> 
>   added screen insets to account for taskbar position, doc changes

I don't `JSplitPane` is a bad idea, rather the opposite: it's a good idea. It encapsulates a `JPanel` as a container for test UI. If a test doesn't add UI to that area (via a callback, or lambda or method reference, or any other way), the instructions UI could be left as the sole content of the frame. Otherwise, `JSplitPane` will separate the parts in the frame and will allow changing the size of the panes. It also mimics the original positioning strategy: vertical/horizontal.

In some tests, the test UI consists of a single button only. I think a single window for such test UI would work better than two separate and independent frames. One frame is easier to manage.

I was thinking about merging instructions and test UI from the start. Yet using two frames / windows seemed easier to implement.

Some test cases may not fit into either pattern. There's always the option to create test UI as needed. Yet positioning of the instruction frame may be an issue. If test creates windows / dialogs owned by the instruction frame, AWT ensures the test UI windows / dialogs are above the instruction frame; however, if test UI is large enough, it could completely overlap the instructions.

I guess some test cases may even be easier to implement and maintain with its own custom UI. Too many options in `PassFailJFrame` could make it harder to use.

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

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



More information about the client-libs-dev mailing list