Package org.fest.swing.fixture
Class DialogFixture
java.lang.Object
- All Implemented Interfaces:
CommonComponentFixture,ComponentContainerFixture,FocusableComponentFixture,JPopupMenuInvokerFixture,KeyboardInputSimulationFixture,MouseInputSimulationFixture,StateVerificationFixture,WindowLikeContainerFixture
Understands functional testing of
Dialogs:
- 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, targetFields inherited from interface org.fest.swing.fixture.ComponentContainerFixture
DEFAULT_DIALOG_LOOKUP_TIMEOUT -
Constructor Summary
ConstructorsConstructorDescriptionDialogFixture(Dialog target) Creates a new.DialogFixtureDialogFixture(String dialogName) Creates a new.DialogFixtureDialogFixture(Robot robot, Dialog target) Creates a new.DialogFixtureDialogFixture(Robot robot, String dialogName) Creates a new.DialogFixture -
Method Summary
Modifier and TypeMethodDescriptionclick()Simulates a user clicking this fixture's.Dialogclick(MouseButton button) Simulates a user clicking this fixture's.Dialogclick(MouseClickInfo mouseClickInfo) Simulates a user clicking this fixture's.Dialogvoidclose()Simulates a user closing this fixture's.Dialogprivate voidSimulates a user double-clicking this fixture's.Dialogprotected final voiddriver(DialogDriver newDriver) Sets theto be used by this fixture.DialogDriverfocus()Gives input focus to this fixture's.DialogSimulates a user moving this fixture'sto the given point.DialogIf the givenis visible, sends it to the back and may cause it to lose focus or activation if it is the focused or active.DialogIf fixture'sis visible, brings it to the front and may make it the focused one.DialogpressAndReleaseKey(KeyPressInfo keyPressInfo) Simulates a user pressing given key with the given modifiers on this fixture's.DialogpressAndReleaseKeys(int... keyCodes) Simulates a user pressing and releasing the given keys on this fixture's.DialogpressKey(int keyCode) Simulates a user pressing the given key on this fixture's.DialogreleaseKey(int keyCode) Simulates a user releasing the given key on this fixture's.DialogAsserts that this fixture'sis disabled.DialogAsserts that this fixture'sis enabled.DialogrequireEnabled(Timeout timeout) Asserts that this fixture'sis enabled.DialogAsserts that this fixture'shas input focus.DialogAsserts that this fixture'sis modal.DialogAsserts that this fixture'sis not visible.DialogrequireSize(Dimension size) Asserts that the size of this fixture'sis equal to given one.DialogAsserts that this fixture'sis visible.DialogresizeHeightTo(int height) Simulates a user resizing vertically this fixture's.DialogSimulates a user resizing this fixture's.DialogresizeWidthTo(int width) Simulates a user resizing horizontally this fixture's.DialogSimulates a user right-clicking this fixture's.Dialogshow()Shows this fixture's.DialogShows this fixture's, resized to the given size.DialogShows a pop-up menu using this fixture'sas the invoker of the pop-up menu.DialogShows a pop-up menu at the given point using this fixture'sas the invoker of the pop-up menu.DialogMethods inherited from class org.fest.swing.fixture.WindowFixture
cleanUpMethods 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, withMethods inherited from class org.fest.swing.fixture.ComponentFixture
background, component, font, foreground, requireShowing, targetCastedTo, validateNotNull
-
Field Details
-
driver
-
-
Constructor Details
-
DialogFixture
Creates a new. This constructor creates a newDialogFixturecontaining the current AWT hierarchy.Robot- Parameters:
target- theDialogto be managed by this fixture.- Throws:
NullPointerException- iftargetisnull.- See Also:
-
DialogFixture
Creates a new.DialogFixture- Parameters:
robot- performs simulation of user events on the givenDialog.target- theDialogto be managed by this fixture.- Throws:
NullPointerException- ifrobotisnull.NullPointerException- iftargetisnull.
-
DialogFixture
Creates a new.DialogFixture- Parameters:
robot- performs simulation of user events on aDialog.dialogName- the name of theDialogto find using the givenRobot.- Throws:
NullPointerException- ifrobotisnull.ComponentLookupException- if aDialoghaving a matching name could not be found.ComponentLookupException- if more than oneDialoghaving a matching name is found.
-
DialogFixture
Creates a new. This constructor creates a newDialogFixturecontaining the current AWT hierarchy.Robot- Parameters:
dialogName- the name of theDialogto find.- Throws:
ComponentLookupException- if aDialoghaving a matching name could not be found.ComponentLookupException- if more than oneDialoghaving a matching name is found.- See Also:
-
-
Method Details
-
createDriver
private void createDriver() -
driver
Sets theto be used by this fixture.DialogDriver- Parameters:
newDriver- the newDialogDriver.- Throws:
NullPointerException- if the given driver isnull.
-
click
Simulates a user clicking this fixture's.Dialog- Returns:
- this fixture.
-
click
Simulates a user clicking this fixture's.Dialog- Parameters:
button- the button to click.- Returns:
- this fixture.
-
click
Simulates a user clicking this fixture's.Dialog- Parameters:
mouseClickInfo- specifies the button to click and the times the button should be clicked.- Returns:
- this fixture.
- Throws:
NullPointerException- if the givenMouseClickInfoisnull.
-
doubleClick
Simulates a user double-clicking this fixture's.Dialog- Returns:
- this fixture.
-
focus
Gives input focus to this fixture's.Dialog- Returns:
- this fixture.
-
moveTo
Simulates a user moving this fixture'sto the given point.Dialog- Parameters:
p- the point to move this fixture'sDialogto.- Returns:
- this fixture.
- Throws:
ActionFailedException- if theWindowis not movable.ActionFailedException- if the givenWindowis not showing on the screen.
-
moveToFront
If fixture'sis visible, brings it to the front and may make it the focused one.Dialog- Returns:
- this fixture.
-
moveToBack
If the givenis visible, sends it to the back and may cause it to lose focus or activation if it is the focused or active.Dialog- Returns:
- this fixture.
-
pressAndReleaseKey
Simulates a user pressing given key with the given modifiers on this fixture's. Modifiers is a mask from the availableDialogmasks.InputEvent- 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.- See Also:
-
pressAndReleaseKeys
Simulates a user pressing and releasing the given keys on this fixture's.Dialog- 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.- See Also:
-
pressKey
Simulates a user pressing the given key on this fixture's.Dialog- Parameters:
keyCode- the code of the key to press.- Returns:
- this fixture.
- Throws:
IllegalArgumentException- if the given code is not a valid key code.- See Also:
-
releaseKey
Simulates a user releasing the given key on this fixture's.Dialog- Parameters:
keyCode- the code of the key to release.- Returns:
- this fixture.
- Throws:
IllegalArgumentException- if the given code is not a valid key code.- See Also:
-
requireFocused
Asserts that this fixture'shas input focus.Dialog- Returns:
- this fixture.
- Throws:
AssertionError- if this fixture'sDialogdoes not have input focus.
-
requireDisabled
Asserts that this fixture'sis disabled.Dialog- Returns:
- this fixture.
- Throws:
AssertionError- if this fixture'sDialogis enabled.
-
requireEnabled
Asserts that this fixture'sis enabled.Dialog- Returns:
- this fixture.
- Throws:
AssertionError- if this fixture'sDialogis disabled.
-
requireEnabled
Asserts that this fixture'sis enabled.Dialog- Parameters:
timeout- the time this fixture will wait for the component to be enabled.- Returns:
- this fixture.
- Throws:
WaitTimedOutError- if this fixture'sDialogis never enabled.
-
requireModal
Asserts that this fixture'sis modal.Dialog- Returns:
- this fixture.
- Throws:
AssertionError- if this fixture'sDialogis not modal.
-
requireNotVisible
Asserts that this fixture'sis not visible.Dialog- Returns:
- this fixture.
- Throws:
AssertionError- if this fixture'sDialogis visible.
-
requireSize
Asserts that the size of this fixture'sis equal to given one.Dialog- Parameters:
size- the given size to match.- Returns:
- this fixture.
- Throws:
AssertionError- if the size of this fixture'sDialogis not equal to the given size.
-
requireVisible
Asserts that this fixture'sis visible.Dialog- Returns:
- this fixture.
- Throws:
AssertionError- if this fixture'sDialogis not visible.
-
resizeHeightTo
Simulates a user resizing vertically this fixture's.Dialog- Parameters:
height- the height that this fixture'sDialogshould have after being resized.- Returns:
- this fixture.
- Throws:
ActionFailedException- if theWindowis not resizable.
-
resizeTo
Simulates a user resizing this fixture's.Dialog- Parameters:
size- the size that the target window should have after being resized.- Returns:
- this fixture.
- Throws:
ActionFailedException- if theWindowis not resizable.
-
resizeWidthTo
Simulates a user resizing horizontally this fixture's.Dialog- Parameters:
width- the width that this fixture'sDialogshould have after being resized.- Returns:
- this fixture.
- Throws:
ActionFailedException- if theWindowis not resizable.
-
rightClick
Simulates a user right-clicking this fixture's.Dialog- Returns:
- this fixture.
-
show
Shows this fixture's.Dialog- Specified by:
showin classWindowFixture<Dialog>- Returns:
- this fixture.
-
show
Shows this fixture's, resized to the given size.Dialog- Specified by:
showin classWindowFixture<Dialog>- Parameters:
size- the size to resize this fixture'sDialogto.- Returns:
- this fixture.
-
showPopupMenu
Shows a pop-up menu using this fixture'sas the invoker of the pop-up menu.Dialog- Returns:
- a fixture that manages the displayed pop-up menu.
- Throws:
IllegalStateException- if this fixture'sDialogis disabled.IllegalStateException- if this fixture'sDialogis 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.Dialog- 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'sDialogis disabled.IllegalStateException- if this fixture'sDialogis not showing on the screen.ComponentLookupException- if a pop-up menu cannot be found.
-
close
public void close()Simulates a user closing this fixture's.Dialog
-