|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.fest.swing.fixture.ComponentFixture<JTextComponent>
org.fest.swing.fixture.JTextComponentFixture
public class JTextComponentFixture
Understands functional testing of
s:
JTextComponent
Field Summary |
---|
Fields inherited from class org.fest.swing.fixture.ComponentFixture |
---|
BACKGROUND_PROPERTY, FONT_PROPERTY, FOREGROUND_PROPERTY, robot, target |
Constructor Summary | |
---|---|
JTextComponentFixture(Robot robot,
JTextComponent target)
Creates a new . |
|
JTextComponentFixture(Robot robot,
String textComponentName)
Creates a new . |
Method Summary | |
---|---|
JTextComponentFixture |
click()
Simulates a user clicking this fixture's . |
JTextComponentFixture |
click(MouseButton button)
Simulates a user clicking this fixture's . |
JTextComponentFixture |
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. |
JTextComponentFixture |
deleteText()
Simulates a user deleting all the text in this fixture's . |
JTextComponentFixture |
doubleClick()
Simulates a user double-clicking this fixture's . |
protected void |
driver(JTextComponentDriver newDriver)
Sets the to be used by this fixture. |
JTextComponentFixture |
enterText(String text)
Simulates a user entering the given text in this fixture's . |
JTextComponentFixture |
focus()
Gives input focus to this fixture's . |
JTextComponentFixture |
pressAndReleaseKey(KeyPressInfo keyPressInfo)
Simulates a user pressing given key with the given modifiers on this fixture's . |
JTextComponentFixture |
pressAndReleaseKeys(int... keyCodes)
Simulates a user pressing and releasing the given keys in this fixture's . |
JTextComponentFixture |
pressKey(int keyCode)
Simulates a user pressing the given key on this fixture's . |
JTextComponentFixture |
releaseKey(int keyCode)
Simulates a user releasing the given key on this fixture's . |
JTextComponentFixture |
requireDisabled()
Asserts that this fixture's is disabled. |
JTextComponentFixture |
requireEditable()
Asserts that this fixture's is editable. |
JTextComponentFixture |
requireEmpty()
Asserts that the target text component does not contain any text. |
JTextComponentFixture |
requireEnabled()
Asserts that this fixture's is enabled. |
JTextComponentFixture |
requireEnabled(Timeout timeout)
Asserts that this fixture's is enabled. |
JTextComponentFixture |
requireFocused()
Asserts that this fixture's has input focus. |
JTextComponentFixture |
requireNotEditable()
Asserts that this fixture's is not editable. |
JTextComponentFixture |
requireNotVisible()
Asserts that this fixture's is not visible. |
JTextComponentFixture |
requireText(Pattern pattern)
Asserts that the text of this fixture's matches the given regular expression
pattern. |
JTextComponentFixture |
requireText(String expected)
Asserts that the text of this fixture's is equal to the specified value. |
JTextComponentFixture |
requireToolTip(Pattern pattern)
Asserts that the toolTip in this fixture's matches the given regular expression
pattern. |
JTextComponentFixture |
requireToolTip(String expected)
Asserts that the toolTip in this fixture's matches the given value. |
JTextComponentFixture |
requireVisible()
Asserts that this fixture's is visible. |
JTextComponentFixture |
rightClick()
Simulates a user right-clicking this fixture's . |
JTextComponentFixture |
select(String text)
Simulates a user selecting the given text contained in this fixture's . |
JTextComponentFixture |
selectAll()
Simulates a user selecting all the text contained in this fixture's . |
JTextComponentFixture |
selectText(int start,
int end)
Simulates a user selecting a portion of the text contained in this fixture's . |
JTextComponentFixture |
setText(String text)
Sets the text in 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 . |
Methods inherited from class org.fest.swing.fixture.ComponentFixture |
---|
background, component, font, foreground, requireShowing, targetCastedTo, validateNotNull |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JTextComponentFixture(Robot robot, JTextComponent target)
JTextComponentFixture
.
robot
- performs simulation of user events on the given JTextComponent
.target
- the JTextComponent
to be managed by this fixture.
NullPointerException
- if robot
is null
.
NullPointerException
- if target
is null
.public JTextComponentFixture(Robot robot, String textComponentName)
JTextComponentFixture
.
robot
- performs simulation of user events on a JTextComponent
.textComponentName
- the name of the JTextComponent
to find using the given Robot
.
NullPointerException
- if robot
is null
.
ComponentLookupException
- if a matching JTextComponent
could not be found.
ComponentLookupException
- if more than one matching JTextComponent
is found.Method Detail |
---|
protected final void driver(JTextComponentDriver newDriver)
JTextComponentDriver
to be used by this fixture.
newDriver
- the new JTextComponentDriver
.
NullPointerException
- if the given driver is null
.public String text()
JTextComponent
.
text
in interface TextDisplayFixture
JTextComponent
.public JTextComponentFixture select(String text)
JTextComponent
.
select
in interface TextInputFixture
text
- the text to select.
IllegalStateException
- if this fixture's JTextComponent
is disabled.
IllegalStateException
- if this fixture's JTextComponent
is not showing on the screen.
IllegalArgumentException
- if this fixture's JTextComponent
does not contain the given text to
select.
ActionFailedException
- if the selecting the text in the given range fails.public JTextComponentFixture selectText(int start, int end)
JTextComponent
.
selectText
in interface TextInputFixture
start
- index where selection should start.end
- index where selection should end.
IllegalStateException
- if this fixture's JTextComponent
is disabled.
IllegalStateException
- if this fixture's JTextComponent
is not showing on the screen.
ActionFailedException
- if the selecting the text in the given range fails.public JTextComponentFixture selectAll()
JTextComponent
.
selectAll
in interface TextInputFixture
IllegalStateException
- if this fixture's JTextComponent
is disabled.
IllegalStateException
- if this fixture's JTextComponent
is not showing on the screen.public JTextComponentFixture click()
JTextComponent
.
click
in interface MouseInputSimulationFixture
IllegalStateException
- if this fixture's JTextComponent
is disabled.
IllegalStateException
- if this fixture's JTextComponent
is not showing on the screen.public JTextComponentFixture click(MouseButton button)
JTextComponent
.
click
in interface MouseInputSimulationFixture
button
- the button to click.
NullPointerException
- if the given MouseButton
is null
.
IllegalStateException
- if this fixture's JTextComponent
is disabled.
IllegalStateException
- if this fixture's JTextComponent
is not showing on the screen.public JTextComponentFixture click(MouseClickInfo mouseClickInfo)
JTextComponent
.
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 JTextComponent
is disabled.
IllegalStateException
- if this fixture's JTextComponent
is not showing on the screen.public JTextComponentFixture doubleClick()
JTextComponent
.
doubleClick
in interface MouseInputSimulationFixture
IllegalStateException
- if this fixture's JTextComponent
is disabled.
IllegalStateException
- if this fixture's JTextComponent
is not showing on the screen.public JTextComponentFixture rightClick()
JTextComponent
.
rightClick
in interface MouseInputSimulationFixture
IllegalStateException
- if this fixture's JTextComponent
is disabled.
IllegalStateException
- if this fixture's JTextComponent
is not showing on the screen.public JTextComponentFixture deleteText()
JTextComponent
.
deleteText
in interface TextInputFixture
IllegalStateException
- if this fixture's JTextComponent
is disabled.
IllegalStateException
- if this fixture's JTextComponent
is not showing on the screen.public JTextComponentFixture enterText(String text)
JTextComponent
.
enterText
in interface TextInputFixture
text
- the text to enter.
IllegalStateException
- if this fixture's JTextComponent
is disabled.
IllegalStateException
- if this fixture's JTextComponent
is not showing on the screen.public JTextComponentFixture setText(String text)
JTextComponent
. Unlike
enterText(String)
, this method bypasses the event system and allows immediate updating on the
underlying document model.
Primarily desired for speeding up tests when precise user event fidelity isn't necessary.
text
- the text to set.
IllegalStateException
- if this fixture's JTextComponent
is disabled.
IllegalStateException
- if this fixture's JTextComponent
is not showing on the screen.public JTextComponentFixture focus()
JTextComponent
.
focus
in interface FocusableComponentFixture
IllegalStateException
- if this fixture's JTextComponent
is disabled.
IllegalStateException
- if this fixture's JTextComponent
is not showing on the screen.public JTextComponentFixture pressAndReleaseKey(KeyPressInfo keyPressInfo)
JTextComponent
.
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 JTextComponent
is disabled.
IllegalStateException
- if this fixture's JTextComponent
is not showing on the screen.KeyPressInfo
public JTextComponentFixture pressAndReleaseKeys(int... keyCodes)
JTextComponent
. This
method does not affect the current focus.
pressAndReleaseKeys
in interface KeyboardInputSimulationFixture
keyCodes
- the 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 JTextComponent
is disabled.
IllegalStateException
- if this fixture's JTextComponent
is not showing on the screen.KeyEvent
public JTextComponentFixture pressKey(int keyCode)
JTextComponent
.
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 JTextComponent
is disabled.
IllegalStateException
- if this fixture's JTextComponent
is not showing on the screen.KeyEvent
public JTextComponentFixture releaseKey(int keyCode)
JTextComponent
.
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 JTextComponent
is disabled.
IllegalStateException
- if this fixture's JTextComponent
is not showing on the screen.KeyEvent
public JTextComponentFixture requireText(String expected)
JTextComponent
is equal to the specified value.
requireText
in interface TextDisplayFixture
expected
- the text to match. It can be a regular expression pattern.
AssertionError
- if the text of this fixture's JTextComponent
is not equal to the given one.public JTextComponentFixture requireText(Pattern pattern)
JTextComponent
matches the given regular expression
pattern.
requireText
in interface TextDisplayFixture
pattern
- the regular expression pattern to match.
NullPointerException
- if the given regular expression pattern is null
.
AssertionError
- if the text of this fixture's JTextComponent
is not eual to the given one.public JTextComponentFixture requireEmpty()
AssertionError
- if the target text component is not empty.public JTextComponentFixture requireFocused()
JTextComponent
has input focus.
requireFocused
in interface FocusableComponentFixture
AssertionError
- if this fixture's JTextComponent
does not have input focus.public JTextComponentFixture requireEnabled()
JTextComponent
is enabled.
requireEnabled
in interface StateVerificationFixture
AssertionError
- if this fixture's JTextComponent
is disabled.public JTextComponentFixture requireEnabled(Timeout timeout)
JTextComponent
is enabled.
requireEnabled
in interface StateVerificationFixture
timeout
- the time this fixture will wait for the component to be enabled.
WaitTimedOutError
- if this fixture's JTextComponent
is never enabled.public JTextComponentFixture requireDisabled()
JTextComponent
is disabled.
requireDisabled
in interface StateVerificationFixture
AssertionError
- if this fixture's JTextComponent
is enabled.public JTextComponentFixture requireVisible()
JTextComponent
is visible.
requireVisible
in interface StateVerificationFixture
AssertionError
- if this fixture's JTextComponent
is not visible.public JTextComponentFixture requireNotVisible()
JTextComponent
is not visible.
requireNotVisible
in interface StateVerificationFixture
AssertionError
- if this fixture's JTextComponent
is visible.public JTextComponentFixture requireEditable()
JTextComponent
is editable.
requireEditable
in interface EditableComponentFixture
AssertionError
- if this fixture's JTextComponent
is not editable.public JTextComponentFixture requireNotEditable()
JTextComponent
is not editable.
requireNotEditable
in interface EditableComponentFixture
AssertionError
- if this fixture's JTextComponent
is editable.public JTextComponentFixture requireToolTip(String expected)
JTextComponent
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 JTextComponent
does not match the given
value.public JTextComponentFixture requireToolTip(Pattern pattern)
JTextComponent
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 JTextComponent
does not match the given
regular expression pattern.public Object clientProperty(Object key)
JTextComponent
, 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()
JTextComponent
as the invoker of the pop-up menu.
showPopupMenu
in interface JPopupMenuInvokerFixture
IllegalStateException
- if this fixture's JTextComponent
is disabled.
IllegalStateException
- if this fixture's JTextComponent
is not showing on the screen.
ComponentLookupException
- if a pop-up menu cannot be found.public JPopupMenuFixture showPopupMenuAt(Point p)
JTextComponent
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 JTextComponent
is disabled.
IllegalStateException
- if this fixture's JTextComponent
is not showing on the screen.
ComponentLookupException
- if a pop-up menu cannot be found.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |