Package org.fest.swing.fixture
Class FrameFixture
java.lang.Object
- All Implemented Interfaces:
CommonComponentFixture
,ComponentContainerFixture
,FocusableComponentFixture
,FrameLikeFixture
,JPopupMenuInvokerFixture
,KeyboardInputSimulationFixture
,MouseInputSimulationFixture
,StateVerificationFixture
,WindowLikeContainerFixture
Understands functional testing of
Frame
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
ConstructorsConstructorDescriptionFrameFixture
(Frame target) Creates a new
.FrameFixture
FrameFixture
(String name) Creates a new
.FrameFixture
FrameFixture
(Robot robot, Frame target) Creates a new
.FrameFixture
FrameFixture
(Robot robot, String name) Creates a new
.FrameFixture
-
Method Summary
Modifier and TypeMethodDescriptionclick()
Simulates a user clicking this fixture's
.Frame
click
(MouseButton button) Simulates a user clicking this fixture's
.Frame
click
(MouseClickInfo mouseClickInfo) Simulates a user clicking this fixture's
.Frame
void
close()
Simulates a user closing this fixture's
.Frame
private void
Simulates a user deiconifying this fixture's
.Frame
Simulates a user double-clicking this fixture's
.Frame
protected final void
driver
(FrameDriver newDriver) Sets the
to be used by this fixture.FrameDriver
focus()
Gives input focus to this fixture's
.Frame
iconify()
Simulates a user iconifying this fixture's
.Frame
maximize()
Simulates a user maximizing this fixture's
.Frame
Simulates a user moving this fixture's
to the given point.Frame
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.Frame
If fixture's
is visible, brings it to the front and may make it the focused one.Frame
Simulates a user normalizing this fixture's
.Frame
pressAndReleaseKey
(KeyPressInfo keyPressInfo) Simulates a user pressing given key with the given modifiers on this fixture's
.Frame
pressAndReleaseKeys
(int... keyCodes) Simulates a user pressing and releasing the given keys on this fixture's
.Frame
pressKey
(int keyCode) Simulates a user pressing the given key on this fixture's
.Frame
releaseKey
(int keyCode) Simulates a user releasing the given key on this fixture's
.Frame
Asserts that this fixture's
is disabled.Frame
Asserts that this fixture's
is enabled.Frame
requireEnabled
(Timeout timeout) Asserts that this fixture's
is enabled.Frame
Asserts that this fixture's
has input focus.Frame
Asserts that this fixture's
is not visible.Frame
requireSize
(Dimension size) Asserts that the size of this fixture's
is equal to given one.Frame
Asserts that this fixture's
is visible.Frame
resizeHeightTo
(int height) Simulates a user resizing vertically this fixture's
.Frame
Simulates a user resizing this fixture's
.Frame
resizeWidthTo
(int width) Simulates a user resizing horizontally this fixture's
.Frame
Simulates a user right-clicking this fixture's
.Frame
show()
Shows this fixture's
.Frame
Shows this fixture's
, resized to the given size.Frame
Shows a pop-up menu using this fixture's
as the invoker of the pop-up menu.Frame
Shows a pop-up menu at the given point using this fixture's
as the invoker of the pop-up menu.Frame
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
-
FrameFixture
Creates a new
. This constructor creates a newFrameFixture
containing the current AWT hierarchy.Robot
- Parameters:
target
- theFrame
to be managed by this fixture.- Throws:
NullPointerException
- if the given frame isnull
.- See Also:
-
FrameFixture
Creates a new
.FrameFixture
- Parameters:
robot
- performs user events on the given window and verifies expected output.target
- theFrame
to be managed by this fixture.- Throws:
NullPointerException
- if the given robot isnull
.NullPointerException
- if the given frame isnull
.
-
FrameFixture
Creates a new
.FrameFixture
- Parameters:
robot
- performs user events on the given window and verifies expected output.name
- the name of theFrame
to find using the givenRobot
.- Throws:
NullPointerException
- if the given robot isnull
.ComponentLookupException
- if aFrame
having a matching name could not be found.ComponentLookupException
- if more than oneFrame
having a matching name is found.
-
FrameFixture
Creates a new
. This constructor creates a newFrameFixture
containing the current AWT hierarchy.Robot
- Parameters:
name
- the name of theFrame
to find.- Throws:
ComponentLookupException
- if aFrame
having a matching name could not be found.ComponentLookupException
- if more than oneFrame
having a matching name is found.
-
-
Method Details
-
createDriver
private void createDriver() -
driver
Sets the
to be used by this fixture.FrameDriver
- Parameters:
newDriver
- the newFrameDriver
.- Throws:
NullPointerException
- if the given driver isnull
.
-
click
Simulates a user clicking this fixture's
.Frame
- Specified by:
click
in interfaceMouseInputSimulationFixture
- Returns:
- this fixture.
-
click
Simulates a user clicking this fixture's
.Frame
- Specified by:
click
in interfaceMouseInputSimulationFixture
- Parameters:
button
- the button to click.- Returns:
- this fixture.
-
click
Simulates a user clicking this fixture's
.Frame
- Specified by:
click
in interfaceMouseInputSimulationFixture
- 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
.Frame
- Specified by:
doubleClick
in interfaceMouseInputSimulationFixture
- Returns:
- this fixture.
-
rightClick
Simulates a user right-clicking this fixture's
.Frame
- Specified by:
rightClick
in interfaceMouseInputSimulationFixture
- Returns:
- this fixture.
-
iconify
Simulates a user iconifying this fixture's
.Frame
- Specified by:
iconify
in interfaceFrameLikeFixture
- Returns:
- this fixture.
-
deiconify
Simulates a user deiconifying this fixture's
.Frame
- Specified by:
deiconify
in interfaceFrameLikeFixture
- Returns:
- this fixture.
-
maximize
Simulates a user maximizing this fixture's
.Frame
- Specified by:
maximize
in interfaceFrameLikeFixture
- Returns:
- this fixture.
- Throws:
ActionFailedException
- if the operating system does not support maximizing frames.
-
normalize
Simulates a user normalizing this fixture's
.Frame
- Specified by:
normalize
in interfaceFrameLikeFixture
- Returns:
- this fixture.
-
focus
Gives input focus to this fixture's
.Frame
- Specified by:
focus
in interfaceFocusableComponentFixture
- Returns:
- this fixture.
-
moveTo
Simulates a user moving this fixture's
to the given point.Frame
- Specified by:
moveTo
in interfaceWindowLikeContainerFixture
- Parameters:
p
- the point to move this fixture'sFrame
to.- Returns:
- this fixture.
-
pressAndReleaseKey
Simulates a user pressing given key with the given modifiers on this fixture's
. Modifiers is a mask from the availableFrame
masks.InputEvent
- Specified by:
pressAndReleaseKey
in interfaceKeyboardInputSimulationFixture
- 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
.Frame
- Specified by:
pressAndReleaseKeys
in 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.- See Also:
-
pressKey
Simulates a user pressing the given key on this fixture's
.Frame
- Specified by:
pressKey
in 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.- See Also:
-
releaseKey
Simulates a user releasing the given key on this fixture's
.Frame
- Specified by:
releaseKey
in 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.- See Also:
-
requireFocused
Asserts that this fixture's
has input focus.Frame
- Specified by:
requireFocused
in interfaceFocusableComponentFixture
- Returns:
- this fixture.
- Throws:
AssertionError
- if this fixture'sFrame
does not have input focus.
-
requireDisabled
Asserts that this fixture's
is disabled.Frame
- Specified by:
requireDisabled
in interfaceStateVerificationFixture
- Returns:
- this fixture.
- Throws:
AssertionError
- if this fixture'sFrame
is enabled.
-
requireEnabled
Asserts that this fixture's
is enabled.Frame
- Specified by:
requireEnabled
in interfaceStateVerificationFixture
- Returns:
- this fixture.
- Throws:
AssertionError
- if this fixture'sFrame
is disabled.
-
requireEnabled
Asserts that this fixture's
is enabled.Frame
- Specified by:
requireEnabled
in interfaceStateVerificationFixture
- Parameters:
timeout
- the time this fixture will wait for the component to be enabled.- Returns:
- this fixture.
- Throws:
WaitTimedOutError
- if this fixture'sFrame
is never enabled.
-
requireNotVisible
Asserts that this fixture's
is not visible.Frame
- Specified by:
requireNotVisible
in interfaceStateVerificationFixture
- Returns:
- this fixture.
- Throws:
AssertionError
- if this fixture'sFrame
is visible.
-
requireSize
Asserts that the size of this fixture's
is equal to given one.Frame
- Specified by:
requireSize
in interfaceWindowLikeContainerFixture
- Parameters:
size
- the given size to match.- Returns:
- this fixture.
- Throws:
AssertionError
- if the size of this fixture'sFrame
is not equal to the given size.
-
requireVisible
Asserts that this fixture's
is visible.Frame
- Specified by:
requireVisible
in interfaceStateVerificationFixture
- Returns:
- this fixture.
- Throws:
AssertionError
- if this fixture'sFrame
is not visible.
-
resizeHeightTo
Simulates a user resizing vertically this fixture's
.Frame
- Specified by:
resizeHeightTo
in interfaceWindowLikeContainerFixture
- Parameters:
height
- the height that this fixture'sFrame
should have after being resized.- Returns:
- this fixture.
-
resizeTo
Simulates a user resizing this fixture's
.Frame
- Specified by:
resizeTo
in interfaceWindowLikeContainerFixture
- Parameters:
size
- the size that the target window should have after being resized.- Returns:
- this fixture.
-
resizeWidthTo
Simulates a user resizing horizontally this fixture's
.Frame
- Specified by:
resizeWidthTo
in interfaceWindowLikeContainerFixture
- Parameters:
width
- the width that this fixture'sFrame
should have after being resized.- Returns:
- this fixture.
-
show
Shows this fixture's
.Frame
- Specified by:
show
in classWindowFixture<Frame>
- Returns:
- this fixture.
-
show
Shows this fixture's
, resized to the given size.Frame
- Specified by:
show
in classWindowFixture<Frame>
- Parameters:
size
- the size to resize this fixture'sFrame
to.- Returns:
- this fixture.
-
moveToFront
If fixture's
is visible, brings it to the front and may make it the focused one.Frame
- Specified by:
moveToFront
in interfaceWindowLikeContainerFixture
- 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.Frame
- Specified by:
moveToBack
in interfaceWindowLikeContainerFixture
- Returns:
- this fixture.
-
showPopupMenu
Shows a pop-up menu using this fixture's
as the invoker of the pop-up menu.Frame
- Specified by:
showPopupMenu
in interfaceJPopupMenuInvokerFixture
- Returns:
- a fixture that manages the displayed pop-up menu.
- Throws:
IllegalStateException
- if this fixture'sFrame
is disabled.IllegalStateException
- if this fixture'sFrame
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.Frame
- Specified by:
showPopupMenuAt
in 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'sFrame
is disabled.IllegalStateException
- if this fixture'sFrame
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
.Frame
- Specified by:
close
in interfaceWindowLikeContainerFixture
-