Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 394153 - Submenus of ContextMenus are not opened under special circumstances (Swing under Mac)
Summary: Submenus of ContextMenus are not opened under special circumstances (Swing un...
Status: CLOSED FIXED
Alias: None
Product: Jubula
Classification: Technology
Component: RC (show other bugs)
Version: 1.3.0   Edit
Hardware: Macintosh Mac OS X
: P3 normal (vote)
Target Milestone: Kepler   Edit
Assignee: Marvin Mueller CLA
QA Contact: Oliver Goetz CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-13 03:27 EST by Marvin Mueller CLA
Modified: 2013-01-15 02:43 EST (History)
1 user (show)

See Also:


Attachments
Logfile of the failed steps of the Mac context menu tests (216.99 KB, application/zip)
2012-11-13 03:27 EST, Marvin Mueller CLA
no flags Details
Changing the mouse movment into small steps.(using MouseMovementStrategy) (1.96 KB, patch)
2012-11-13 03:51 EST, Marvin Mueller CLA
no flags Details | Diff
patch for bug (3.17 KB, patch)
2012-11-13 05:05 EST, Marvin Mueller CLA
no flags Details | Diff
Fix for Bug (2.97 KB, patch)
2012-11-13 05:57 EST, Marvin Mueller CLA
no flags Details | Diff
Updated Bugfix (4.64 KB, patch)
2012-11-15 06:02 EST, Marvin Mueller CLA
markus.tiede: iplog+
Details | Diff
Test results (212.98 KB, application/empty)
2013-01-15 02:43 EST, Oliver Goetz CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marvin Mueller CLA 2012-11-13 03:27:10 EST
Created attachment 223481 [details]
Logfile of the failed steps of the Mac context menu tests

In the tests for Context menus under Mac there are failing test steps, because the submenu is not opened.(Test result attached)

SubeMenus are opened over a Mouseover and it seems that this mouseover does not trigger the expanding of the submenu. 
This is only the case if the mouse did not move before opening the context
menu. This problem happens only in TabbedPanes and Trees because they are big
enough. So that after the first context menu, with opening submenu "More", the
mouse do not have to move to open the next context menu for the same graphics
component. And the next test step fails, because the submenu is not expanded(but the mouse is over the specific item).

The mouse movement is done only in one step, in other words it is jumping to the target. If the mouse moves in small steps into the contextmenu the submenu is expanded.
Comment 1 Marvin Mueller CLA 2012-11-13 03:51:39 EST
Created attachment 223483 [details]
Changing the mouse movment into small steps.(using MouseMovementStrategy)

I have created a patch which solves this issue. I implemented the mouse movement Strategy which is used in SWT.
So the mouse moves in 1pixel step to its target and the submenu is expanded.
Comment 2 Markus Tiede CLA 2012-11-13 04:27:25 EST
The attached file is not a valid git applicable patch: corrupt patch at line 41.

You can check on your own before attaching via "git apply <path2patch> --check". Please re-attach a valid patch file for this.
Comment 3 Marvin Mueller CLA 2012-11-13 05:05:14 EST
Created attachment 223490 [details]
patch for bug

I have created the patch and checked it, now it should be working
Comment 4 Markus Tiede CLA 2012-11-13 05:10:25 EST
The code is not Java 1.4 compatible as it makes use of a Java 1.5 class "MouseInfo" -  please adjust the code to be 1.4 compatible.
Comment 5 Marvin Mueller CLA 2012-11-13 05:57:11 EST
Created attachment 223492 [details]
Fix for Bug

i have changed the MouseInfo to the MouseMotionTracker which is used in the robot.
Comment 6 Markus Tiede CLA 2012-11-13 06:02:43 EST
The patch has been reviewed and applied with changeset

http://git.eclipse.org/c/jubula/org.eclipse.jubula.core.git/commit/?id=fd3b10c7d17ebfcf65762f25565e44107459f79e
Comment 7 Markus Tiede CLA 2012-11-14 04:27:43 EST
All nightly swing regression tests failed due to a "Configuration Error" on Mac OS X:

2012-11-13 23:18:28.017 [Connection.ReaderThread:Socket[addr=macguidancer.bredex.de/10.54.48.192,port=54432,localport=54438]] ERROR o.e.j.r.c.c.AbstractCapTestCommand - InvocationTargetException: 
java.lang.reflect.InvocationTargetException: null
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_35]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_35]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_35]
	at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_35]
	at org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:281) ~[org.apache.commons.beanutils_1.8.0.v201205091237.jar:na]
	at org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:225) ~[org.apache.commons.beanutils_1.8.0.v201205091237.jar:na]
	at org.eclipse.jubula.rc.common.commands.MethodInvoker.invoke(MethodInvoker.java:64) ~[org.eclipse.jubula.rc.common_2.0.0.201211131148.jar:na]
	at org.eclipse.jubula.rc.common.commands.AbstractCapTestCommand.execute(AbstractCapTestCommand.java:231) ~[org.eclipse.jubula.rc.common_2.0.0.201211131148.jar:na]
	at org.eclipse.jubula.communication.Communicator$ConnectionListener.received(Communicator.java:845) [org.eclipse.jubula.communication_2.0.0.201211131148.jar:na]
	at org.eclipse.jubula.communication.connection.Connection.fireMessageReceived(Connection.java:402) [org.eclipse.jubula.communication_2.0.0.201211131148.jar:na]
	at org.eclipse.jubula.communication.connection.Connection.access$3(Connection.java:391) [org.eclipse.jubula.communication_2.0.0.201211131148.jar:na]
	at org.eclipse.jubula.communication.connection.Connection$ReaderThread.run(Connection.java:454) [org.eclipse.jubula.communication_2.0.0.201211131148.jar:na]
Caused by: java.lang.IllegalArgumentException: Initial point must not be null.
	at org.apache.commons.lang.Validate.notNull(Validate.java:203) ~[org.apache.commons.lang_2.4.0.v201005080502.jar:na]
	at org.eclipse.jubula.rc.common.driver.MouseMovementStrategy.getMovementPath(MouseMovementStrategy.java:52) ~[org.eclipse.jubula.rc.common_2.0.0.201211131148.jar:na]
	at org.eclipse.jubula.rc.swing.swing.driver.RobotAwtImpl.moveImpl(RobotAwtImpl.java:477) ~[org.eclipse.jubula.rc.swing_2.0.0.201211131148.jar:na]
	at org.eclipse.jubula.rc.swing.swing.driver.RobotAwtImpl.clickImpl(RobotAwtImpl.java:290) ~[org.eclipse.jubula.rc.swing_2.0.0.201211131148.jar:na]
	at org.eclipse.jubula.rc.swing.swing.driver.RobotAwtImpl.click(RobotAwtImpl.java:505) ~[org.eclipse.jubula.rc.swing_2.0.0.201211131148.jar:na]
	at org.eclipse.jubula.rc.swing.swing.implclasses.AbstractSwingImplClass.gdClick(AbstractSwingImplClass.java:490) ~[org.eclipse.jubula.rc.swing_2.0.0.201211131148.jar:na]
	... 12 common frames omitted

Due to that I reverted the previous change with changeset:

http://git.eclipse.org/c/jubula/org.eclipse.jubula.core.git/commit/?id=57be7f2ce10985d9da414e46d4929f5223f4805a

Please provide a cross-platform working solution.
Comment 8 Marvin Mueller CLA 2012-11-15 06:02:39 EST
Created attachment 223595 [details]
Updated Bugfix

I have updated the Bugfix, so that for the starting point the center of the root component is used. But only if there is no last Point of the MouseMotionTracker.
 
The Problem is similar to the context menu Problem. It seems that the PreMove did not trigger an Event, and the MouseMotionTracker last position is not set.
Comment 9 Markus Tiede CLA 2012-11-16 03:48:36 EST
The patch has again been reviewed and applied with changeset

http://git.eclipse.org/c/jubula/org.eclipse.jubula.core.git/commit/?id=955cfda52f66cf571e80e14393368fc55dae251f
Comment 10 Marvin Mueller CLA 2012-12-10 05:14:29 EST
Since we have changed the MouseMovement to fix another issue, we have reintroduced this Problem.(We are not using MouseMovement for ContextMenus at the moment).

I am on it.
Comment 11 Marvin Mueller CLA 2012-12-10 08:52:26 EST
In Swing now the MouseMovementStrategy is used the hole time. Which fixes the problem as described prior.
I changed the mouse movement for the first cascade of an JMenuBar, so that there is no Problem with using the MouseMovementStrategy anymore.

Fixed with:
http://git.eclipse.org/c/jubula/org.eclipse.jubula.core.git/commit/?id=2e8d1ac14ae1183a8b282c84e0b376e0b99d2849



But now SWT and Swing differs in the use of the mouse movement in the menus and context menus. Since SWT does not use the mouse movement for none of them.
It would be a nice idea to introduce the same movement in the SWT implementation (that on menus the first movement is on the y axis).
Comment 12 Marvin Mueller CLA 2012-12-18 04:18:12 EST
Since the enhancement Bug 394179 this issue reoccurs.
The fix is only implemented in the old classes, and must be implemented for the refactored classes.
Comment 14 Oliver Goetz CLA 2013-01-15 02:42:23 EST
Swing context menu tests were executed successfully this weekend (see attached test results). Closing this ticket.
Comment 15 Oliver Goetz CLA 2013-01-15 02:43:11 EST
Created attachment 225602 [details]
Test results