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
Frames:
- 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
ConstructorsConstructorDescriptionFrameFixture(Frame target) Creates a new.FrameFixtureFrameFixture(String name) Creates a new.FrameFixtureFrameFixture(Robot robot, Frame target) Creates a new.FrameFixtureFrameFixture(Robot robot, String name) Creates a new.FrameFixture -
Method Summary
Modifier and TypeMethodDescriptionclick()Simulates a user clicking this fixture's.Frameclick(MouseButton button) Simulates a user clicking this fixture's.Frameclick(MouseClickInfo mouseClickInfo) Simulates a user clicking this fixture's.Framevoidclose()Simulates a user closing this fixture's.Frameprivate voidSimulates a user deiconifying this fixture's.FrameSimulates a user double-clicking this fixture's.Frameprotected final voiddriver(FrameDriver newDriver) Sets theto be used by this fixture.FrameDriverfocus()Gives input focus to this fixture's.Frameiconify()Simulates a user iconifying this fixture's.Framemaximize()Simulates a user maximizing this fixture's.FrameSimulates a user moving this fixture'sto the given point.FrameIf the givenis visible, sends it to the back and may cause it to lose focus or activation if it is the focused or active.FrameIf fixture'sis visible, brings it to the front and may make it the focused one.FrameSimulates a user normalizing this fixture's.FramepressAndReleaseKey(KeyPressInfo keyPressInfo) Simulates a user pressing given key with the given modifiers on this fixture's.FramepressAndReleaseKeys(int... keyCodes) Simulates a user pressing and releasing the given keys on this fixture's.FramepressKey(int keyCode) Simulates a user pressing the given key on this fixture's.FramereleaseKey(int keyCode) Simulates a user releasing the given key on this fixture's.FrameAsserts that this fixture'sis disabled.FrameAsserts that this fixture'sis enabled.FramerequireEnabled(Timeout timeout) Asserts that this fixture'sis enabled.FrameAsserts that this fixture'shas input focus.FrameAsserts that this fixture'sis not visible.FramerequireSize(Dimension size) Asserts that the size of this fixture'sis equal to given one.FrameAsserts that this fixture'sis visible.FrameresizeHeightTo(int height) Simulates a user resizing vertically this fixture's.FrameSimulates a user resizing this fixture's.FrameresizeWidthTo(int width) Simulates a user resizing horizontally this fixture's.FrameSimulates a user right-clicking this fixture's.Frameshow()Shows this fixture's.FrameShows this fixture's, resized to the given size.FrameShows a pop-up menu using this fixture'sas the invoker of the pop-up menu.FrameShows a pop-up menu at the given point using this fixture'sas the invoker of the pop-up menu.FrameMethods 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
-
FrameFixture
Creates a new. This constructor creates a newFrameFixturecontaining the current AWT hierarchy.Robot- Parameters:
target- theFrameto 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- theFrameto 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 theFrameto find using the givenRobot.- Throws:
NullPointerException- if the given robot isnull.ComponentLookupException- if aFramehaving a matching name could not be found.ComponentLookupException- if more than oneFramehaving a matching name is found.
-
FrameFixture
Creates a new. This constructor creates a newFrameFixturecontaining the current AWT hierarchy.Robot- Parameters:
name- the name of theFrameto find.- Throws:
ComponentLookupException- if aFramehaving a matching name could not be found.ComponentLookupException- if more than oneFramehaving a matching name is found.
-
-
Method Details
-
createDriver
private void createDriver() -
driver
Sets theto 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:
clickin interfaceMouseInputSimulationFixture- Returns:
- this fixture.
-
click
Simulates a user clicking this fixture's.Frame- Specified by:
clickin interfaceMouseInputSimulationFixture- Parameters:
button- the button to click.- Returns:
- this fixture.
-
click
Simulates a user clicking this fixture's.Frame- Specified by:
clickin interfaceMouseInputSimulationFixture- 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.Frame- Specified by:
doubleClickin interfaceMouseInputSimulationFixture- Returns:
- this fixture.
-
rightClick
Simulates a user right-clicking this fixture's.Frame- Specified by:
rightClickin interfaceMouseInputSimulationFixture- Returns:
- this fixture.
-
iconify
Simulates a user iconifying this fixture's.Frame- Specified by:
iconifyin interfaceFrameLikeFixture- Returns:
- this fixture.
-
deiconify
Simulates a user deiconifying this fixture's.Frame- Specified by:
deiconifyin interfaceFrameLikeFixture- Returns:
- this fixture.
-
maximize
Simulates a user maximizing this fixture's.Frame- Specified by:
maximizein 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:
normalizein interfaceFrameLikeFixture- Returns:
- this fixture.
-
focus
Gives input focus to this fixture's.Frame- Specified by:
focusin interfaceFocusableComponentFixture- Returns:
- this fixture.
-
moveTo
Simulates a user moving this fixture'sto the given point.Frame- Specified by:
moveToin interfaceWindowLikeContainerFixture- Parameters:
p- the point to move this fixture'sFrameto.- Returns:
- this fixture.
-
pressAndReleaseKey
Simulates a user pressing given key with the given modifiers on this fixture's. Modifiers is a mask from the availableFramemasks.InputEvent- Specified by:
pressAndReleaseKeyin interfaceKeyboardInputSimulationFixture- 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.Frame- Specified by:
pressAndReleaseKeysin 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:
pressKeyin 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:
releaseKeyin 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'shas input focus.Frame- Specified by:
requireFocusedin interfaceFocusableComponentFixture- Returns:
- this fixture.
- Throws:
AssertionError- if this fixture'sFramedoes not have input focus.
-
requireDisabled
Asserts that this fixture'sis disabled.Frame- Specified by:
requireDisabledin interfaceStateVerificationFixture- Returns:
- this fixture.
- Throws:
AssertionError- if this fixture'sFrameis enabled.
-
requireEnabled
Asserts that this fixture'sis enabled.Frame- Specified by:
requireEnabledin interfaceStateVerificationFixture- Returns:
- this fixture.
- Throws:
AssertionError- if this fixture'sFrameis disabled.
-
requireEnabled
Asserts that this fixture'sis enabled.Frame- Specified by:
requireEnabledin interfaceStateVerificationFixture- Parameters:
timeout- the time this fixture will wait for the component to be enabled.- Returns:
- this fixture.
- Throws:
WaitTimedOutError- if this fixture'sFrameis never enabled.
-
requireNotVisible
Asserts that this fixture'sis not visible.Frame- Specified by:
requireNotVisiblein interfaceStateVerificationFixture- Returns:
- this fixture.
- Throws:
AssertionError- if this fixture'sFrameis visible.
-
requireSize
Asserts that the size of this fixture'sis equal to given one.Frame- Specified by:
requireSizein interfaceWindowLikeContainerFixture- Parameters:
size- the given size to match.- Returns:
- this fixture.
- Throws:
AssertionError- if the size of this fixture'sFrameis not equal to the given size.
-
requireVisible
Asserts that this fixture'sis visible.Frame- Specified by:
requireVisiblein interfaceStateVerificationFixture- Returns:
- this fixture.
- Throws:
AssertionError- if this fixture'sFrameis not visible.
-
resizeHeightTo
Simulates a user resizing vertically this fixture's.Frame- Specified by:
resizeHeightToin interfaceWindowLikeContainerFixture- Parameters:
height- the height that this fixture'sFrameshould have after being resized.- Returns:
- this fixture.
-
resizeTo
Simulates a user resizing this fixture's.Frame- Specified by:
resizeToin 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:
resizeWidthToin interfaceWindowLikeContainerFixture- Parameters:
width- the width that this fixture'sFrameshould have after being resized.- Returns:
- this fixture.
-
show
Shows this fixture's.Frame- Specified by:
showin classWindowFixture<Frame>- Returns:
- this fixture.
-
show
Shows this fixture's, resized to the given size.Frame- Specified by:
showin classWindowFixture<Frame>- Parameters:
size- the size to resize this fixture'sFrameto.- Returns:
- this fixture.
-
moveToFront
If fixture'sis visible, brings it to the front and may make it the focused one.Frame- Specified by:
moveToFrontin interfaceWindowLikeContainerFixture- 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.Frame- Specified by:
moveToBackin interfaceWindowLikeContainerFixture- Returns:
- this fixture.
-
showPopupMenu
Shows a pop-up menu using this fixture'sas the invoker of the pop-up menu.Frame- Specified by:
showPopupMenuin interfaceJPopupMenuInvokerFixture- Returns:
- a fixture that manages the displayed pop-up menu.
- Throws:
IllegalStateException- if this fixture'sFrameis disabled.IllegalStateException- if this fixture'sFrameis 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.Frame- Specified by:
showPopupMenuAtin 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'sFrameis disabled.IllegalStateException- if this fixture'sFrameis 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:
closein interfaceWindowLikeContainerFixture
-