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

Alexey Ivanov aivanov at openjdk.org
Thu Aug 11 21:05:12 UTC 2022


On Fri, 5 Aug 2022 23:50:57 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:
> 
>   helper method added to sync location

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

> 311:             syncLocationToWindowManager();
> 312:             if (testWindow != null) {
> 313:                 testWindow.setLocation(frame.getX(),

Just a thought: Should the window be centered to the instruction frame rather left-aligned?

Left-aligned is simpler, it could be easier to scan too.

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

> 328: 
> 329:     // this method pushes the updated frame location to window manager
> 330:     // before it is used to reposition the test window.

Make it javadoc, so that when you hover over the method, the IDE shows you description of the method.

>From our discussions, it is to ensure the frame location is updated _by the window manager_ if it adjusts the frame location.

test/jdk/javax/swing/JTabbedPane/4209065/bug4209065.java line 51:

> 49:     public static void createAndShowGUI() {
> 50: 
> 51:             frame = new JFrame("JTabbedPane");

Shall the indentation be adjusted? Four spaces to the left?

test/jdk/javax/swing/JTabbedPane/4209065/bug4209065.java line 77:

> 75:         passFailJFrame.awaitAndCheck();
> 76:     }
> 77: }

Let us add the final line break.

test/jdk/javax/swing/JTable/PrintAllPagesTest.java line 73:

> 71:         // Arrange the test instruction frame and test frame side by side
> 72:         PassFailJFrame.positionTestWindow(f, PassFailJFrame.Position.HORIZONTAL);
> 73:         f.setVisible(true);

It should be called on EDT if `f` is a `JFrame`.

And `positionTestWindow` should be too because the instruction frame is a `JFrame`. Yet it complicates the code a lot. Dealing with `positionTestWindow` could and should be postponed, it was overlooked or as its javadoc says it was to be called from EDT.

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

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



More information about the client-libs-dev mailing list