RFR: 8327924: Simplify TrayIconScalingTest.java

Phil Race prr at openjdk.org
Wed Mar 13 22:06:40 UTC 2024


On Tue, 12 Mar 2024 08:33:41 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:

> This is to simplify `TrayIconScalingTest.java`.
> 
> 1. Rename `createAndShowGUI` to `createAndShowTrayIcon` which is more specific.
> 2. Move creating tray icon to the top.
> 3. Streamline PassFailJFrame with the chained calls, including `awaitAndCheck`.
> 4. Ensure tray is not null before removing the icon.
> 5. Pass AWTException as the cause in the wrapped exception.
> 
> Previously, before the builder pattern was introduced, `PassFailJFrame.positionTestWindow` had had to be called to show the instructions UI. It's not required any more. Additionally, it has the effect of moving the instruction frame to the left, which doesn't look good and sometimes results in positioning the instructions outside of the screen bounds if the screen resolution is low.
> 
> With the builder pattern, the call to the `build` method shows all the registered windows on the screen, including the instruction frame. Since there's no secondary UI, the instructions remain in the centre of the screen.

Marked as reviewed by prr (Reviewer).

test/jdk/java/awt/TrayIcon/TrayIconScalingTest.java line 97:

> 95:                     .testTimeOut(8)
> 96:                     .rows(25)
> 97:                     .columns(70)

Personally I like rows+columns to immediately follow instructions,
but I'll approve anyway and let you decide.

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

PR Review: https://git.openjdk.org/jdk/pull/18224#pullrequestreview-1935292499
PR Review Comment: https://git.openjdk.org/jdk/pull/18224#discussion_r1523967651


More information about the client-libs-dev mailing list