Having been able to acquire a reference to the view, the next step is to deal with specific user interface components. For standard controls such as Button
and Text
, the bot
provides standard methods to acquire. To get hold of other components, the widget hierarchy will have to be interrogated directly.
In the
testTimeZoneView
method, get theWidget
from the returnedSWTBotView
.Create a
Matcher
using theWidgetMatcherFactory
to findwidgetsOfType(CTabItem.class)
.Use the
bot.widgets
method to search for a list ofCTabItem
instances in the view's widget.Ensure that the number of elements returned is equal to the number of time zone regions.
The code looks like:
SWTBotView timeZoneView = bot.viewByTitle("Time Zone View"); assertNotNull(timeZoneView); Widget widget = timeZoneView.getWidget(); org.hamcrest.Matcher<CTabItem> matcher = WidgetMatcherFactory.widgetOfType(CTabItem.class); final java.util.List<? extends CTabItem> ctabs = bot.widgets...