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

Alexey Ivanov aivanov at openjdk.org
Tue Aug 23 14:39:58 UTC 2022


On Mon, 22 Aug 2022 22:32:50 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:
> 
>   minor change to positionTestWindow javadoc

Changes requested by aivanov (Reviewer).

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

> 266:      * is null, only the instruction frame is positioned according to
> 267:      * {@code position} parameter. This method should be called before making
> 268:      * the test window visible.

Suggestion:

     * Approximately positions the instruction frame relative to the test
     * window as specified by the {@code position} parameter. If {@code testWindow}
     * is {@code null}, only the instruction frame is positioned according to
     * {@code position} parameter.
     * <p>This method should be called before making the test window visible
     * to avoid flickering.

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

> 268:      * the test window visible.
> 269:      *
> 270:      * @param testWindow test window that the test is created.

Suggestion:

     * @param testWindow test window that the test created.

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

> 285:      *                  such that its top left corner is at the top left corner of
> 286:      *                  the screen and the test window (if not null) is placed to
> 287:      *                  the right of the instruction frame.

Such formatting looks good in the source code, yet in Javadoc (which is never created, I know) and in a tooltip in an IDE, it becomes unreadable because there are no breaks.

I propose to use a list:


     * @param position  position must be one of:
     *                  <ul>
     *                  <li>{@code HORIZONTAL} - the test instruction frame is positioned
     *                  such that its right edge aligns with screen's horizontal
     *                  center and the test window (if not {@code null}) is placed to
     *                  the right of the instruction frame.
     *
     *                  <li>{@code VERTICAL} - the test instruction frame is positioned such
     *                  that its bottom edge aligns with the screen's vertical
     *                  center and the test window (if not {@code null}) is placed below
     *                  the instruction frame.
     *
     *                  <li>{@code TOP_LEFT_CORNER} - the test instruction frame is positioned
     *                  such that its top left corner is at the top left corner of
     *                  the screen and the test window (if not {@code null}) is placed to
     *                  the right of the instruction frame.
     *                  </ul>


For consistency, with `testWindow` parameter, I put `{@code}` around `null`.

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

> 291: 
> 292:         // to get the screen insets inorder to position the frame by taking into
> 293:         // account the location of taskbar/menubars on screen

Suggestion:

        // Get the screen insets in order to position the frame by taking into
        // account the location of taskbar/menubars on screen

Maybe drop _“in order”_?

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

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



More information about the client-libs-dev mailing list