Package org.fest.swing.fixture
Class JScrollPaneFixture
- All Implemented Interfaces:
ClientPropertyStorageFixture,CommonComponentFixture,FocusableComponentFixture,JComponentFixture,JPopupMenuInvokerFixture,KeyboardInputSimulationFixture,MouseInputSimulationFixture,StateVerificationFixture,ToolTipDisplayFixture
public class JScrollPaneFixture
extends ComponentFixture<JScrollPane>
implements CommonComponentFixture, JPopupMenuInvokerFixture, JComponentFixture
Understands functional testing of
JScrollPanes:
- 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
ConstructorsConstructorDescriptionJScrollPaneFixture(Robot robot, String panelName) Creates a new.JScrollPaneFixtureJScrollPaneFixture(Robot robot, JScrollPane target) Creates a new.JScrollPaneFixture -
Method Summary
Modifier and TypeMethodDescriptionclick()Simulates a user clicking this fixture's.JScrollPaneclick(MouseButton button) Simulates a user clicking this fixture's.JScrollPaneclick(MouseClickInfo mouseClickInfo) Simulates a user clicking this fixture's.JScrollPaneclientProperty(Object key) Returns the client property stored in this fixture's, under the given key.JScrollPaneSimulates a user double-clicking this fixture's.JScrollPaneprotected final voiddriver(JScrollPaneDriver newDriver) Sets theto be used by this fixture.JScrollPaneDriverfocus()Gives input focus to this fixture's.JScrollPaneprivate JScrollPaneDriverpressAndReleaseKey(KeyPressInfo keyPressInfo) Simulates a user pressing given key with the given modifiers on this fixture's.JScrollPanepressAndReleaseKeys(int... keyCodes) Simulates a user pressing and releasing the given keys on themanaged by this fixture.JScrollPanepressKey(int keyCode) Simulates a user pressing the given key on this fixture's.JScrollPanereleaseKey(int keyCode) Simulates a user releasing the given key on this fixture's.JScrollPaneAsserts that this fixture'sis disabled.JScrollPaneAsserts that this fixture'sis enabled.JScrollPanerequireEnabled(Timeout timeout) Asserts that this fixture'sis enabled.JScrollPaneAsserts that this fixture'shas input focus.JScrollPaneAsserts that this fixture'sis not visible.JScrollPanerequireToolTip(String expected) Asserts that the toolTip in this fixture'smatches the given value.JScrollPanerequireToolTip(Pattern pattern) Asserts that the toolTip in this fixture'smatches the given regular expression pattern.JScrollPaneAsserts that this fixture'sis visible.JScrollPaneSimulates a user right-clicking this fixture's.JScrollPaneprivate JScrollBarFixturescrollBarFixture(JScrollBar scrollBar) Shows a pop-up menu using this fixture'sas the invoker of the pop-up menu.JScrollPaneShows a pop-up menu at the given point using this fixture'sas the invoker of the pop-up menu.JScrollPaneMethods inherited from class org.fest.swing.fixture.ComponentFixture
background, component, font, foreground, requireShowing, targetCastedTo, validateNotNull
-
Field Details
-
driver
-
-
Constructor Details
-
JScrollPaneFixture
Creates a new.JScrollPaneFixture- Parameters:
robot- performs simulation of user events on the givenJScrollPane.target- theJScrollPaneto be managed by this fixture.- Throws:
NullPointerException- ifrobotisnull.IllegalArgumentException- iftargetisnull.
-
JScrollPaneFixture
Creates a new.JScrollPaneFixture- Parameters:
robot- performs simulation of user events on aJScrollPane.panelName- the name of theJScrollPaneto find using the givenRobot.- Throws:
NullPointerException- ifrobotisnull.ComponentLookupException- if a matchingJScrollPanecould not be found.ComponentLookupException- if more than one matchingJScrollPaneis found.
-
-
Method Details
-
driver
Sets theto be used by this fixture.JScrollPaneDriver- Parameters:
newDriver- the newJScrollPaneDriver.- Throws:
NullPointerException- if the given driver isnull.
-
newComponentDriver
-
horizontalScrollBar
- Returns:
- a fixture managing the horizontal
JScrollBarof this target'sJScrollPane.
-
verticalScrollBar
- Returns:
- a fixture managing the vertical
JScrollBarof this target'sJScrollPane.
-
scrollBarFixture
-
click
Simulates a user clicking this fixture's.JScrollPane- Specified by:
clickin interfaceMouseInputSimulationFixture- Returns:
- this fixture.
- Throws:
IllegalStateException- if this fixture'sJScrollPaneis disabled.IllegalStateException- if this fixture'sJScrollPaneis not showing on the screen.
-
click
Simulates a user clicking this fixture's.JScrollPane- Specified by:
clickin interfaceMouseInputSimulationFixture- Parameters:
button- the button to click.- Returns:
- this fixture.
- Throws:
NullPointerException- if the givenMouseButtonisnull.IllegalStateException- if this fixture'sJScrollPaneis disabled.IllegalStateException- if this fixture'sJScrollPaneis not showing on the screen.
-
click
Simulates a user clicking this fixture's.JScrollPane- Specified by:
clickin interfaceMouseInputSimulationFixture- Parameters:
mouseClickInfo- specifies the button to click and the times the button should be clicked.- Returns:
- this fixture.
- Throws:
NullPointerException- if the givenMouseClickInfoisnull.IllegalStateException- if this fixture'sJScrollPaneis disabled.IllegalStateException- if this fixture'sJScrollPaneis not showing on the screen.
-
doubleClick
Simulates a user double-clicking this fixture's.JScrollPane- Specified by:
doubleClickin interfaceMouseInputSimulationFixture- Returns:
- this fixture.
- Throws:
IllegalStateException- if this fixture'sJScrollPaneis disabled.IllegalStateException- if this fixture'sJScrollPaneis not showing on the screen.
-
rightClick
Simulates a user right-clicking this fixture's.JScrollPane- Specified by:
rightClickin interfaceMouseInputSimulationFixture- Returns:
- this fixture.
- Throws:
IllegalStateException- if this fixture'sJScrollPaneis disabled.IllegalStateException- if this fixture'sJScrollPaneis not showing on the screen.
-
focus
Gives input focus to this fixture's.JScrollPane- Specified by:
focusin interfaceFocusableComponentFixture- Returns:
- this fixture.
- Throws:
IllegalStateException- if this fixture'sJScrollPaneis disabled.IllegalStateException- if this fixture'sJScrollPaneis 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 availableJScrollPanemasks.InputEvent- Specified by:
pressAndReleaseKeyin interfaceKeyboardInputSimulationFixture- Parameters:
keyPressInfo- specifies the key and modifiers to press.- Returns:
- this fixture.
- Throws:
NullPointerException- if the givenKeyPressInfoisnull.IllegalArgumentException- if the given code is not a valid key code.IllegalStateException- if this fixture'sJScrollPaneis disabled.IllegalStateException- if this fixture'sJScrollPaneis not showing on the screen.- See Also:
-
pressAndReleaseKeys
Simulates a user pressing and releasing the given keys on themanaged by this fixture.JScrollPane- Specified by:
pressAndReleaseKeysin 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'sJScrollPaneis disabled.IllegalStateException- if this fixture'sJScrollPaneis not showing on the screen.- See Also:
-
pressKey
Simulates a user pressing the given key on this fixture's.JScrollPane- Specified by:
pressKeyin 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'sJScrollPaneis disabled.IllegalStateException- if this fixture'sJScrollPaneis not showing on the screen.- See Also:
-
releaseKey
Simulates a user releasing the given key on this fixture's.JScrollPane- Specified by:
releaseKeyin 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'sJScrollPaneis disabled.IllegalStateException- if this fixture'sJScrollPaneis not showing on the screen.- See Also:
-
requireFocused
Asserts that this fixture'shas input focus.JScrollPane- Specified by:
requireFocusedin interfaceFocusableComponentFixture- Returns:
- this fixture.
- Throws:
AssertionError- if this fixture'sJScrollPanedoes not have input focus.
-
requireEnabled
Asserts that this fixture'sis enabled.JScrollPane- Specified by:
requireEnabledin interfaceStateVerificationFixture- Returns:
- this fixture.
- Throws:
AssertionError- if this fixture'sJScrollPaneis disabled.
-
requireEnabled
Asserts that this fixture'sis enabled.JScrollPane- Specified by:
requireEnabledin interfaceStateVerificationFixture- Parameters:
timeout- the time this fixture will wait for the component to be enabled.- Returns:
- this fixture.
- Throws:
WaitTimedOutError- if this fixture'sJScrollPaneis never enabled.
-
requireDisabled
Asserts that this fixture'sis disabled.JScrollPane- Specified by:
requireDisabledin interfaceStateVerificationFixture- Returns:
- this fixture.
- Throws:
AssertionError- if this fixture'sJScrollPaneis enabled.
-
requireVisible
Asserts that this fixture'sis visible.JScrollPane- Specified by:
requireVisiblein interfaceStateVerificationFixture- Returns:
- this fixture.
- Throws:
AssertionError- if this fixture'sJScrollPaneis not visible.
-
requireNotVisible
Asserts that this fixture'sis not visible.JScrollPane- Specified by:
requireNotVisiblein interfaceStateVerificationFixture- Returns:
- this fixture.
- Throws:
AssertionError- if this fixture'sJScrollPaneis visible.
-
requireToolTip
Asserts that the toolTip in this fixture'smatches the given value.JScrollPane- Specified by:
requireToolTipin interfaceToolTipDisplayFixture- Parameters:
expected- the given value. It can be a regular expression.- Returns:
- this fixture.
- Throws:
AssertionError- if the toolTip in this fixture'sJScrollPanedoes not match the given value.- Since:
- 1.2
-
requireToolTip
Asserts that the toolTip in this fixture'smatches the given regular expression pattern.JScrollPane- Specified by:
requireToolTipin 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'sJScrollPanedoes not match the given regular expression.- Since:
- 1.2
-
clientProperty
Returns the client property stored in this fixture's, under the given key.JScrollPane- Specified by:
clientPropertyin 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
nullif the property was not found. - Throws:
NullPointerException- if the given key isnull.- Since:
- 1.2
-
showPopupMenu
Shows a pop-up menu using this fixture'sas the invoker of the pop-up menu.JScrollPane- Specified by:
showPopupMenuin interfaceJPopupMenuInvokerFixture- Returns:
- a fixture that manages the displayed pop-up menu.
- Throws:
IllegalStateException- if this fixture'sJScrollPaneis disabled.IllegalStateException- if this fixture'sJScrollPaneis 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'sas the invoker of the pop-up menu.JScrollPane- Specified by:
showPopupMenuAtin 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'sJScrollPaneis disabled.IllegalStateException- if this fixture'sJScrollPaneis not showing on the screen.ComponentLookupException- if a pop-up menu cannot be found.
-