Package org.fest.swing.driver
Class JScrollBarDriver
java.lang.Object
org.fest.swing.driver.ComponentDriver
org.fest.swing.driver.ContainerDriver
org.fest.swing.driver.JComponentDriver
org.fest.swing.driver.JScrollBarDriver
Understands functional testing of
JScrollBar
s:
- 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static Point
blockLocation
(JScrollBar scrollBar, JScrollBarLocation location, int times) void
requireValue
(JScrollBar scrollBar, int value) Asserts that the value of the
is equal to the given one.JScrollBar
private void
scroll
(JScrollBar scrollBar, int position, GenericRange<Point> points) private void
scroll
(JScrollBar scrollBar, Pair<Point, Integer> scrollInfo) void
scrollBlockDown
(JScrollBar scrollBar) Scrolls down (or right) one block (usually a page).void
scrollBlockDown
(JScrollBar scrollBar, int times) Scrolls down (or right) one block (usually a page,) the given number of times.scrollBlockInfo
(JScrollBar scrollBar, JScrollBarLocation location, int times) void
scrollBlockUp
(JScrollBar scrollBar) Scrolls up (or left) one block (usually a page).void
scrollBlockUp
(JScrollBar scrollBar, int times) Scrolls up (or left) one block (usually a page,) the given number of times.private static GenericRange<Point>
scrollInfo
(JScrollBar scrollBar, JScrollBarLocation location, int position) void
scrollTo
(JScrollBar scrollBar, int position) Scrolls to the given position.void
scrollToMaximum
(JScrollBar scrollBar) Scrolls to the maximum position of the given
.JScrollBar
void
scrollToMinimum
(JScrollBar scrollBar) Scrolls to the minimum position of the given
.JScrollBar
void
scrollUnitDown
(JScrollBar scrollBar) Scrolls down (or right) one unit (usually a line).void
scrollUnitDown
(JScrollBar scrollBar, int times) Scrolls down (or right) one unit (usually a line,) the given number of times.scrollUnitInfo
(JScrollBar scrollBar, JScrollBarLocation location, int times) void
scrollUnitUp
(JScrollBar scrollBar) Scrolls up (or left) one unit (usually a line).void
scrollUnitUp
(JScrollBar scrollBar, int times) Scrolls up (or left) one unit (usually a line,) the given number of times.private void
setValueProperty
(JScrollBar scrollBar, int value) private void
simulateScrolling
(JScrollBar scrollBar, GenericRange<Point> points) validateAndFindScrollBlockInfo
(JScrollBar scrollBar, JScrollBarLocation location, int times) private static GenericRange<Point>
validateAndFindScrollInfo
(JScrollBar scrollBar, JScrollBarLocation location, int position) private static Pair<Integer,
GenericRange<Point>> validateAndFindScrollToMaximumInfo
(JScrollBar scrollBar, JScrollBarLocation location) private static Pair<Integer,
GenericRange<Point>> validateAndFindScrollToMinimumInfo
(JScrollBar scrollBar, JScrollBarLocation location) validateAndFindScrollUnitInfo
(JScrollBar scrollBar, JScrollBarLocation location, int times) private static void
validatePosition
(JScrollBar scrollBar, int position) private void
validateTimes
(int times, String action) Methods inherited from class org.fest.swing.driver.JComponentDriver
clientProperty, invokeAction, isVisible, isVisible, requireToolTip, requireToolTip, scrollToVisible
Methods inherited from class org.fest.swing.driver.ContainerDriver
move, resize, resizeHeight, resizeWidth
Methods 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
-
VALUE_PROPERTY
- See Also:
-
location
-
-
Constructor Details
-
JScrollBarDriver
Creates a newJScrollBarDriver
.- Parameters:
robot
- the robot to use to simulate user input.
-
-
Method Details
-
scrollUnitUp
Scrolls up (or left) one unit (usually a line).- Parameters:
scrollBar
- the targetJScrollBar
.
-
scrollUnitUp
Scrolls up (or left) one unit (usually a line,) the given number of times.- Parameters:
scrollBar
- the targetJScrollBar
.times
- the number of times to scroll up one unit.- Throws:
IllegalArgumentException
- iftimes
is less than or equal to zero.IllegalStateException
- if theJScrollBar
is disabled.IllegalStateException
- if theJScrollBar
is not showing on the screen.
-
scrollUnitDown
Scrolls down (or right) one unit (usually a line).- Parameters:
scrollBar
- the targetJScrollBar
.
-
scrollUnitDown
Scrolls down (or right) one unit (usually a line,) the given number of times.- Parameters:
scrollBar
- the targetJScrollBar
.times
- the number of times to scroll down one unit.- Throws:
IllegalArgumentException
- iftimes
is less than or equal to zero.IllegalStateException
- if theJScrollBar
is disabled.IllegalStateException
- if theJScrollBar
is not showing on the screen.
-
validateAndFindScrollUnitInfo
@RunsInEDT private static Pair<Point,Integer> validateAndFindScrollUnitInfo(JScrollBar scrollBar, JScrollBarLocation location, int times) -
scrollUnitInfo
@RunsInCurrentThread private static Pair<Point,Integer> scrollUnitInfo(JScrollBar scrollBar, JScrollBarLocation location, int times) -
scrollBlockUp
Scrolls up (or left) one block (usually a page).- Parameters:
scrollBar
- the targetJScrollBar
.
-
scrollBlockUp
Scrolls up (or left) one block (usually a page,) the given number of times.- Parameters:
scrollBar
- the targetJScrollBar
.times
- the number of times to scroll up one block.- Throws:
IllegalArgumentException
- iftimes
is less than or equal to zero.IllegalStateException
- if theJScrollBar
is disabled.IllegalStateException
- if theJScrollBar
is not showing on the screen.
-
scrollBlockDown
Scrolls down (or right) one block (usually a page).- Parameters:
scrollBar
- the targetJScrollBar
.
-
scrollBlockDown
Scrolls down (or right) one block (usually a page,) the given number of times.- Parameters:
scrollBar
- the targetJScrollBar
.times
- the number of times to scroll down one block.- Throws:
IllegalArgumentException
- iftimes
is less than or equal to zero.IllegalStateException
- if theJScrollBar
is disabled.IllegalStateException
- if theJScrollBar
is not showing on the screen.
-
validateTimes
-
validateAndFindScrollBlockInfo
@RunsInEDT private static Pair<Point,Integer> validateAndFindScrollBlockInfo(JScrollBar scrollBar, JScrollBarLocation location, int times) -
scrollBlockInfo
@RunsInCurrentThread private static Pair<Point,Integer> scrollBlockInfo(JScrollBar scrollBar, JScrollBarLocation location, int times) -
blockLocation
@RunsInCurrentThread private static Point blockLocation(JScrollBar scrollBar, JScrollBarLocation location, int times) -
scroll
-
scrollToMaximum
Scrolls to the maximum position of the given
.JScrollBar
- Parameters:
scrollBar
- the targetJScrollBar
.- Throws:
IllegalStateException
- if theJScrollBar
is disabled.IllegalStateException
- if theJScrollBar
is not showing on the screen.
-
validateAndFindScrollToMaximumInfo
@RunsInEDT private static Pair<Integer,GenericRange<Point>> validateAndFindScrollToMaximumInfo(JScrollBar scrollBar, JScrollBarLocation location) -
scrollToMinimum
Scrolls to the minimum position of the given
.JScrollBar
- Parameters:
scrollBar
- the targetJScrollBar
.- Throws:
IllegalStateException
- if theJScrollBar
is disabled.IllegalStateException
- if theJScrollBar
is not showing on the screen.
-
validateAndFindScrollToMinimumInfo
@RunsInEDT private static Pair<Integer,GenericRange<Point>> validateAndFindScrollToMinimumInfo(JScrollBar scrollBar, JScrollBarLocation location) -
scrollTo
Scrolls to the given position.- Parameters:
scrollBar
- the targetJScrollBar
.position
- the position to scroll to.- Throws:
IllegalStateException
- if theJScrollBar
is disabled.IllegalStateException
- if theJScrollBar
is not showing on the screen.IllegalArgumentException
- if the given position is not within theJScrollBar
bounds.
-
validateAndFindScrollInfo
@RunsInEDT private static GenericRange<Point> validateAndFindScrollInfo(JScrollBar scrollBar, JScrollBarLocation location, int position) -
validatePosition
-
scrollInfo
@RunsInCurrentThread private static GenericRange<Point> scrollInfo(JScrollBar scrollBar, JScrollBarLocation location, int position) -
scroll
-
simulateScrolling
-
setValueProperty
-
requireValue
Asserts that the value of the
is equal to the given one.JScrollBar
- Parameters:
scrollBar
- the targetJScrollBar
.value
- the expected value.- Throws:
AssertionError
- if the value of theJScrollBar
is not equal to the given one.
-