jjnair / fest

Automatically exported from code.google.com/p/fest
0 stars 0 forks source link

JSpinnerDriver#enterText enters text without focus #306

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi,

When entering text in a JSpinner's editor with JSpinnerFixture#enterText or
#enterTextAndCommit, the input gets lost sometimes.
The problem is that JSpinnerDriver doesn't wait for the editor to gain
focus before starting to enter the text.

In JSpinnerDriver#enterText robot.focus(editor) should be changed to
robot.focusAndWaitForFocusGain(editor).

The problem comes from the fact that a JSpinner's default editor uses a
JFormattedTextField, which can format its text differently depending on
whether it has focus or not.
So we must allow the editor to gain focus before giving it input, otherwise
the input might get overwritten with the last commited value from the model.

Regards,
Csabi

Original issue reported on code.google.com by csaba.ju...@gmail.com on 6 Feb 2009 at 7:54

GoogleCodeExporter commented 8 years ago

Original comment by Alex.Rui...@gmail.com on 6 Feb 2009 at 4:27

GoogleCodeExporter commented 8 years ago
Hi Csabi,

It makes a lot of sense. To fix it, I'd prefer to start with a test case. I'm 
really
cannot come up with one (after several tries.) Do you have one in mind?

Thanks!
-Alex

Original comment by Alex.Rui...@gmail.com on 9 Feb 2009 at 6:57

GoogleCodeExporter commented 8 years ago
Csabi, you are right. Even without a test case the behavior should be as you
described. I'll fix it.

Original comment by Alex.Rui...@gmail.com on 9 Feb 2009 at 7:23

GoogleCodeExporter commented 8 years ago
Hi Csabi,

The fix for this bug can be found at
http://code.google.com/p/fest/source/detail?r=2269 (r2269). Please feel free to
review it.

Thanks!
-Alex

Original comment by Alex.Rui...@gmail.com on 9 Feb 2009 at 7:27

GoogleCodeExporter commented 8 years ago
Hi Alex,

I had a lot of test cases which failed, I think, because of this issue.

Regards,
Csabi

P.S. I think that we should investigate if #focus should be replaced with
#focusAndWaitForFocusGain in general.

Original comment by csaba.ju...@gmail.com on 9 Feb 2009 at 1:48

GoogleCodeExporter commented 8 years ago
Issue migrated to http://kenai.com/jira/browse/FEST-19

Original comment by Alex.Rui...@gmail.com on 14 Feb 2009 at 10:03

GoogleCodeExporter commented 8 years ago
Issue migrated to http://jira.codehaus.org/browse/FEST-21

Original comment by Alex.Rui...@gmail.com on 2 Mar 2009 at 7:43