Test is failed on windows citing that popup menu opened when mouse button is 
pressed and hold, 
doesn't get dismissed when mouse button is released outside the component area
 and pressing "Escape" key is needed to dismiss the popup

It is seen that in the test, PopupMenu.show() is invoked from mousePressed()
On Windows, the native peer uses a modal popup-menu [tracking 
loop](https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-trackpopupmenu).
 Because the menu is opened while the button is already down, the subsequent 
mouseReleased is not an outside-menu click that dismisses the native menu
The menu remains active until cancellation (Escape) or another menu action like 
selecting a menuitem.
It seems to be normal Win32 behaviour. TrackPopupMenu explicitly tracks user 
selection and delivers menu interaction to its owning window.

Linux/macos happens to treat that release as a dismissal, so the test 
instruction incorrectly assumes the Linux interaction model applies everywhere.
The test currently says a popup which “stays up and grabs all input” is a 
failure. On Windows, that condition is expected for a displayed native popup.

I have attached a native Win32 program in JBS which invokes TrackPopupMenuEx 
synchronously from WM_LBUTTONDOWN, equivalent to calling PopupMenu.show() from 
Java’s mousePressed().
If we press and hold the left button in either colored area, move outside the 
menu, and release, then the popup remains visible until Escape, selection, or a 
subsequent click—demonstrating the normal Win32 native-menu tracking behavior.

so the fix is made to not run the test in windows

---------
- [x] I confirm that I make this contribution in accordance with the [OpenJDK 
Interim AI Policy](https://openjdk.org/legal/ai).

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

Commit messages:
 - 8340022: java/awt/PopupMenu/PopupHangTest/PopupHangTest.java fails on windows

Changes: https://git.openjdk.org/jdk/pull/32699/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=32699&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8340022
  Stats: 2 lines in 2 files changed: 1 ins; 1 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/32699.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/32699/head:pull/32699

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

Reply via email to