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

Phil Race prr at openjdk.org
Tue Jul 19 23:13:48 UTC 2022


On Tue, 19 Jul 2022 06:57:39 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:
> 
>   window positioning changes

Changes requested by prr (Reviewer).

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

> 271:      *                  as arranged up and down.
> 272:      *                  TOP_LEFT_CORNER - test instruction frame positioned at
> 273:      *                  top left corner with main test window beside it.

All of these descriptions are lacking in explaining what goes where
eg
HORIZONTAL should say the instruction window will be placed so that the right edge is to the left of the screen's horizontal centre and the test window will be placed just to the right of it.

TOP_LEFT_CORNER should say the instruction window will be placed so that its top left corner is at the top left corner of the screen and the test window will be placed just to the right of the instruction window.

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

> 275:     public static void positionTestWindow(Window testWindow, Position position) {
> 276:         Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
> 277: 

In this method we "randomly" use getX(), or getLocation().x and getY() or  and getLocation().y 
Why can't we be consistent and pick one style ? Seems like getX() and getY() would fit best here.

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

> 290:         }
> 291:         else if (position.equals(Position.TOP_LEFT_CORNER)) {
> 292:             frame.setLocation(0,0);

I am very sceptical of this. With a toolbar on the left and a menu bar on the top of the screen I bet you
are neither at x=0 or y=0.
And this code is not allowing the desktop to reposition it and report the updated REAL position back to you
The result will be overlapping windows.
I'm actually dubious of the existing code for much the same reason but it just likely hasn't been seen as a problem there because positioning in the middle of the screen usually gets you where you asked for.

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

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



More information about the client-libs-dev mailing list