Package org.fest.swing.fixture
Class JToolBarFixture
- All Implemented Interfaces:
ClientPropertyStorageFixture
,CommonComponentFixture
,ComponentContainerFixture
,FocusableComponentFixture
,JComponentFixture
,JPopupMenuInvokerFixture
,KeyboardInputSimulationFixture
,MouseInputSimulationFixture
,StateVerificationFixture
,ToolTipDisplayFixture
public class JToolBarFixture
extends ContainerFixture<JToolBar>
implements CommonComponentFixture, JComponentFixture, JPopupMenuInvokerFixture
Understands functional testing of
JToolBar
s:
- user input simulation
- state verification
- property value query
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Understands constraints used to unfloat a floating
.JToolBar
-
Field Summary
FieldsFields inherited from class org.fest.swing.fixture.ComponentFixture
BACKGROUND_PROPERTY, FONT_PROPERTY, FOREGROUND_PROPERTY, robot, target
Fields inherited from interface org.fest.swing.fixture.ComponentContainerFixture
DEFAULT_DIALOG_LOOKUP_TIMEOUT
-
Constructor Summary
ConstructorsConstructorDescriptionJToolBarFixture
(Robot robot, String toolbarName) Creates a new
.JToolBarFixture
JToolBarFixture
(Robot robot, JToolBar target) Creates a new
.JToolBarFixture
-
Method Summary
Modifier and TypeMethodDescriptionclick()
Simulates a user clicking this fixture's
.JToolBar
click
(MouseButton button) Simulates a user clicking this fixture's
.JToolBar
click
(MouseClickInfo mouseClickInfo) Simulates a user clicking this fixture's
.JToolBar
clientProperty
(Object key) Returns the client property stored in this fixture's
, under the given key.JToolBarFixture
private void
Simulates a user double-clicking this fixture's
.JToolBar
protected final void
driver
(JToolBarDriver newDriver) Sets the
to be used by this fixture.JToolBarDriver
Simulates a user dragging this fixture's
to the given location, causing it to float.JToolBar
focus()
Gives input focus to this fixture's
.JToolBar
pressAndReleaseKey
(KeyPressInfo keyPressInfo) Simulates a user pressing given key with the given modifiers on this fixture's
.JToolBar
pressAndReleaseKeys
(int... keyCodes) Simulates a user pressing and releasing the given keys in this fixture's
.JToolBar
pressKey
(int keyCode) Simulates a user pressing the given key on this fixture's
.JToolBar
releaseKey
(int keyCode) Simulates a user releasing the given key on this fixture's
.JToolBar
Asserts that this fixture's
is disabled.JToolBar
Asserts that this fixture's
is enabled.JToolBar
requireEnabled
(Timeout timeout) Asserts that this fixture's
is enabled.JToolBar
Asserts that this fixture's
has input focus.JToolBar
Asserts that this fixture's
is not visible.JToolBar
requireToolTip
(String expected) Asserts that the toolTip in this fixture's
matches the given value.JToolBar
requireToolTip
(Pattern pattern) Asserts that the toolTip in this fixture's
matches the given regular expression pattern.JToolBar
Asserts that this fixture's
is visible.JToolBar
Simulates a user right-clicking this fixture's
.JToolBar
Shows a pop-up menu using this fixture's
as the invoker of the pop-up menu.JToolBar
Shows a pop-up menu at the given point using this fixture's
as the invoker of the pop-up menu.JToolBar
unfloat()
Simulates a user unfloating this fixture's
.JToolBar
unfloat
(JToolBarFixture.UnfloatConstraint constraint) Simulates a user dropping this fixture'sJToolBar
to the requested constraint position.Methods inherited from class org.fest.swing.fixture.ContainerFixture
button, button, button, checkBox, checkBox, checkBox, comboBox, comboBox, comboBox, dialog, dialog, dialog, dialog, dialog, dialog, fileChooser, fileChooser, fileChooser, fileChooser, fileChooser, fileChooser, find, findByName, findByType, finder, label, label, label, list, list, list, menuItem, menuItem, menuItemWithPath, optionPane, optionPane, panel, panel, panel, progressBar, progressBar, progressBar, radioButton, radioButton, radioButton, scrollBar, scrollBar, scrollBar, scrollPane, scrollPane, scrollPane, slider, slider, slider, spinner, spinner, spinner, splitPane, splitPane, splitPane, tabbedPane, tabbedPane, tabbedPane, table, table, table, textBox, textBox, textBox, toggleButton, toggleButton, toggleButton, toolBar, toolBar, toolBar, tree, tree, tree, with
Methods inherited from class org.fest.swing.fixture.ComponentFixture
background, component, font, foreground, requireShowing, targetCastedTo, validateNotNull
-
Field Details
-
driver
-
-
Constructor Details
-
JToolBarFixture
Creates a new
.JToolBarFixture
- Parameters:
robot
- performs simulation of user events on the givenJToolBar
.target
- theJToolBar
to be managed by this fixture.- Throws:
NullPointerException
- ifrobot
isnull
.NullPointerException
- iftarget
isnull
.
-
JToolBarFixture
Creates a new
.JToolBarFixture
- Parameters:
robot
- performs simulation of user events on aJToolBar
.toolbarName
- the name of theJToolBar
to find using the givenRobot
.- Throws:
NullPointerException
- ifrobot
isnull
.ComponentLookupException
- if a matchingJToolBar
could not be found.ComponentLookupException
- if more than one matchingJToolBar
is found.
-
-
Method Details
-
createDriver
private void createDriver() -
driver
Sets the
to be used by this fixture.JToolBarDriver
- Parameters:
newDriver
- the newJToolBarDriver
.- Throws:
NullPointerException
- if the given driver isnull
.
-
floatTo
Simulates a user dragging this fixture's
to the given location, causing it to float.JToolBar
- Parameters:
point
- the point where theJToolBar
will be floating to.- Returns:
- this fixture.
- Throws:
ActionFailedException
- if theJToolBar
is not floatable.ActionFailedException
- if theJToolBar
cannot be dragged.
-
unfloat
Simulates a user unfloating this fixture's
.JToolBar
- Returns:
- this fixture.
- Throws:
ActionFailedException
- if the dock container cannot be found.
-
unfloat
Simulates a user dropping this fixture'sJToolBar
to the requested constraint position.- Parameters:
constraint
- the constraint position.- Returns:
- this fixture.
- Throws:
ActionFailedException
- if the dock container cannot be found.
-
click
Simulates a user clicking this fixture's
.JToolBar
- Specified by:
click
in interfaceMouseInputSimulationFixture
- Returns:
- this fixture.
-
click
Simulates a user clicking this fixture's
.JToolBar
- Specified by:
click
in interfaceMouseInputSimulationFixture
- Parameters:
button
- the button to click.- Returns:
- this fixture.
-
click
Simulates a user clicking this fixture's
.JToolBar
- Specified by:
click
in interfaceMouseInputSimulationFixture
- Parameters:
mouseClickInfo
- specifies the button to click and the times the button should be clicked.- Returns:
- this fixture.
- Throws:
NullPointerException
- if the givenMouseClickInfo
isnull
.
-
doubleClick
Simulates a user double-clicking this fixture's
.JToolBar
- Specified by:
doubleClick
in interfaceMouseInputSimulationFixture
- Returns:
- this fixture.
-
rightClick
Simulates a user right-clicking this fixture's
.JToolBar
- Specified by:
rightClick
in interfaceMouseInputSimulationFixture
- Returns:
- this fixture.
-
focus
Gives input focus to this fixture's
.JToolBar
- Specified by:
focus
in interfaceFocusableComponentFixture
- Returns:
- this fixture.
-
pressAndReleaseKey
Simulates a user pressing given key with the given modifiers on this fixture's
. Modifiers is a mask from the availableJToolBar
masks.InputEvent
- Specified by:
pressAndReleaseKey
in interfaceKeyboardInputSimulationFixture
- Parameters:
keyPressInfo
- specifies the key and modifiers to press.- Returns:
- this fixture.
- Throws:
NullPointerException
- if the givenKeyPressInfo
isnull
.IllegalArgumentException
- if the given code is not a valid key code.- See Also:
-
pressAndReleaseKeys
Simulates a user pressing and releasing the given keys in this fixture's
. This method does not affect the current focus.JToolBar
- Specified by:
pressAndReleaseKeys
in interfaceKeyboardInputSimulationFixture
- Parameters:
keyCodes
- the codes of the keys to press.- Returns:
- this fixture.
- Throws:
NullPointerException
- if the given array of codes isnull
.IllegalArgumentException
- if any of the given code is not a valid key code.- See Also:
-
pressKey
Simulates a user pressing the given key on this fixture's
.JToolBar
- Specified by:
pressKey
in interfaceKeyboardInputSimulationFixture
- Parameters:
keyCode
- the code of the key to press.- Returns:
- this fixture.
- Throws:
IllegalArgumentException
- if any of the given code is not a valid key code.- See Also:
-
releaseKey
Simulates a user releasing the given key on this fixture's
.JToolBar
- Specified by:
releaseKey
in interfaceKeyboardInputSimulationFixture
- Parameters:
keyCode
- the code of the key to release.- Returns:
- this fixture.
- Throws:
IllegalArgumentException
- if any of the given code is not a valid key code.- See Also:
-
requireFocused
Asserts that this fixture's
has input focus.JToolBar
- Specified by:
requireFocused
in interfaceFocusableComponentFixture
- Returns:
- this fixture.
- Throws:
AssertionError
- if this fixture'sJToolBar
does not have input focus.
-
requireEnabled
Asserts that this fixture's
is enabled.JToolBar
- Specified by:
requireEnabled
in interfaceStateVerificationFixture
- Returns:
- this fixture.
- Throws:
AssertionError
- if this fixture'sJToolBar
is disabled.
-
requireEnabled
Asserts that this fixture's
is enabled.JToolBar
- Specified by:
requireEnabled
in interfaceStateVerificationFixture
- Parameters:
timeout
- the time this fixture will wait for the component to be enabled.- Returns:
- this fixture.
- Throws:
WaitTimedOutError
- if this fixture'sJToolBar
is never enabled.
-
requireDisabled
Asserts that this fixture's
is disabled.JToolBar
- Specified by:
requireDisabled
in interfaceStateVerificationFixture
- Returns:
- this fixture.
- Throws:
AssertionError
- if this fixture'sJToolBar
is enabled.
-
requireVisible
Asserts that this fixture's
is visible.JToolBar
- Specified by:
requireVisible
in interfaceStateVerificationFixture
- Returns:
- this fixture.
- Throws:
AssertionError
- if this fixture'sJToolBar
is not visible.
-
requireNotVisible
Asserts that this fixture's
is not visible.JToolBar
- Specified by:
requireNotVisible
in interfaceStateVerificationFixture
- Returns:
- this fixture.
- Throws:
AssertionError
- if this fixture'sJToolBar
is visible.
-
requireToolTip
Asserts that the toolTip in this fixture's
matches the given value.JToolBar
- Specified by:
requireToolTip
in interfaceToolTipDisplayFixture
- Parameters:
expected
- the given value. It can be a regular expression.- Returns:
- this fixture.
- Throws:
AssertionError
- if the toolTip in this fixture'sJToolBar
does not match the given value.- Since:
- 1.2
-
requireToolTip
Asserts that the toolTip in this fixture's
matches the given regular expression pattern.JToolBar
- Specified by:
requireToolTip
in interfaceToolTipDisplayFixture
- Parameters:
pattern
- the regular expression pattern to match.- Returns:
- this fixture.
- Throws:
NullPointerException
- if the given regular expression pattern isnull
.AssertionError
- if the toolTip in this fixture'sJToolBar
does not match the given regular expression.- Since:
- 1.2
-
clientProperty
Returns the client property stored in this fixture's
, under the given key.JToolBarFixture
- Specified by:
clientProperty
in interfaceClientPropertyStorageFixture
- Parameters:
key
- the key to use to retrieve the client property.- Returns:
- the value of the client property stored under the given key, or
null
if the property was not found. - Throws:
NullPointerException
- if the given key isnull
.- Since:
- 1.2
-
showPopupMenu
Shows a pop-up menu using this fixture's
as the invoker of the pop-up menu.JToolBar
- Specified by:
showPopupMenu
in interfaceJPopupMenuInvokerFixture
- Returns:
- a fixture that manages the displayed pop-up menu.
- Throws:
IllegalStateException
- if this fixture'sJToolBar
is disabled.IllegalStateException
- if this fixture'sJToolBar
is not showing on the screen.ComponentLookupException
- if a pop-up menu cannot be found.
-
showPopupMenuAt
Shows a pop-up menu at the given point using this fixture's
as the invoker of the pop-up menu.JToolBar
- Specified by:
showPopupMenuAt
in interfaceJPopupMenuInvokerFixture
- Parameters:
p
- the given point where to show the pop-up menu.- Returns:
- a fixture that manages the displayed pop-up menu.
- Throws:
IllegalStateException
- if this fixture'sJToolBar
is disabled.IllegalStateException
- if this fixture'sJToolBar
is not showing on the screen.ComponentLookupException
- if a pop-up menu cannot be found.
-