Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test fails when selecting a menu item with a too long label #14

Open
GoogleCodeExporter opened this issue Mar 24, 2015 · 4 comments
Open

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
See the attached file.I've added a new test case (canSelectLongItems).

What is the expected output? What do you see instead?
A green bar on JUnit. I get a red one and the error message:

Tried to find:
    screen dimensions of exactly 1 JMenuItem (with text matching 'This is just a very simple example')
    in exactly 1 JMenu (with text matching 'File')
    in exactly 1 JMenuBar (same(<javax.swing.JMenuBar[menuBar,0,0,115x21,layout=javax.swing.plaf.basic.DefaultMenuLayout,alignmentX=0.0,alignmentY=0.0,border=javax.swing.plaf.basic.BasicBorders$MenuBarBorder@cd5f8b,flags=392,maximumSize=,minimumSize=,preferredSize=,margin=,paintBorder=true]>))
    in  the exact JFrame '"javax.swing.JFrame[componentViewer,0,0,123x97,invalid,layout=java.awt.BorderLayout,title=JMenuBarDriverTest,resizable,normal,defaultCloseOperation=DISPOSE_ON_CLOSE,rootPane=javax.swing.JRootPane[,4,30,115x63,layout=javax.swing.JRootPane$RootLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=16777673,maximumSize=,minimumSize=,preferredSize=],rootPaneCheckingEnabled=true]"' 
but:

    contained 1 JMenuBar (same(<javax.swing.JMenuBar[menuBar,0,0,115x21,layout=javax.swing.plaf.basic.DefaultMenuLayout,alignmentX=0.0,alignmentY=0.0,border=javax.swing.plaf.basic.BasicBorders$MenuBarBorder@cd5f8b,flags=392,maximumSize=,minimumSize=,preferredSize=,margin=,paintBorder=true]>))
    contained 1 JMenu (with text matching 'File')
    contained 1 JMenuItem (with text matching 'This is just a very simple example')
    which had no screen dimensions


What version of the product are you using? On what operating system?
I've just got the last snapshot from SVN

Please provide any additional information below.

I think the problem is due to the JMenuItemDriver.leftClickOnComponent method 
which performs firstly an horizontal movement than a vertical one. It can cause 
the mouse pointer to miss the menu scope and let it close if the menu item 
label is too long.
A possible fix is to use createVerticalThenHorizontalMouseMoveGesture instead.
BTW, should createVerticalThenHorizontalMouseMoveGesture and 
horizontalThenVerticalMouseMove methods called accordingly each other?

Original issue reported on code.google.com by [email protected] on 25 Nov 2010 at 3:35

Attachments:

@GoogleCodeExporter
Copy link
Author

how to solve this problem? I can't find the 
createVerticalThenHorizontalMouseMoveGesture in the source code? Does this mean 
I have to modify the source code and rebuild it for this reason?

Original comment by [email protected] on 26 Apr 2011 at 2:37

@GoogleCodeExporter
Copy link
Author

I've attached my fix.

Original comment by [email protected] on 26 Apr 2011 at 2:56

Attachments:

@GoogleCodeExporter
Copy link
Author

Thank you very much. This way we still need to rebuild the whole jar. I think 
it's a little bug of windowlicker, it will be better if this problem solved.

Original comment by [email protected] on 26 Apr 2011 at 3:03

@GoogleCodeExporter
Copy link
Author

One way to solve this problem without rebuilding is to extend the 
JMenuItemDriver and override the leftClickOnComponent() method. It's not a 
perfect way, but this won't cause problem of the jar version.

thank you fago!

Original comment by [email protected] on 26 Apr 2011 at 3:23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant