public class JLabelFixture extends ComponentFixture<JLabel> implements CommonComponentFixture, JComponentFixture, JPopupMenuInvokerFixture, TextDisplayFixture
JLabel
s:
BACKGROUND_PROPERTY, FONT_PROPERTY, FOREGROUND_PROPERTY, robot, target
Constructor and Description |
---|
JLabelFixture(Robot robot,
JLabel target)
Creates a new
. |
JLabelFixture(Robot robot,
String labelName)
Creates a new
. |
Modifier and Type | Method and Description |
---|---|
JLabelFixture |
click()
Simulates a user clicking this fixture's
. |
JLabelFixture |
click(MouseButton button)
Simulates a user clicking this fixture's
. |
JLabelFixture |
click(MouseClickInfo mouseClickInfo)
Simulates a user clicking this fixture's
. |
Object |
clientProperty(Object key)
Returns the client property stored in this fixture's
, under the given key. |
JLabelFixture |
doubleClick()
Simulates a user double-clicking this fixture's
. |
protected void |
driver(JLabelDriver newDriver)
Sets the
to be used by this fixture. |
JLabelFixture |
focus()
Gives input focus to this fixture's
. |
JLabelFixture |
pressAndReleaseKey(KeyPressInfo keyPressInfo)
Simulates a user pressing given key with the given modifiers on this fixture's
. |
JLabelFixture |
pressAndReleaseKeys(int... keyCodes)
Simulates a user pressing and releasing the given keys on this fixture's
. |
JLabelFixture |
pressKey(int keyCode)
Simulates a user pressing the given key on this fixture's
. |
JLabelFixture |
releaseKey(int keyCode)
Simulates a user releasing the given key on this fixture's
. |
JLabelFixture |
requireDisabled()
Asserts that this fixture's
is disabled. |
JLabelFixture |
requireEnabled()
Asserts that this fixture's
is enabled. |
JLabelFixture |
requireEnabled(Timeout timeout)
Asserts that this fixture's
is enabled. |
JLabelFixture |
requireFocused()
Asserts that this fixture's
has input focus. |
JLabelFixture |
requireNotVisible()
Asserts that this fixture's
is not visible. |
JLabelFixture |
requireText(Pattern pattern)
Asserts that the text of this fixture's
matches the given regular expression pattern. |
JLabelFixture |
requireText(String expected)
Asserts that the text of this fixture's
is equal to the specified String . |
JLabelFixture |
requireToolTip(Pattern pattern)
Asserts that the toolTip in this fixture's
matches the given regular expression
pattern. |
JLabelFixture |
requireToolTip(String expected)
Asserts that the toolTip in this fixture's
matches the given value. |
JLabelFixture |
requireVisible()
Asserts that this fixture's
is visible. |
JLabelFixture |
rightClick()
Simulates a user right-clicking this fixture's
. |
JPopupMenuFixture |
showPopupMenu()
Shows a pop-up menu using this fixture's
as the invoker of the pop-up menu. |
JPopupMenuFixture |
showPopupMenuAt(Point p)
Shows a pop-up menu at the given point using this fixture's
as the invoker of the
pop-up menu. |
String |
text()
Returns the text of this fixture's
. |
background, component, font, foreground, requireShowing, targetCastedTo, validateNotNull
public JLabelFixture(Robot robot, JLabel target)
JLabelFixture
.robot
- performs simulation of user events on the given JLabel
.target
- the JLabel
to be managed by this fixture.NullPointerException
- if robot
is null
.NullPointerException
- if target
is null
.public JLabelFixture(Robot robot, String labelName)
JLabelFixture
.robot
- performs simulation of user events on a JLabel
.labelName
- the name of the JLabel
to find using the given Robot
.NullPointerException
- if robot
is null
.ComponentLookupException
- if a matching JLabel
could not be found.ComponentLookupException
- if more than one matching JLabel
is found.protected final void driver(JLabelDriver newDriver)
JLabelDriver
to be used by this fixture.newDriver
- the new JLabelDriver
.NullPointerException
- if the given driver is null
.public String text()
JLabel
.text
in interface TextDisplayFixture
JLabel
.public JLabelFixture click()
JLabel
.click
in interface MouseInputSimulationFixture
IllegalStateException
- if this fixture's JLabel
is disabled.IllegalStateException
- if this fixture's JLabel
is not showing on the screen.public JLabelFixture click(MouseButton button)
JLabel
.click
in interface MouseInputSimulationFixture
button
- the button to click.NullPointerException
- if the given MouseButton
is null
.IllegalStateException
- if this fixture's JLabel
is disabled.IllegalStateException
- if this fixture's JLabel
is not showing on the screen.public JLabelFixture click(MouseClickInfo mouseClickInfo)
JLabel
.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 JLabel
is disabled.IllegalStateException
- if this fixture's JLabel
is not showing on the screen.public JLabelFixture doubleClick()
JLabel
.doubleClick
in interface MouseInputSimulationFixture
IllegalStateException
- if this fixture's JLabel
is disabled.IllegalStateException
- if this fixture's JLabel
is not showing on the screen.public JLabelFixture rightClick()
JLabel
.rightClick
in interface MouseInputSimulationFixture
IllegalStateException
- if this fixture's JLabel
is disabled.IllegalStateException
- if this fixture's JLabel
is not showing on the screen.public JLabelFixture focus()
JLabel
.focus
in interface FocusableComponentFixture
IllegalStateException
- if this fixture's JLabel
is disabled.IllegalStateException
- if this fixture's JLabel
is not showing on the screen.public JLabelFixture pressAndReleaseKey(KeyPressInfo keyPressInfo)
JLabel
.
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 JLabel
is disabled.IllegalStateException
- if this fixture's JLabel
is not showing on the screen.KeyPressInfo
public JLabelFixture pressAndReleaseKeys(int... keyCodes)
JLabel
.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 JLabel
is disabled.IllegalStateException
- if this fixture's JLabel
is not showing on the screen.KeyEvent
public JLabelFixture pressKey(int keyCode)
JLabel
.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 JLabel
is disabled.IllegalStateException
- if this fixture's JLabel
is not showing on the screen.KeyEvent
public JLabelFixture releaseKey(int keyCode)
JLabel
.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 JLabel
is disabled.IllegalStateException
- if this fixture's JLabel
is not showing on the screen.KeyEvent
public JLabelFixture requireText(String expected)
JLabel
is equal to the specified String
.requireText
in interface TextDisplayFixture
expected
- the text to match.AssertionError
- if the text of this fixture's JLabel
is not equal to the given one.public JLabelFixture requireText(Pattern pattern)
JLabel
matches the given regular expression pattern.requireText
in interface TextDisplayFixture
pattern
- the regular expression pattern to match.AssertionError
- if the text of this fixture's JLabel
does not match the given regular
expression pattern.NullPointerException
- if the given regular expression pattern is null
.public JLabelFixture requireToolTip(String expected)
JLabel
matches the given value.requireToolTip
in interface ToolTipDisplayFixture
expected
- the given value. It can be a regular expression.AssertionError
- if the toolTip in this fixture's JLabel
does not match the given value.public JLabelFixture requireToolTip(Pattern pattern)
JLabel
matches the given regular expression
pattern.requireToolTip
in interface ToolTipDisplayFixture
pattern
- the regular expression pattern to match.NullPointerException
- if the given regular expression pattern is null
.AssertionError
- if the toolTip in this fixture's JLabel
does not match the given regular
expression pattern.public JLabelFixture requireFocused()
JLabel
has input focus.requireFocused
in interface FocusableComponentFixture
AssertionError
- if this fixture's JLabel
does not have input focus.public JLabelFixture requireEnabled()
JLabel
is enabled.requireEnabled
in interface StateVerificationFixture
AssertionError
- if this fixture's JLabel
is disabled.public JLabelFixture requireEnabled(Timeout timeout)
JLabel
is enabled.requireEnabled
in interface StateVerificationFixture
timeout
- the time this fixture will wait for the component to be enabled.WaitTimedOutError
- if this fixture's JLabel
is never enabled.public JLabelFixture requireDisabled()
JLabel
is disabled.requireDisabled
in interface StateVerificationFixture
AssertionError
- if this fixture's JLabel
is enabled.public JLabelFixture requireVisible()
JLabel
is visible.requireVisible
in interface StateVerificationFixture
AssertionError
- if this fixture's JLabel
is not visible.public JLabelFixture requireNotVisible()
JLabel
is not visible.requireNotVisible
in interface StateVerificationFixture
AssertionError
- if this fixture's JLabel
is visible.public Object clientProperty(Object key)
JLabel
, under the given key.clientProperty
in interface ClientPropertyStorageFixture
key
- the key to use to retrieve the client property.null
if the property was
not found.NullPointerException
- if the given key is null
.public JPopupMenuFixture showPopupMenu()
JLabel
as the invoker of the pop-up menu.showPopupMenu
in interface JPopupMenuInvokerFixture
IllegalStateException
- if this fixture's JLabel
is disabled.IllegalStateException
- if this fixture's JLabel
is not showing on the screen.ComponentLookupException
- if a pop-up menu cannot be found.public JPopupMenuFixture showPopupMenuAt(Point p)
JLabel
as the invoker of the
pop-up menu.showPopupMenuAt
in interface JPopupMenuInvokerFixture
p
- the given point where to show the pop-up menu.IllegalStateException
- if this fixture's JLabel
is disabled.IllegalStateException
- if this fixture's JLabel
is not showing on the screen.ComponentLookupException
- if a pop-up menu cannot be found.Copyright © 2007-2012 FEST (Fixtures for Easy Software Testing). All Rights Reserved.