Radio button selection ignored 3.7 [message #688842] |
Sat, 25 June 2011 23:37 |
Richard Adams Messages: 77 Registered: July 2009 Location: Edinburgh |
Member |
|
|
Hello,
We have just upgraded our Eclipse IDE and compilation target from 3.5 to 3.7, moving from SWTBot 2.0.0 to 2.0.4.
We've noticed that all our SWTBot tests that involve selecting radio buttons now fail - the
bot.radio(index).click() seems to be ignored and whatever was the default selection is used instead.
E.g., we have a menu item that opens a dialog with 5 radio button choices. By default the first radio button is checked. We have tests for clicking different radion buttons ( index 0-4 ) and testing the outcomes. Only the first test works.
E.g.,
openOutputDialog();
// by default first button is selected
// choose different radio option
bot.radio(3).click();
// if I test if this button is now selected, (e.g., SWTBotRadio.isSelected) this now returns true but for some reason it seems to have no effect?
clickOK();
Has anything changed in the way button selections are handled in 3.7?
Thanks
Richard
Dr Richard Adams, University of Edinburgh
http://richardadams606blog.blogspot.com/
http://csbe.bio.ed.ac.uk/adams.php
|
|
|
|
Re: Radio button selection ignored 3.7 [message #688852 is a reply to message #688844] |
Sun, 26 June 2011 00:29 |
Richard Adams Messages: 77 Registered: July 2009 Location: Edinburgh |
Member |
|
|
I seem to have fixed it by adding in the following code to deselect the default selection before clicking on the new selection ( Fixed as in, my previously passing tests are now passing again )
void deselectDefaultSelection() {
UIThreadRunnable
.syncExec(new VoidResult() {
public void run() {
Matcher<Widget> matcher = allOf(widgetOfType(Button.class), withStyle(SWT.RADIO, "SWT.RADIO"));
Button b = (Button) bot.widget(matcher, 0); // the default selection
b.setSelection(false);
}
});
}
So in the SWRBotRadio.click() method, when a new radio button is selected, it seems that the old one is sent a setSelection(false), the new one a setSelection(true), both of these must fire selection events, which are now being detected in the 'wrong' order since I upgraded to 3.7 for whatever reason. (I'm guessing a bit here).
Hope this is useful in case anyone else encounters the same problem.
Dr Richard Adams, University of Edinburgh
http://richardadams606blog.blogspot.com/
http://csbe.bio.ed.ac.uk/adams.php
|
|
|
Re: Radio button selection ignored 3.7 [message #689230 is a reply to message #688852] |
Mon, 27 June 2011 07:52 |
Mariot Chauvin Messages: 174 Registered: July 2009 |
Senior Member |
|
|
Hi Richard,
Could you open a bugzilla with all information you mention here.
Thanks,
Regards,
Mariot
Le 26/06/2011 02:29, Richard Adams a écrit :
> I seem to have fixed it by adding in the following code to deselect the
> default selection before clicking on the new selection ( Fixed as in, my
> previously passing tests are now passing again )
>
> void deselectDefaultSelection() {
> UIThreadRunnable
> .syncExec(new VoidResult() {
>
> public void run() {
> Matcher<Widget> matcher = allOf(widgetOfType(Button.class),
> withStyle(SWT.RADIO, "SWT.RADIO"));
>
> Button b = (Button) bot.widget(matcher, 0); // the default selection
> b.setSelection(false);
>
> }
>
> });
> }
>
> So in the SWRBotRadio.click() method, when a new radio button is
> selected, it seems that the old one is sent a setSelection(false), the
> new one a setSelection(true), both of these must fire selection events,
> which are now being detected in the 'wrong' order since I upgraded to
> 3.7 for whatever reason. (I'm guessing a bit here).
>
> Hope this is useful in case anyone else encounters the same problem.
--
Mariot Chauvin @ Obeo
Blog : http://mariot-thoughts.blogspot.com
Twitter :http://twitter.com/mchv
Professional support : http://obeo.fr/pages/maintenance-and-support/
|
|
|
|
Powered by
FUDForum. Page generated in 0.07437 seconds