Package org.fest.swing.driver
Class JTabbedPaneDriver
java.lang.Object
org.fest.swing.driver.ComponentDriver
org.fest.swing.driver.ContainerDriver
org.fest.swing.driver.JComponentDriver
org.fest.swing.driver.JTabbedPaneDriver
Understands functional testing of
JTabbedPanes:
- user input simulation
- state verification
- property value query
org.fest.swing.fixture in your tests.-
Field Summary
FieldsFields inherited from class org.fest.swing.driver.ComponentDriver
robot -
Constructor Summary
ConstructorsConstructorDescriptionJTabbedPaneDriver(Robot robot) Creates a newJTabbedPaneDriver.JTabbedPaneDriver(Robot robot, JTabbedPaneLocation location) Creates a newJTabbedPaneDriver. -
Method Summary
Modifier and TypeMethodDescriptionprivate static String[]allTabTitlesIn(JTabbedPane tabbedPane) private voidmoveMouseToTab(JTabbedPane tabbedPane, int index) private static PointpointAtTab(JTabbedPaneLocation location, JTabbedPane tabbedPane, int index) voidrequireTabTitle(JTabbedPane tabbedPane, String title, Index index) Asserts that the title of the tab at the given index matches the given value.voidrequireTabTitle(JTabbedPane tabbedPane, Pattern pattern, Index index) Asserts that the title of the tab at the given index matches the given regular expression pattern.voidrequireTabTitles(JTabbedPane tabbedPane, String[] titles) Asserts that the tabs of the givenhave the given titles.JTabbedPaneprivate static ComponentselectedComponent(JTabbedPane tabbedPane) selectedComponentOf(JTabbedPane tabbedPane) Returns the currently selected component for the given.JTabbedPanevoidselectTab(JTabbedPane tabbedPane, int index) Simulates a user selecting the tab located at the given index.voidselectTab(JTabbedPane tabbedPane, String title) Simulates a user selecting the tab containing the given title.voidselectTab(JTabbedPane tabbedPane, Pattern pattern) Simulates a user selecting the tab whose title matches the given regular expression pattern.private voidselectTab(JTabbedPane tabbedPane, TextMatcher matcher) (package private) voidsetTabDirectly(JTabbedPane tabbedPane, int index) String[]tabTitles(JTabbedPane tabbedPane) Returns the titles of all the tabs.tabToSelectInfo(JTabbedPaneLocation location, JTabbedPane tabbedPane, TextMatcher matcher) private static StringtitleAt(JTabbedPane tabbedPane, Index index) private org.fest.assertions.DescriptiontitleAtProperty(JTabbedPane tabbedPane) private static PointvalidateAndGetPoint(JTabbedPaneLocation location, JTabbedPane tabbedPane, int index) Methods inherited from class org.fest.swing.driver.JComponentDriver
clientProperty, invokeAction, isVisible, isVisible, requireToolTip, requireToolTip, scrollToVisibleMethods inherited from class org.fest.swing.driver.ContainerDriver
move, resize, resizeHeight, resizeWidthMethods inherited from class org.fest.swing.driver.ComponentDriver
assertIsEnabledAndShowing, click, click, click, click, click, doubleClick, drag, dragOver, drop, focus, focusAndWaitForFocusGain, invokePopupMenu, invokePopupMenu, moveMouseIgnoringAnyError, moveMouseIgnoringAnyError, performAccessibleActionOf, pressAndReleaseKey, pressAndReleaseKey, pressAndReleaseKeys, pressKey, propertyName, releaseKey, requireDisabled, requireEnabled, requireEnabled, requireFocused, requireNotVisible, requireSize, requireVisible, rightClick, settings, waitForShowing
-
Field Details
-
location
-
-
Constructor Details
-
JTabbedPaneDriver
Creates a newJTabbedPaneDriver.- Parameters:
robot- the robot to use to simulate user input.
-
JTabbedPaneDriver
JTabbedPaneDriver(Robot robot, JTabbedPaneLocation location) Creates a newJTabbedPaneDriver.- Parameters:
robot- the robot to use to simulate user input.location- knows how to find the location of a tab.
-
-
Method Details
-
tabTitles
Returns the titles of all the tabs.- Parameters:
tabbedPane- the targetJTabbedPane.- Returns:
- the titles of all the tabs.
-
selectTab
Simulates a user selecting the tab containing the given title.- Parameters:
tabbedPane- the targetJTabbedPane.title- the given text to match. It can be a regular expression.- Throws:
IllegalStateException- if theJTabbedPaneis disabled.IllegalStateException- if theJTabbedPaneis not showing on the screen.LocationUnavailableException- if a tab matching the given title could not be found.
-
selectTab
Simulates a user selecting the tab whose title matches the given regular expression pattern.- Parameters:
tabbedPane- the targetJTabbedPane.pattern- the regular expression pattern to match.- Throws:
IllegalStateException- if theJTabbedPaneis disabled.IllegalStateException- if theJTabbedPaneis not showing on the screen.NullPointerException- if the given regular expression pattern isnull.LocationUnavailableException- if a tab matching the given regular expression pattern could not be found.- Since:
- 1.2
-
selectTab
-
tabToSelectInfo
@RunsInEDT private static Pair<Integer,Point> tabToSelectInfo(JTabbedPaneLocation location, JTabbedPane tabbedPane, TextMatcher matcher) -
selectTab
Simulates a user selecting the tab located at the given index.- Parameters:
tabbedPane- the targetJTabbedPane.index- the index of the tab to select.- Throws:
IllegalStateException- if theJTabbedPaneis disabled.IllegalStateException- if theJTabbedPaneis not showing on the screen.IndexOutOfBoundsException- if the given index is not within theJTabbedPanebounds.
-
validateAndGetPoint
@RunsInEDT private static Point validateAndGetPoint(JTabbedPaneLocation location, JTabbedPane tabbedPane, int index) -
setTabDirectly
-
moveMouseToTab
-
pointAtTab
@RunsInEDT private static Point pointAtTab(JTabbedPaneLocation location, JTabbedPane tabbedPane, int index) -
selectedComponentOf
Returns the currently selected component for the given.JTabbedPane- Parameters:
tabbedPane- the targetJTabbedPane.- Returns:
- the currently selected component for the given
JTabbedPane.
-
selectedComponent
-
requireTabTitle
Asserts that the title of the tab at the given index matches the given value.- Parameters:
tabbedPane- the targetJTabbedPane.title- the expected title. It can be a regular expression.index- the index of the tab.- Throws:
IndexOutOfBoundsException- if the given index is not within theJTabbedPanebounds.AssertionError- if the title of the tab at the given index does not match the given one.
-
requireTabTitle
Asserts that the title of the tab at the given index matches the given regular expression pattern.- Parameters:
tabbedPane- the targetJTabbedPane.pattern- the regular expression pattern to match.index- the index of the tab.- Throws:
NullPointerException- if the given regular expression pattern isnull.IndexOutOfBoundsException- if the given index is not within theJTabbedPanebounds.AssertionError- if the title of the tab at the given index does not match the given one.- Since:
- 1.2
-
titleAtProperty
-
titleAt
-
requireTabTitles
Asserts that the tabs of the givenhave the given titles. The tab titles are evaluated by index order, for example, the first tab is expected to have the first title in the given array, and so on.JTabbedPane- Parameters:
tabbedPane- the targetJTabbedPane.titles- the expected titles.- Throws:
AssertionError- if the title of any of the tabs is not equal to the expected titles.
-
allTabTitlesIn
-