Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » Radio button selection ignored 3.7(Radio button selection ignored 3.7)
Radio button selection ignored 3.7 [message #688842] Sat, 25 June 2011 23:37 Go to next message
Richard Adams is currently offline Richard AdamsFriend
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


Re: Radio button selection ignored 3.7 [message #688844 is a reply to message #688842] Sat, 25 June 2011 23:40 Go to previous messageGo to next message
Richard Adams is currently offline Richard AdamsFriend
Messages: 77
Registered: July 2009
Location: Edinburgh
Member
Some more information..
Each radio button has a listener that records the selection. I put a debug breakpoint in the selection listener, which seems to be called twice. The first time, it is called with the correct selection, but then it is called again with the original selection, overriding the intended radio selection.
This is with a single bot.radio(index).click() invocation - why is the button selection listener called twice?


Re: Radio button selection ignored 3.7 [message #688852 is a reply to message #688844] Sun, 26 June 2011 00:29 Go to previous messageGo to next message
Richard Adams is currently offline Richard AdamsFriend
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.


Re: Radio button selection ignored 3.7 [message #689230 is a reply to message #688852] Mon, 27 June 2011 07:52 Go to previous messageGo to next message
Mariot Chauvin is currently offline Mariot ChauvinFriend
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/
Re: Radio button selection ignored 3.7 [message #692879 is a reply to message #689230] Tue, 05 July 2011 11:52 Go to previous message
Richard Adams is currently offline Richard AdamsFriend
Messages: 77
Registered: July 2009
Location: Edinburgh
Member
This is actually in SWTBot Bugzilla already: https://bugs.eclipse.org/bugs/show_bug.cgi?id=344484
and I've posted the workaround there


Previous Topic:How to restart RCP application for each case?
Next Topic:How to check RCPmail "Open in New Window" ?
Goto Forum:
  


Current Time: Thu Mar 28 09:53:58 GMT 2024

Powered by FUDForum. Page generated in 0.02065 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top