RFR: JDK-8340555 : Open source DnD tests - Set4 [v6]

Alexey Ivanov aivanov at openjdk.org
Wed Oct 2 15:59:47 UTC 2024


On Wed, 2 Oct 2024 15:18:16 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:

>> Harshitha Onkar has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   review comment fixes
>
> test/jdk/java/awt/dnd/DragSourceMotionListenerTest.java line 172:
> 
>> 170:                 d[0] = target.getSize();
>> 171:                 dstInsidePoint.translate(d[0].width / 2, d[0].height / 2);
>> 172:                 testPoint2.setLocation(dstInsidePoint);
> 
> The same issue:
> Suggestion:
> 
>                 Point p = target.getLocationOnScreen();
>                 Dimension d = target.getSize();
>                 p.translate(d.width / 2, d.height / 2);
>                 dstInsidePoint = p;
>                 testPoint2.setLocation(p);

In fact, you can merge the three calls to `invokeAndWait` into one which uses a private helper method.

The location and size of the components and the frame don't change after you first showed the UI.

So, you can calculate the value for `srcPoint`, `dstOutsidePoint` and `dstInsidePoint` in one call into `invokeAndWait`. It would look cleaner.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21213#discussion_r1784780525


More information about the client-libs-dev mailing list