RFR: 8315655: [macos] Right click and dragging over a component with a popup menu will open the popup [v6]

Prasanta Sadhukhan psadhukhan at openjdk.org
Mon Jun 10 06:01:18 UTC 2024


On Fri, 7 Jun 2024 21:19:41 GMT, Alisen Chung <achung at openjdk.org> wrote:

>> Issue is a mouse drag will trigger a popup in macos, but not in linux or windows.
>> The solution is to add a check for a mouse pressed event to show popup and prevent mouse entered events from triggering the popup
>
> Alisen Chung has updated the pull request incrementally with one additional commit since the last revision:
> 
>   update test based on feedback

test/jdk/javax/swing/JPopupMenu/MouseDragPopupTest.java line 40:

> 38:  * @bug 8315655
> 39:  * @key headful
> 40:  * @run main MouseDragPopupTest

summary tag missing

test/jdk/javax/swing/JPopupMenu/MouseDragPopupTest.java line 45:

> 43:     static volatile boolean failed;
> 44:     static volatile JFrame frame;
> 45:     static volatile JPanel panel;

frame and panel are/should be accessed in EDT only so no need for volatile

test/jdk/javax/swing/JPopupMenu/MouseDragPopupTest.java line 51:

> 49:     public static void main(String[] args) throws Exception {
> 50:         try {
> 51:             failed = false;

By default boolean class variable is false, no need to set explicitly..

test/jdk/javax/swing/JPopupMenu/MouseDragPopupTest.java line 71:

> 69:             dstPoint.translate(4 * d.width / 15, 0);
> 70: 
> 71: 

unnecessary line

test/jdk/javax/swing/JPopupMenu/MouseDragPopupTest.java line 84:

> 82:             robot.waitForIdle();
> 83: 
> 84:             robot.mouseRelease(InputEvent.BUTTON3_DOWN_MASK);

Better to release in `finally` block so that if unexpectedly any exception occurs it will not hamper any other test if tun as part of CI job..

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19569#discussion_r1632616431
PR Review Comment: https://git.openjdk.org/jdk/pull/19569#discussion_r1632616227
PR Review Comment: https://git.openjdk.org/jdk/pull/19569#discussion_r1632615767
PR Review Comment: https://git.openjdk.org/jdk/pull/19569#discussion_r1632616684
PR Review Comment: https://git.openjdk.org/jdk/pull/19569#discussion_r1632618131


More information about the client-libs-dev mailing list