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
Dialog
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
Fields inherited from interface org.fest.swing.fixture.ComponentContainerFixture
DEFAULT_DIALOG_LOOKUP_TIMEOUT
-
Constructor Summary
ConstructorsConstructorDescriptionDialogFixture
(Dialog target) Creates a new
.DialogFixture
DialogFixture
(String dialogName) Creates a new
.DialogFixture
DialogFixture
(Robot robot, Dialog target) Creates a new
.DialogFixture
DialogFixture
(Robot robot, String dialogName) Creates a new
.DialogFixture
-
Method Summary
Modifier and TypeMethodDescriptionclick()
Simulates a user clicking this fixture's
.Dialog
click
(MouseButton button) Simulates a user clicking this fixture's
.Dialog
click
(MouseClickInfo mouseClickInfo) Simulates a user clicking this fixture's
.Dialog
void
close()
Simulates a user closing this fixture's
.Dialog
private void
Simulates a user double-clicking this fixture's
.Dialog
protected final void
driver
(DialogDriver newDriver) Sets the
to be used by this fixture.DialogDriver
focus()
Gives input focus to this fixture's
.Dialog
Simulates a user moving this fixture's
to the given point.Dialog
If the given
is visible, sends it to the back and may cause it to lose focus or activation if it is the focused or active.Dialog
If fixture's
is visible, brings it to the front and may make it the focused one.Dialog
pressAndReleaseKey
(KeyPressInfo keyPressInfo) Simulates a user pressing given key with the given modifiers on this fixture's
.Dialog
pressAndReleaseKeys
(int... keyCodes) Simulates a user pressing and releasing the given keys on this fixture's
.Dialog
pressKey
(int keyCode) Simulates a user pressing the given key on this fixture's
.Dialog
releaseKey
(int keyCode) Simulates a user releasing the given key on this fixture's
.Dialog
Asserts that this fixture's
is disabled.Dialog
Asserts that this fixture's
is enabled.Dialog
requireEnabled
(Timeout timeout) Asserts that this fixture's
is enabled.Dialog
Asserts that this fixture's
has input focus.Dialog
Asserts that this fixture's
is modal.Dialog
Asserts that this fixture's
is not visible.Dialog
requireSize
(Dimension size) Asserts that the size of this fixture's
is equal to given one.Dialog
Asserts that this fixture's
is visible.Dialog
resizeHeightTo
(int height) Simulates a user resizing vertically this fixture's
.Dialog
Simulates a user resizing this fixture's
.Dialog
resizeWidthTo
(int width) Simulates a user resizing horizontally this fixture's
.Dialog
Simulates a user right-clicking this fixture's
.Dialog
show()
Shows this fixture's
.Dialog
Shows this fixture's
, resized to the given size.Dialog
Shows a pop-up menu using this fixture's
as the invoker of the pop-up menu.Dialog
Shows a pop-up menu at the given point using this fixture's
as the invoker of the pop-up menu.Dialog
Methods inherited from class org.fest.swing.fixture.WindowFixture
cleanUp
Methods 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, with
Methods 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 newDialogFixture
containing the current AWT hierarchy.Robot
- Parameters:
target
- theDialog
to be managed by this fixture.- Throws:
NullPointerException
- iftarget
isnull
.- See Also:
-
DialogFixture
Creates a new
.DialogFixture
- Parameters:
robot
- performs simulation of user events on the givenDialog
.target
- theDialog
to be managed by this fixture.- Throws:
NullPointerException
- ifrobot
isnull
.NullPointerException
- iftarget
isnull
.
-
DialogFixture
Creates a new
.DialogFixture
- Parameters:
robot
- performs simulation of user events on aDialog
.dialogName
- the name of theDialog
to find using the givenRobot
.- Throws:
NullPointerException
- ifrobot
isnull
.ComponentLookupException
- if aDialog
having a matching name could not be found.ComponentLookupException
- if more than oneDialog
having a matching name is found.
-
DialogFixture
Creates a new
. This constructor creates a newDialogFixture
containing the current AWT hierarchy.Robot
- Parameters:
dialogName
- the name of theDialog
to find.- Throws:
ComponentLookupException
- if aDialog
having a matching name could not be found.ComponentLookupException
- if more than oneDialog
having a matching name is found.- See Also:
-
-
Method Details
-
createDriver
private void createDriver() -
driver
Sets the
to 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 givenMouseClickInfo
isnull
.
-
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's
to the given point.Dialog
- Parameters:
p
- the point to move this fixture'sDialog
to.- Returns:
- this fixture.
- Throws:
ActionFailedException
- if theWindow
is not movable.ActionFailedException
- if the givenWindow
is not showing on the screen.
-
moveToFront
If fixture's
is visible, brings it to the front and may make it the focused one.Dialog
- Returns:
- this fixture.
-
moveToBack
If the given
is 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 availableDialog
masks.InputEvent
- 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.- 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's
has input focus.Dialog
- Returns:
- this fixture.
- Throws:
AssertionError
- if this fixture'sDialog
does not have input focus.
-
requireDisabled
Asserts that this fixture's
is disabled.Dialog
- Returns:
- this fixture.
- Throws:
AssertionError
- if this fixture'sDialog
is enabled.
-
requireEnabled
Asserts that this fixture's
is enabled.Dialog
- Returns:
- this fixture.
- Throws:
AssertionError
- if this fixture'sDialog
is disabled.
-
requireEnabled
Asserts that this fixture's
is enabled.Dialog
- Parameters:
timeout
- the time this fixture will wait for the component to be enabled.- Returns:
- this fixture.
- Throws:
WaitTimedOutError
- if this fixture'sDialog
is never enabled.
-
requireModal
Asserts that this fixture's
is modal.Dialog
- Returns:
- this fixture.
- Throws:
AssertionError
- if this fixture'sDialog
is not modal.
-
requireNotVisible
Asserts that this fixture's
is not visible.Dialog
- Returns:
- this fixture.
- Throws:
AssertionError
- if this fixture'sDialog
is visible.
-
requireSize
Asserts that the size of this fixture's
is equal to given one.Dialog
- Parameters:
size
- the given size to match.- Returns:
- this fixture.
- Throws:
AssertionError
- if the size of this fixture'sDialog
is not equal to the given size.
-
requireVisible
Asserts that this fixture's
is visible.Dialog
- Returns:
- this fixture.
- Throws:
AssertionError
- if this fixture'sDialog
is not visible.
-
resizeHeightTo
Simulates a user resizing vertically this fixture's
.Dialog
- Parameters:
height
- the height that this fixture'sDialog
should have after being resized.- Returns:
- this fixture.
- Throws:
ActionFailedException
- if theWindow
is 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 theWindow
is not resizable.
-
resizeWidthTo
Simulates a user resizing horizontally this fixture's
.Dialog
- Parameters:
width
- the width that this fixture'sDialog
should have after being resized.- Returns:
- this fixture.
- Throws:
ActionFailedException
- if theWindow
is not resizable.
-
rightClick
Simulates a user right-clicking this fixture's
.Dialog
- Returns:
- this fixture.
-
show
Shows this fixture's
.Dialog
- Specified by:
show
in classWindowFixture<Dialog>
- Returns:
- this fixture.
-
show
Shows this fixture's
, resized to the given size.Dialog
- Specified by:
show
in classWindowFixture<Dialog>
- Parameters:
size
- the size to resize this fixture'sDialog
to.- Returns:
- this fixture.
-
showPopupMenu
Shows a pop-up menu using this fixture's
as the invoker of the pop-up menu.Dialog
- Returns:
- a fixture that manages the displayed pop-up menu.
- Throws:
IllegalStateException
- if this fixture'sDialog
is disabled.IllegalStateException
- if this fixture'sDialog
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.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'sDialog
is disabled.IllegalStateException
- if this fixture'sDialog
is 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
-