T
- the type of Component
that this fixture can manage.public abstract class ComponentFixture<T extends Component> extends Object
Component
s:
Modifier and Type | Field and Description |
---|---|
protected static String |
BACKGROUND_PROPERTY
Name of the property "background".
|
protected static String |
FONT_PROPERTY
Name of the property "font".
|
protected static String |
FOREGROUND_PROPERTY
Name of the property "foreground".
|
Robot |
robot
Performs simulation of user events on
|
T |
target
This fixture's
. |
Constructor and Description |
---|
ComponentFixture(Robot robot,
Class<? extends T> type)
Creates a new
. |
ComponentFixture(Robot robot,
String name,
Class<? extends T> type)
Creates a new
. |
ComponentFixture(Robot robot,
T target)
Creates a new
. |
Modifier and Type | Method and Description |
---|---|
ColorFixture |
background()
Returns a fixture that verifies the background color of this fixture's
. |
T |
component()
Returns the GUI component in this fixture (same as
.) |
FontFixture |
font()
Returns a fixture that verifies the font of this fixture's
. |
ColorFixture |
foreground()
Returns a fixture that verifies the foreground color of this fixture's
. |
protected boolean |
requireShowing()
Returns whether showing components are the only ones participating in a component lookup.
|
<C extends T> |
targetCastedTo(Class<C> type)
Returns this fixture's
casted to the given sub-type. |
protected static void |
validateNotNull(ComponentDriver driver)
Validates that the given
is not null . |
protected static final String FONT_PROPERTY
protected static final String BACKGROUND_PROPERTY
protected static final String FOREGROUND_PROPERTY
public final T extends Component target
Component
.
Note: Access to this GUI component must be executed in the event dispatch thread. To do
so, please execute a
or
GuiQuery
(depending on what you need to do,) inside a
GuiTask
. To learn more about Swing threading, please read the
Swing Threading Policy.
GuiActionRunner
public ComponentFixture(Robot robot, Class<? extends T> type)
ComponentFixture
.robot
- performs simulation of user events on a Component
.type
- the type of the Component
to find using the given RobotFixture
.NullPointerException
- if robot
is null
.NullPointerException
- if type
is null
.ComponentLookupException
- if a matching component could not be found.ComponentLookupException
- if more than one matching component is found.public ComponentFixture(Robot robot, String name, Class<? extends T> type)
ComponentFixture
.robot
- performs simulation of user events on a Component
.name
- the name of the Component
to find using the given RobotFixture
.type
- the type of the Component
to find using the given RobotFixture
.NullPointerException
- if robot
is null
.NullPointerException
- if type
is null
.ComponentLookupException
- if a matching component could not be found.ComponentLookupException
- if more than one matching component is found.public ComponentFixture(Robot robot, T target)
ComponentFixture
.robot
- performs simulation of user events on the given Component
.target
- the Component
to be managed by this fixture.NullPointerException
- if robot
is null
.NullPointerException
- if target
is null
.protected static void validateNotNull(ComponentDriver driver)
ComponentDriver
is not null
.driver
- the ComponentDriver
to validate.NullPointerException
- if driver
is null
.protected boolean requireShowing()
component lookup scope
stored in this
fixture's Robot
.true
if only showing components can participate in a component lookup, false
otherwise.public final FontFixture font()
Component
.Component
.public final ColorFixture background()
Component
.Component
.public final ColorFixture foreground()
Component
.Component
.public final <C extends T> C targetCastedTo(Class<C> type)
Component
casted to the given sub-type.C
- enforces that the given type is a sub-type of the managed Component
.type
- the type that the managed Component
will be casted to.Component
casted to the given sub-type.AssertionError
- if this fixture's Component
is not an instance of the given type.public final T component()
target
.)
Note: Access to the GUI component returned by this method must be executed in the event
dispatch thread. To do so, please execute a
or
GuiQuery
(depending on what you need to do,) inside a
GuiTask
. To learn more about Swing threading, please read the
Swing Threading Policy.
GuiActionRunner
Copyright © 2007-2012 FEST (Fixtures for Easy Software Testing). All Rights Reserved.