Package org.fest.swing.fixture
Class JScrollBarFixture
- All Implemented Interfaces:
ClientPropertyStorageFixture
,CommonComponentFixture
,FocusableComponentFixture
,JComponentFixture
,JPopupMenuInvokerFixture
,KeyboardInputSimulationFixture
,MouseInputSimulationFixture
,StateVerificationFixture
,ToolTipDisplayFixture
public class JScrollBarFixture
extends ComponentFixture<JScrollBar>
implements CommonComponentFixture, JComponentFixture, JPopupMenuInvokerFixture
Understands functional testing of
JScrollBar
s:
- user input simulation
- state verification
- property value query
-
Field Summary
FieldsFields inherited from class org.fest.swing.fixture.ComponentFixture
BACKGROUND_PROPERTY, FONT_PROPERTY, FOREGROUND_PROPERTY, robot, target
-
Constructor Summary
ConstructorsConstructorDescriptionJScrollBarFixture
(Robot robot, String scrollBarName) Creates a new
.JScrollBarFixture
JScrollBarFixture
(Robot robot, JScrollBar target) Creates a new
.JScrollBarFixture
-
Method Summary
Modifier and TypeMethodDescriptionclick()
Simulates a user clicking this fixture's
.JScrollBar
click
(MouseButton button) Simulates a user clicking this fixture's
.JScrollBar
click
(MouseClickInfo mouseClickInfo) Simulates a user clicking this fixture's
.JScrollBar
clientProperty
(Object key) Returns the client property stored in this fixture's
, under the given key.JScrollBar
private void
Simulates a user double-clicking this fixture's
.JScrollBar
protected final void
driver
(JScrollBarDriver newDriver) Sets the
to be used by this fixture.JScrollBarDriver
focus()
Gives input focus to this fixture's
.JScrollBar
pressAndReleaseKey
(KeyPressInfo keyPressInfo) Simulates a user pressing given key with the given modifiers on this fixture's
.JScrollBar
pressAndReleaseKeys
(int... keyCodes) Simulates a user pressing and releasing the given keys on the
managed by this fixture.JScrollBar
pressKey
(int keyCode) Simulates a user pressing the given key on this fixture's
.JScrollBar
releaseKey
(int keyCode) Simulates a user releasing the given key on this fixture's
.JScrollBar
Asserts that this fixture's
is disabled.JScrollBar
Asserts that this fixture's
is enabled.JScrollBar
requireEnabled
(Timeout timeout) Asserts that this fixture's
is enabled.JScrollBar
Asserts that this fixture's
has input focus.JScrollBar
Asserts that this fixture's
is not visible.JScrollBar
requireToolTip
(String expected) Asserts that the toolTip in this fixture's
matches the given value.JScrollBar
requireToolTip
(Pattern pattern) Asserts that the toolTip in this fixture's
matches the given regular expression pattern.JScrollBar
requireValue
(int value) Asserts that the value of this fixture's
is equal to the given one.JScrollBar
Asserts that this fixture's
is visible.JScrollBar
Simulates a user right-clicking this fixture's
.JScrollBar
Simulates a user scrolling down one block (usually a page.)scrollBlockDown
(int times) Simulates a user scrolling down one block (usually a page,) the given number of times.Simulates a user scrolling up one block (usually a page.)scrollBlockUp
(int times) Simulates a user scrolling up one block (usually a page,) the given number of times.scrollTo
(int position) Simulates a user scrolling to the given position.Simulates a user scrolling to the maximum position of this fixture's
.JScrollBar
Simulates a user scrolling to the minimum position of this fixture's
.JScrollBar
Simulates a user scrolling down one unit (usually a line.)scrollUnitDown
(int times) Simulates a user scrolling down one unit (usually a line,) the given number of times.Simulates a user scrolling up one unit (usually a line.)scrollUnitUp
(int times) Simulates a user scrolling up one unit (usually a line,) the given number of times.Shows a pop-up menu using this fixture's
as the invoker of the pop-up menu.JScrollBar
Shows a pop-up menu at the given point using this fixture's
as the invoker of the pop-up menu.JScrollBar
Methods inherited from class org.fest.swing.fixture.ComponentFixture
background, component, font, foreground, requireShowing, targetCastedTo, validateNotNull
-
Field Details
-
driver
-
-
Constructor Details
-
JScrollBarFixture
Creates a new
.JScrollBarFixture
- Parameters:
robot
- performs simulation of user events on the givenJScrollBar
.target
- theJScrollBar
to be managed by this fixture.- Throws:
NullPointerException
- ifrobot
isnull
.NullPointerException
- iftarget
isnull
.
-
JScrollBarFixture
Creates a new
.JScrollBarFixture
- Parameters:
robot
- performs simulation of user events on aJScrollBar
.scrollBarName
- the name of theJScrollBar
to find using the givenRobot
.- Throws:
NullPointerException
- ifrobot
isnull
.ComponentLookupException
- if a matchingJScrollBar
could not be found.ComponentLookupException
- if more than one matchingJScrollBar
is found.
-
-
Method Details
-
createDriver
private void createDriver() -
driver
Sets the
to be used by this fixture.JScrollBarDriver
- Parameters:
newDriver
- the newJScrollBarDriver
.- Throws:
NullPointerException
- if the given driver isnull
.
-
click
Simulates a user clicking this fixture's
.JScrollBar
- Specified by:
click
in interfaceMouseInputSimulationFixture
- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJScrollBar
is disabled.IllegalStateException
- if this fixture'sJScrollBar
is not showing on the screen.
-
click
Simulates a user clicking this fixture's
.JScrollBar
- Specified by:
click
in interfaceMouseInputSimulationFixture
- Parameters:
button
- the button to click.- Returns:
- this fixture.
- Throws:
NullPointerException
- if the givenMouseButton
isnull
.IllegalStateException
- if this fixture'sJScrollBar
is disabled.IllegalStateException
- if this fixture'sJScrollBar
is not showing on the screen.
-
click
Simulates a user clicking this fixture's
.JScrollBar
- 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
.IllegalStateException
- if this fixture'sJScrollBar
is disabled.IllegalStateException
- if this fixture'sJScrollBar
is not showing on the screen.
-
doubleClick
Simulates a user double-clicking this fixture's
.JScrollBar
- Specified by:
doubleClick
in interfaceMouseInputSimulationFixture
- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJScrollBar
is disabled.IllegalStateException
- if this fixture'sJScrollBar
is not showing on the screen.
-
rightClick
Simulates a user right-clicking this fixture's
.JScrollBar
- Specified by:
rightClick
in interfaceMouseInputSimulationFixture
- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJScrollBar
is disabled.IllegalStateException
- if this fixture'sJScrollBar
is not showing on the screen.
-
focus
Gives input focus to this fixture's
.JScrollBar
- Specified by:
focus
in interfaceFocusableComponentFixture
- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJScrollBar
is disabled.IllegalStateException
- if this fixture'sJScrollBar
is not showing on the screen.
-
pressAndReleaseKey
Simulates a user pressing given key with the given modifiers on this fixture's
. Modifiers is a mask from the availableJScrollBar
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.IllegalStateException
- if this fixture'sJScrollBar
is disabled.IllegalStateException
- if this fixture'sJScrollBar
is not showing on the screen.- See Also:
-
pressAndReleaseKeys
Simulates a user pressing and releasing the given keys on the
managed by this fixture.JScrollBar
- Specified by:
pressAndReleaseKeys
in interfaceKeyboardInputSimulationFixture
- Parameters:
keyCodes
- one or more 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.IllegalStateException
- if this fixture'sJScrollBar
is disabled.IllegalStateException
- if this fixture'sJScrollBar
is not showing on the screen.- See Also:
-
pressKey
Simulates a user pressing the given key on this fixture's
.JScrollBar
- 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.IllegalStateException
- if this fixture'sJScrollBar
is disabled.IllegalStateException
- if this fixture'sJScrollBar
is not showing on the screen.- See Also:
-
releaseKey
Simulates a user releasing the given key on this fixture's
.JScrollBar
- 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.IllegalStateException
- if this fixture'sJScrollBar
is disabled.IllegalStateException
- if this fixture'sJScrollBar
is not showing on the screen.- See Also:
-
scrollBlockDown
Simulates a user scrolling down one block (usually a page.)- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJScrollBar
is disabled.IllegalStateException
- if this fixture'sJScrollBar
is not showing on the screen.
-
scrollBlockDown
Simulates a user scrolling down one block (usually a page,) the given number of times.- Parameters:
times
- the number of times to scroll down one block.- Returns:
- this fixture.
- Throws:
IllegalArgumentException
- iftimes
is less than or equal to zero.IllegalStateException
- if this fixture'sJScrollBar
is disabled.IllegalStateException
- if this fixture'sJScrollBar
is not showing on the screen.
-
scrollBlockUp
Simulates a user scrolling up one block (usually a page.)- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJScrollBar
is disabled.IllegalStateException
- if this fixture'sJScrollBar
is not showing on the screen.
-
scrollBlockUp
Simulates a user scrolling up one block (usually a page,) the given number of times.- Parameters:
times
- the number of times to scroll up one block.- Returns:
- this fixture.
- Throws:
IllegalArgumentException
- iftimes
is less than or equal to zero.IllegalStateException
- if this fixture'sJScrollBar
is disabled.IllegalStateException
- if this fixture'sJScrollBar
is not showing on the screen.
-
scrollTo
Simulates a user scrolling to the given position.- Parameters:
position
- the position to scroll to.- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJScrollBar
is disabled.IllegalStateException
- if this fixture'sJScrollBar
is not showing on the screen.IllegalArgumentException
- if the given position is not within theJScrollBar
bounds.
-
scrollToMaximum
Simulates a user scrolling to the maximum position of this fixture's
.JScrollBar
- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJScrollBar
is disabled.IllegalStateException
- if this fixture'sJScrollBar
is not showing on the screen.
-
scrollToMinimum
Simulates a user scrolling to the minimum position of this fixture's
.JScrollBar
- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJScrollBar
is disabled.IllegalStateException
- if this fixture'sJScrollBar
is not showing on the screen.
-
scrollUnitDown
Simulates a user scrolling down one unit (usually a line.)- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJScrollBar
is disabled.IllegalStateException
- if this fixture'sJScrollBar
is not showing on the screen.
-
scrollUnitDown
Simulates a user scrolling down one unit (usually a line,) the given number of times.- Parameters:
times
- the number of times to scroll down one unit.- Returns:
- this fixture.
- Throws:
IllegalArgumentException
- iftimes
is less than or equal to zero.IllegalStateException
- if this fixture'sJScrollBar
is disabled.IllegalStateException
- if this fixture'sJScrollBar
is not showing on the screen.
-
scrollUnitUp
Simulates a user scrolling up one unit (usually a line.)- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJScrollBar
is disabled.IllegalStateException
- if this fixture'sJScrollBar
is not showing on the screen.
-
scrollUnitUp
Simulates a user scrolling up one unit (usually a line,) the given number of times.- Parameters:
times
- the number of times to scroll up one unit.- Returns:
- this fixture.
- Throws:
IllegalArgumentException
- iftimes
is less than or equal to zero.IllegalStateException
- if this fixture'sJScrollBar
is disabled.IllegalStateException
- if this fixture'sJScrollBar
is not showing on the screen.
-
requireValue
Asserts that the value of this fixture's
is equal to the given one.JScrollBar
- Parameters:
value
- the expected value.- Returns:
- this fixture.
- Throws:
AssertionError
- if the value of this fixture'sJScrollBar
is not equal to the given one.
-
requireFocused
Asserts that this fixture's
has input focus.JScrollBar
- Specified by:
requireFocused
in interfaceFocusableComponentFixture
- Returns:
- this fixture.
- Throws:
AssertionError
- if this fixture'sJScrollBar
does not have input focus.
-
requireEnabled
Asserts that this fixture's
is enabled.JScrollBar
- Specified by:
requireEnabled
in interfaceStateVerificationFixture
- Returns:
- this fixture.
- Throws:
AssertionError
- if this fixture'sJScrollBar
is disabled.
-
requireEnabled
Asserts that this fixture's
is enabled.JScrollBar
- 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'sJScrollBar
is never enabled.
-
requireDisabled
Asserts that this fixture's
is disabled.JScrollBar
- Specified by:
requireDisabled
in interfaceStateVerificationFixture
- Returns:
- this fixture.
- Throws:
AssertionError
- if this fixture'sJScrollBar
is enabled.
-
requireVisible
Asserts that this fixture's
is visible.JScrollBar
- Specified by:
requireVisible
in interfaceStateVerificationFixture
- Returns:
- this fixture.
- Throws:
AssertionError
- if this fixture'sJScrollBar
is not visible.
-
requireNotVisible
Asserts that this fixture's
is not visible.JScrollBar
- Specified by:
requireNotVisible
in interfaceStateVerificationFixture
- Returns:
- this fixture.
- Throws:
AssertionError
- if this fixture'sJScrollBar
is visible.
-
showPopupMenu
Shows a pop-up menu using this fixture's
as the invoker of the pop-up menu.JScrollBar
- Specified by:
showPopupMenu
in interfaceJPopupMenuInvokerFixture
- Returns:
- a fixture that manages the displayed pop-up menu.
- Throws:
IllegalStateException
- if this fixture'sJScrollBar
is disabled.IllegalStateException
- if this fixture'sJScrollBar
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.JScrollBar
- 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'sJScrollBar
is disabled.IllegalStateException
- if this fixture'sJScrollBar
is not showing on the screen.ComponentLookupException
- if a pop-up menu cannot be found.
-
clientProperty
Returns the client property stored in this fixture's
, under the given key.JScrollBar
- 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
-
requireToolTip
Asserts that the toolTip in this fixture's
matches the given value.JScrollBar
- 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'sJScrollBar
does not match the given value.- Since:
- 1.2
-
requireToolTip
Asserts that the toolTip in this fixture's
matches the given regular expression pattern.JScrollBar
- 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'sJScrollBar
does not match the given regular expression.- Since:
- 1.2
-