RFR: 8317116: Provide layouts for multiple test UI in PassFailJFrame [v2]

Alexander Zvegintsev azvegint at openjdk.org
Fri Sep 27 14:19:40 UTC 2024


On Thu, 26 Sep 2024 13:57:09 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:

>> Provides a set of default layouts for manual test using multiple test UI windows.
>> 
>> The initial implementation in the demo in #15721 was too complicated. After looking at the simplified version used in #21180, I re-worked the layouts into separate methods.
>> 
>> The layout methods are in `WindowLayouts` class next to `PassFailJFrame`. It is not necessary to mention it explicitly in the `@build` jtreg tag.
>> 
>> The builder now provides new methods:
>> 
>> - `positionTestUIRightRow` positions the test UI windows in a row to the right of the instruction frame. The top of the windows is aligned to that of the instruction frame.
>> - `positionTestUIRightColumn` positions the test UI windows in a column to the right of the instruction frame. The top of the first window is aligned to that of the instruction frame.
>> - `positionTestUIRightColumnCentered` positions the test UI windows in a column to the right of the instruction frame centering the stack of the windows.
>> - `positionTestUIBottomRow` positions the test UI windows in a row to the bottom of the instruction frame. The left of the first window is aligned to that of the instruction frame.
>> - `positionTestUIBottomRowCentered` positions the test UI windows in a row to the bottom of the instruction frame centering the row of the windows.
>> - `positionTestUIBottomColumn` positions the test UI windows in a column to the bottom of the instruction frame. The left of the first window is aligned to that of the instruction frame.
>> 
>> If required, the test developer can provide a custom implementation.
>
> Alexey Ivanov has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Add missing parentheses for vertical positioning

test/jdk/java/awt/regtesthelpers/PassFailJFrame.java line 1405:

> 1403:          * Positions the test UI windows in a row to the right of
> 1404:          * the instruction frame. The top of the windows is aligned to
> 1405:          * that of the instruction frame.

Since we are touching this, what are our options for positioning the instruction frame?

The `.position(PassFailJFrame.Position.TOP_LEFT_CORNER)` has no effect now with positionTestUIRightRow:


        PassFailJFrame.builder()
                      .instructions(INSTRUCTIONS)
                      .rows(15)
                      .columns(30)
                      .testUI(() -> WindowCreator.createTestWindows(2))
                      .position(PassFailJFrame.Position.TOP_LEFT_CORNER)
                      .positionTestUIRightRow()
                      .build()
                      .awaitAndCheck();


Should we provide a way to place instruction frame in arbitrary location on screen?
It will allow us to provide more flexibility and more advanced layouts without too much effort from a test developer.

test/jdk/java/awt/regtesthelpers/WindowLayouts.java line 133:

> 131:     public static void bottomOneRowCentered(final List<Window> windows,
> 132:                                             final PassFailJFrame.InstructionUI instructionUI) {
> 133:         layoutColumn(getScreenCenter().x

Suggestion:

        layoutRow(getScreenCenter().x


typo.

test/jdk/java/awt/regtesthelpers/WindowLayouts.java line 175:

> 173:             x += w.getWidth() + WINDOW_GAP;
> 174:         }
> 175: 

Suggestion:

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21207#discussion_r1778689582
PR Review Comment: https://git.openjdk.org/jdk/pull/21207#discussion_r1778670409
PR Review Comment: https://git.openjdk.org/jdk/pull/21207#discussion_r1778699306


More information about the client-libs-dev mailing list