public class JPopupMenuFixture extends ComponentFixture<JPopupMenu> implements CommonComponentFixture
JPopupMenu
s:
BACKGROUND_PROPERTY, FONT_PROPERTY, FOREGROUND_PROPERTY, robot, target
Constructor and Description |
---|
JPopupMenuFixture(Robot robot,
JPopupMenu target)
Creates a new
. |
Modifier and Type | Method and Description |
---|---|
JPopupMenuFixture |
click()
Simulates a user clicking this fixture's
. |
JPopupMenuFixture |
click(MouseButton button)
Simulates a user clicking this fixture's
. |
JPopupMenuFixture |
click(MouseClickInfo mouseClickInfo)
Simulates a user clicking this fixture's
. |
JPopupMenuFixture |
doubleClick()
Simulates a user double-clicking this fixture's
. |
protected void |
driver(JPopupMenuDriver newDriver)
Sets the
to be used by this fixture. |
JPopupMenuFixture |
focus()
Gives input focus to this fixture's
. |
JMenuItemFixture |
menuItem(GenericTypeMatcher<? extends JMenuItem> matcher)
Finds a
, contained in this fixture's ,
that matches the specified search criteria. |
JMenuItemFixture |
menuItem(String name)
Finds a
, contained in this fixture's ,
which name matches the specified one. |
JMenuItemFixture |
menuItemWithPath(String... path)
Finds a
in this fixture's , which path matches
the given one. |
String[] |
menuLabels()
Returns the contents of this fixture's
. |
JPopupMenuFixture |
pressAndReleaseKey(KeyPressInfo keyPressInfo)
Simulates a user pressing given key with the given modifiers on this fixture's
. |
JPopupMenuFixture |
pressAndReleaseKeys(int... keyCodes)
Simulates a user pressing and releasing the given keys on this fixture's
. |
JPopupMenuFixture |
pressKey(int keyCode)
Simulates a user pressing the given key on this fixture's
. |
JPopupMenuFixture |
releaseKey(int keyCode)
Simulates a user releasing the given key on this fixture's
. |
JPopupMenuFixture |
requireDisabled()
Asserts that this fixture's
is disabled. |
JPopupMenuFixture |
requireEnabled()
Asserts that this fixture's
is enabled. |
JPopupMenuFixture |
requireEnabled(Timeout timeout)
Asserts that this fixture's
is enabled. |
JPopupMenuFixture |
requireFocused()
Asserts that this fixture's
has input focus. |
JPopupMenuFixture |
requireNotVisible()
Asserts that this fixture's
is not visible. |
JPopupMenuFixture |
requireVisible()
Asserts that this fixture's
is visible. |
JPopupMenuFixture |
rightClick()
Simulates a user right-clicking this fixture's
. |
background, component, font, foreground, requireShowing, targetCastedTo, validateNotNull
public JPopupMenuFixture(Robot robot, JPopupMenu target)
JPopupMenuFixture
.robot
- performs simulation of user events on the given JPopupMenu
.target
- the JPopupMenu
to be managed by this fixture.NullPointerException
- if robot
is null
.NullPointerException
- if target
is null
.protected final void driver(JPopupMenuDriver newDriver)
JPopupMenuDriver
to be used by this fixture.newDriver
- the new JPopupMenuDriver
.NullPointerException
- if the given driver is null
.public JMenuItemFixture menuItem(String name)
JMenuItem
, contained in this fixture's JPopupMenu
,
which name matches the specified one.name
- the name to match.JMenuItem
found.ComponentLookupException
- if a JMenuItem
having a matching name could not be found.ComponentLookupException
- if more than one JMenuItem
having a matching name is found.public JMenuItemFixture menuItem(GenericTypeMatcher<? extends JMenuItem> matcher)
JMenuItem
, contained in this fixture's JPopupMenu
,
that matches the specified search criteria.matcher
- contains the search criteria for finding a JMenuItem
.JMenuItem
found.ComponentLookupException
- if a JMenuItem
that matches the given search criteria could not be
found.ComponentLookupException
- if more than one JMenuItem
that matches the given search criteria is
found.public JMenuItemFixture menuItemWithPath(String... path)
JMenuItem
in this fixture's JPopupMenu
, which path matches
the given one.
For example, if we are looking for the menu with text "New" contained under the menu with text "File", we can simply call
JPopupMenuFixture popupMenu = tree.showPopupMenu(); JMenuItemFixture menuItem = popupMenu.menuItemWithPath("File", "Menu");
path
- the path of the menu to find.JMenuItem
found.ComponentLookupException
- if a JMenuItem
under the given path could not be found.AssertionError
- if the Component
found under the given path is not a JMenuItem
.public String[] menuLabels()
JPopupMenu
.String
array representing the contents of this fixture's JPopupMenu
.public JPopupMenuFixture click()
JPopupMenu
.click
in interface MouseInputSimulationFixture
IllegalStateException
- if this fixture's JPopupMenu
is disabled.IllegalStateException
- if this fixture's JPopupMenu
is not showing on the screen.public JPopupMenuFixture click(MouseButton button)
JPopupMenu
.click
in interface MouseInputSimulationFixture
button
- the button to click.NullPointerException
- if the given MouseButton
is null
.IllegalStateException
- if this fixture's JPopupMenu
is disabled.IllegalStateException
- if this fixture's JPopupMenu
is not showing on the screen.public JPopupMenuFixture click(MouseClickInfo mouseClickInfo)
JPopupMenu
.click
in interface MouseInputSimulationFixture
mouseClickInfo
- specifies the button to click and the times the button should be clicked.NullPointerException
- if the given MouseClickInfo
is null
.IllegalStateException
- if this fixture's JPopupMenu
is disabled.IllegalStateException
- if this fixture's JPopupMenu
is not showing on the screen.public JPopupMenuFixture rightClick()
JPopupMenu
.rightClick
in interface MouseInputSimulationFixture
IllegalStateException
- if this fixture's JPopupMenu
is disabled.IllegalStateException
- if this fixture's JPopupMenu
is not showing on the screen.public JPopupMenuFixture doubleClick()
JPopupMenu
.doubleClick
in interface MouseInputSimulationFixture
IllegalStateException
- if this fixture's JPopupMenu
is disabled.IllegalStateException
- if this fixture's JPopupMenu
is not showing on the screen.public JPopupMenuFixture focus()
JPopupMenu
.focus
in interface FocusableComponentFixture
IllegalStateException
- if this fixture's JPopupMenu
is disabled.IllegalStateException
- if this fixture's JPopupMenu
is not showing on the screen.public JPopupMenuFixture pressAndReleaseKey(KeyPressInfo keyPressInfo)
JPopupMenu
.
Modifiers is a mask from the available InputEvent
masks.pressAndReleaseKey
in interface KeyboardInputSimulationFixture
keyPressInfo
- specifies the key and modifiers to press.NullPointerException
- if the given KeyPressInfo
is null
.IllegalArgumentException
- if the given code is not a valid key code.IllegalStateException
- if this fixture's JPopupMenu
is disabled.IllegalStateException
- if this fixture's JPopupMenu
is not showing on the screen.KeyPressInfo
public JPopupMenuFixture pressAndReleaseKeys(int... keyCodes)
JPopupMenu
. This
method does not affect the current focus.pressAndReleaseKeys
in interface KeyboardInputSimulationFixture
keyCodes
- one or more codes of the keys to press.NullPointerException
- if the given array of codes is null
.IllegalArgumentException
- if any of the given code is not a valid key code.IllegalStateException
- if this fixture's JPopupMenu
is disabled.IllegalStateException
- if this fixture's JPopupMenu
is not showing on the screen.KeyEvent
public JPopupMenuFixture pressKey(int keyCode)
JPopupMenu
.pressKey
in interface KeyboardInputSimulationFixture
keyCode
- the code of the key to press.IllegalArgumentException
- if any of the given code is not a valid key code.IllegalStateException
- if this fixture's JPopupMenu
is disabled.IllegalStateException
- if this fixture's JPopupMenu
is not showing on the screen.KeyEvent
public JPopupMenuFixture releaseKey(int keyCode)
JPopupMenu
.releaseKey
in interface KeyboardInputSimulationFixture
keyCode
- the code of the key to release.IllegalArgumentException
- if any of the given code is not a valid key code.IllegalStateException
- if this fixture's JPopupMenu
is disabled.IllegalStateException
- if this fixture's JPopupMenu
is not showing on the screen.KeyEvent
public JPopupMenuFixture requireFocused()
JPopupMenu
has input focus.requireFocused
in interface FocusableComponentFixture
AssertionError
- if this fixture's JPopupMenu
does not have input focus.public JPopupMenuFixture requireEnabled()
JPopupMenu
is enabled.requireEnabled
in interface StateVerificationFixture
AssertionError
- if this fixture's JPopupMenu
is disabled.public JPopupMenuFixture requireEnabled(Timeout timeout)
JPopupMenu
is enabled.requireEnabled
in interface StateVerificationFixture
timeout
- the time this fixture will wait for the component to be enabled.WaitTimedOutError
- if this fixture's JPopupMenu
is never enabled.public JPopupMenuFixture requireDisabled()
JPopupMenu
is disabled.requireDisabled
in interface StateVerificationFixture
AssertionError
- if this fixture's JPopupMenu
is enabled.public JPopupMenuFixture requireVisible()
JPopupMenu
is visible.requireVisible
in interface StateVerificationFixture
AssertionError
- if this fixture's JPopupMenu
is not visible.public JPopupMenuFixture requireNotVisible()
JPopupMenu
is not visible.requireNotVisible
in interface StateVerificationFixture
AssertionError
- if this fixture's JPopupMenu
is visible.Copyright © 2007-2012 FEST (Fixtures for Easy Software Testing). All Rights Reserved.