Finding a "Widget" object for WidgetDisposedCondition()

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

Finding a "Widget" object for WidgetDisposedCondition()

Postby ajbetz » Thu Feb 10, 2011 4:57 pm

I am trying to write a new WidgetDisposedCondition condition for a progress bar widget in my application. Basically, I want my test to just wait while this progress bar is still being shown (as long as the progress bar is viewable / on screen / found, then my operation is still going ... the test should just wait while this is true).

WidgetDisposedCondition() takes a constructor parameter of type org.eclipse.swt.widgets.Widget. I have been looking over the SWTWidgetLocator methods to try and understand how I can get a reference to this widget, but found no method that returns a valid type.

Here's what I have in my code that compiles:

Code: Select all
ui.wait(new WidgetDisposedCondition((Widget) new SWTWidgetLocator(ProgressBar.class, new ViewLocator("myView")).findAll(ui)[0]));

I have not tried this code out yet, but I have my suspicious as to whether or not it would be reliable to use, just because it looks "messy".

Is there a better way to write what it is I am trying to do, or a better way to reference this Widget object?
Posts: 17
Joined: Wed Jan 05, 2011 4:10 pm
Location: Beaverton, OR

Return to Window Tester

Who is online

Users browsing this forum: No registered users and 1 guest