Issue Details (XML | Word | Printable)

Key: FEST-104
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Alex Ruiz
Reporter: Tony Eichelberger
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
FEST

Calling click() on JMenuItemFixture should not take focus away from a text component

Created: 19/Mar/09 04:16 PM   Updated: 28/Apr/09 07:53 PM   Resolved: 28/Apr/09 07:53 PM
Component/s: Swing
Affects Version/s: FEST-Swing 1.1
Fix Version/s: FEST-Swing 1.2a1

Time Tracking:
Not Specified

Environment: Java 6, fest 1.0, Max OSX, Windows XP


 Description  « Hide

I am trying to verify the copy and paste menu functions and I ran into this issue.

I type in some text into a JTextField and then highlight it. Next I click on the Edit menu and select Copy.

When the robot clicks on Edit, the focus is lost on the text component and the hightlight goes away. So the Copy action then copies nothing.

I can run through this scenario manually and everything works fine.

The test was passing in Fest version 0.8 and is broken in version 1.0.



Martin Bachmann added a comment - 21/Apr/09 02:23 PM

I ran into a similar issue and I think the problem is due to the following code:
public void BasicRobot.click(Component c, Point where, MouseButton button, int times) { if (c != null) focus(c); // ...more code... }

What's the rationale for this focus() call in click?

What I wanted to test when I came across the problem was the following: I have a component that opens a popup menu in a similar manner as a JComboBox. My test should ensure that the component closes the popup menu if another component is clicked that is not focusable (e.g. JPanel). With the call to focus() as depicted above my component gets a FOCUS_LOST event when calling panelFixture.click(). This does not happen if I click the JPanel manually in the application.