RFR: 8339984: Open source AWT MenuItem related tests [v3]

Alexey Ivanov aivanov at openjdk.org
Wed Sep 18 10:12:09 UTC 2024


On Wed, 18 Sep 2024 04:25:55 GMT, Abhishek Kumar <abhiscxk at openjdk.org> wrote:

>> test/jdk/java/awt/MenuItem/LotsOfMenuItemsTest.java line 98:
>> 
>>> 96:         firstFrame.setLocation(970, 350);
>>> 97:         testFrame.setLocation(970, 510);
>>> 98:     }
>> 
>> Hard-coding coordinates is not the best solution. The workaround is to position the first frame using `PassFailJFrame` and then use the location of the first frame to position the second (test) frame.
>> Suggestion:
>> 
>>     @Override
>>     public void componentShown(ComponentEvent e) {
>>         PassFailJFrame.positionTestWindow(firstFrame,
>>                                           PassFailJFrame.Position.HORIZONTAL);
>>         testFrame.setLocation(firstFrame.getX(),
>>                               firstFrame.getY() + firstFrame.getWidth() + 8);
>>     }
>
> I gave a try to get PassFailFrame position but some error occured and then hard coded. I agree hard-coding is not a best solution and thanks for suggesting the other way around. A bit of correction in setting the testFrame location, y co-ordinate should be firstFrame.getY() + firstFrame.getHeight() + 8 else the gap is more between firstFrame and testFrame.

Yes, it should be `getHeight()`. I initially used `getSize().height` and then changed it to `getHeight()` and must have selected the wrong suggestion in IDE and ended up with `getWidth()` instead.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21029#discussion_r1764784210


More information about the client-libs-dev mailing list