United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-7124354 [macosx] PopipMenuTest is not functional in JCK-runtime-7 interactive
JDK-7124354 : [macosx] PopipMenuTest is not functional in JCK-runtime-7 interactive

Details
Type:
Bug
Submit Date:
2011-12-23
Status:
Closed
Updated Date:
2012-09-25
Project Name:
JDK
Resolved Date:
2012-03-19
Component:
client-libs
OS:
os_x
Sub-Component:
java.awt
CPU:
generic
Priority:
P2
Resolution:
Fixed
Affected Versions:
7
Fixed Versions:
7u4 (b11)

Related Reports

Sub Tasks

Description
http://java.net/jira/browse/MACOSX_PORT-460 submitted 2011/09/27 by Ludmila Shikhvarg
api/java_awt/interactive/PMenuTests_PMenuTests fails in JCK-runtime-7 interactive with jdk7 Build b208.
PopipMenuTest0001
-----------------
Descriptions:
Right click the right mouse button to bring up a popupmenu. A popup menu should come up and it should contain one menu item.
Actual results.
Right click the right mouse button do not bring up a popupmenu.
PopipMenuTest0002
-----------------
Descriptions:
Right click the right mouse button to bring up a popupmenu. A popup menu should come up and it should contain one menu item & one submenu. A 2-item cascade should come up when the mouse is dragged over the submenu of the popup menu.
Actual results.
Right click the right mouse button do not bring up a popupmenu.

                                    

Comments
EVALUATION

Author: Artem Ananiev Date: 27/Sep/11 09:40 PM
I'm not sure that on MacOSX right-clicking should bring a popup menu, or it should be Cmd/Ctrl+click...
 
Author: Mike Swingler Date: 27/Sep/11 11:59 PM
Both right-click AND ctrl-click are popup triggers, however unlike on other platforms, the mouse-down is the popup trigger, not the mouse-up (or implicitly the mouse-clicked).
 
Author: Leonid Romanov Date: 28/Sep/11 03:27 PM
Hmm, this is strange: right click doesn't bring the popup menu, but ctrl+left click does. However, the way that popup menu becomes visible escapes me: whatever code path is taken, it doesn't even call NSEvent.isPopupTrigger(), which I've verified to be working correctly. Need to investigate more.
 
Author: Leonid Romanov Date: 29/Sep/11 04:03 PM
We display popup menus with Cocoa help, by returning NSMenu instance to show from -(NSMenu *)menuForEvent:(NSEvent *)theEvent, which we override in our AWTView class. However, -menuForEvent is only called as result of ctrl+left click, probably because NSView calls  -menuForEvent from -rightMouseDown and AWTView overrides it (this makes me wonder how ctrl+left click case is handled inside Cocoa, since AWTView also overrides -mouseDown). 
The fix seems to be to implement -rightMouseDown like this:
<div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;><div class=&quot;codeContent panelContent&quot;><pre class=&quot;code-java&quot;>- (void) rightMouseDown: (NSEvent *)event {    NSMenu *m;    m = [self menuForEvent: event];    <span class=&quot;code-keyword&quot;>if</span> (m) {        [NSMenu popUpContextMenu: m                       withEvent: event                         forView: self];    } <span class=&quot;code-keyword&quot;>else</span> {            [self deliverJavaMouseEvent: event];    }}</pre>
Author: Leonid Romanov Date: 04/Oct/11 11:59 AM
Attaching simplified test case
 
Author: Leonid Romanov Date: 04/Oct/11 12:04 PM
There is another issue with popup menus: ctrl+left clicking after popup menu has been programatically  removed from parent component leads to crash. 
Steps to reproduce:
<ul class=&quot;alternate&quot; type=&quot;square&quot;>
.Run PopupTest.java
.Ctrl+left click on the frame area to bring the popup menu
.Select the menu item
.Rigth click on the frame area to remove the menu from the parent component
.Ctrl+left click again. Crash. 
Author: peng.sun Date: 16/Nov/11 07:55 AM
Following i18n tests failing. b217.
GS-Manual/TitleViewRenderTest
 
Author: Artem Ananiev Date: 09/Dec/11 02:55 PM
I would not show any popup menus from the toolkit code and leave it up to the application code, this is how popups behave on other platforms. isPopupTrigger should be &quot;true&quot; for both right-click and ctrl+click.
                                     
2011-12-23



Hardware and Software, Engineered to Work Together