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
JScrollBars:
- 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 PointblockLocation(JScrollBar scrollBar, JScrollBarLocation location, int times) voidrequireValue(JScrollBar scrollBar, int value) Asserts that the value of theis equal to the given one.JScrollBarprivate voidscroll(JScrollBar scrollBar, int position, GenericRange<Point> points) private voidscroll(JScrollBar scrollBar, Pair<Point, Integer> scrollInfo) voidscrollBlockDown(JScrollBar scrollBar) Scrolls down (or right) one block (usually a page).voidscrollBlockDown(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) voidscrollBlockUp(JScrollBar scrollBar) Scrolls up (or left) one block (usually a page).voidscrollBlockUp(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) voidscrollTo(JScrollBar scrollBar, int position) Scrolls to the given position.voidscrollToMaximum(JScrollBar scrollBar) Scrolls to the maximum position of the given.JScrollBarvoidscrollToMinimum(JScrollBar scrollBar) Scrolls to the minimum position of the given.JScrollBarvoidscrollUnitDown(JScrollBar scrollBar) Scrolls down (or right) one unit (usually a line).voidscrollUnitDown(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) voidscrollUnitUp(JScrollBar scrollBar) Scrolls up (or left) one unit (usually a line).voidscrollUnitUp(JScrollBar scrollBar, int times) Scrolls up (or left) one unit (usually a line,) the given number of times.private voidsetValueProperty(JScrollBar scrollBar, int value) private voidsimulateScrolling(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 voidvalidatePosition(JScrollBar scrollBar, int position) private voidvalidateTimes(int times, String action) 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
-
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- iftimesis less than or equal to zero.IllegalStateException- if theJScrollBaris disabled.IllegalStateException- if theJScrollBaris 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- iftimesis less than or equal to zero.IllegalStateException- if theJScrollBaris disabled.IllegalStateException- if theJScrollBaris 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- iftimesis less than or equal to zero.IllegalStateException- if theJScrollBaris disabled.IllegalStateException- if theJScrollBaris 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- iftimesis less than or equal to zero.IllegalStateException- if theJScrollBaris disabled.IllegalStateException- if theJScrollBaris 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 theJScrollBaris disabled.IllegalStateException- if theJScrollBaris 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 theJScrollBaris disabled.IllegalStateException- if theJScrollBaris 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 theJScrollBaris disabled.IllegalStateException- if theJScrollBaris not showing on the screen.IllegalArgumentException- if the given position is not within theJScrollBarbounds.
-
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 theis equal to the given one.JScrollBar- Parameters:
scrollBar- the targetJScrollBar.value- the expected value.- Throws:
AssertionError- if the value of theJScrollBaris not equal to the given one.
-