Test pushed state of contributed items

WindowTester allows you to easily create and run unit tests for every GUI they build. It can also be used to generate system level tests.

Moderators: gnebling, Eric Clayberg, Dan Rubel, keertip, Phil Quitslund

Test pushed state of contributed items

Postby Steffen8708 » Wed Jan 14, 2009 2:17 am

Hi,

I would like to test the pushed state of a contribute tool item. Unfortunately, the ContributedToolItemLocator does not support this. Is there any other possibility to do this?

Regards,
Steffen
Steffen8708
 
Posts: 29
Joined: Tue Nov 04, 2008 7:11 am

Re: Test pushed state of contributed items

Postby Phil Quitslund » Thu Jan 15, 2009 2:55 pm

Is this the selection state of the ToolItem? Can you do something like this?:

Code: Select all
IWidgetReference ref = (IWidgetReference)ui.find(new ContributedToolItemLocator("..."));
final ToolItem item = (ToolItem)ref.getWidget();
final boolean[] select = new boolean[1];
Display.getDefault().syncExec(
   new Runnable(){
      public void run() {
         select[0] = item.getSelection();
      }
   }
);
assertTrue(select[0]);
--
Phil Quitslund
Software Engineer
Google, Inc.
Phil Quitslund
Moderator
 
Posts: 491
Joined: Fri Apr 28, 2006 6:26 am

Re: Test pushed state of contributed items

Postby Steffen8708 » Tue Jan 20, 2009 4:31 am

Of course, that's it!

Thanks,
Steffen
Steffen8708
 
Posts: 29
Joined: Tue Nov 04, 2008 7:11 am

Re: Test pushed state of contributed items

Postby Phil Quitslund » Mon Jan 26, 2009 1:40 pm

Good deal! And thinking about it some more... If you think there may be a race condition with the select test, you might wrap this test in a condition:

http://downloads.instantiations.com/Win ... tions.html
--
Phil Quitslund
Software Engineer
Google, Inc.
Phil Quitslund
Moderator
 
Posts: 491
Joined: Fri Apr 28, 2006 6:26 am


Return to Window Tester

Who is online

Users browsing this forum: No registered users and 1 guest