public class GraphicTestCase extends GUITestCase
GUITestCase
to support
testing of ACM graphics programs that use GObject
instances.GUITestCase.EventDispatchException
TestCase.AssertMethodCalledIncorrectly
Modifier and Type | Field and Description |
---|---|
GObjectFilter.Operator |
where
This field re-exports the
where operator from
GObjectFilter so that it is available
in test methods without requiring a static import. |
DISPOSE_CLASSES
Constructor and Description |
---|
GraphicTestCase()
Creates a new GraphicTestCase object.
|
GraphicTestCase(String name)
Creates a new GraphicTestCase object.
|
Modifier and Type | Method and Description |
---|---|
<T extends acm.graphics.GObject> |
getAllGObjectsMatching(Class<T> type)
Look up all
GObject s on the canvas of the
GraphicsProgram being tested by specifying their
class. |
<T extends acm.graphics.GObject> |
getAllGObjectsMatching(Class<T> type,
GObjectFilter filter)
Look up all
GObject s on the canvas of the
GraphicsProgram being tested by specifying their
class and a GObjectFilter . |
List<acm.graphics.GObject> |
getAllGObjectsMatching(GObjectFilter filter)
Look up all
GObject s on the canvas of the
GraphicsProgram being tested by specifying
a GObjectFilter . |
protected acm.graphics.GCanvas |
getCanvas()
Retrieve the
GCanvas object associated
with the GraphicsProgram being tested. |
<T extends acm.graphics.GObject> |
getFirstGObjectMatching(Class<T> type)
Look up a
GObject on the canvas of the GraphicsProgram
being tested by specifying its class. |
<T extends acm.graphics.GObject> |
getFirstGObjectMatching(Class<T> type,
GObjectFilter filter)
Look up a
GObject on the canvas of the GraphicsProgram
being tested by specifying its class and a GObjectFilter . |
acm.graphics.GObject |
getFirstGObjectMatching(GObjectFilter filter)
|
<T extends acm.graphics.GObject> |
getGObject(Class<T> type)
Look up a
GObject on the canvas of the GraphicsProgram
being tested by specifying its class. |
<T extends acm.graphics.GObject> |
getGObject(Class<T> type,
GObjectFilter filter)
Look up a
GObject on the canvas of the GraphicsProgram
being tested by specifying its class and a GObjectFilter . |
acm.graphics.GObject |
getGObject(GObjectFilter filter)
Look up a
GObject on the canvas of the GraphicsProgram
being tested, using a filter to specify which GObject you want. |
callGUIIOMethod, callGUIIOMethod, callGUIIOMethod, click, click, click, clickDialogButton, createHierarchy, doubleClick, doubleClick, enterText, fixtureSetUp, fixtureTearDown, focus, getAllComponentsMatching, getAllComponentsMatching, getAllComponentsMatching, getComponent, getComponent, getComponent, getComponent, getContents, getContents, getFinder, getFirstComponentMatching, getFirstComponentMatching, getFirstComponentMatching, getHierarchy, getPathFor, getRobot, getWindowTracker, keyPress, keyRelease, keyString, keyStroke, keyStroke, mouseDragFrom, mouseDragFrom, mouseDragOver, mouseDropOn, mouseDropOn, mouseExit, mouseMove, mousePress, mousePress, mouseRelease, not, rightClick, rightClick, runBare, runTestMethod, selectColorInChooser, selectFileInChooser, selectFilesInChooser, selectItem, selectItem, selectMenuItem, setInputDialogText, setModifiers, setSwitchFocus, showInFrame, showInFrame, showWindow, showWindow, sleep, toString, toString, toString
assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertFuzzyEquals, assertFuzzyEquals, assertSame, assertSame, assertTrue, assertTrue, compact, compact, contains, containsRegex, containsRegex, equals, equalsRegex, equalsRegex, fromFile, fromFile, fuzzyContains, fuzzyContainsRegex, fuzzyContainsRegex, fuzzyEquals, fuzzyEqualsRegex, fuzzyEqualsRegex, in, installExitHandler, instrumentIO, multiline, out, prepareIO, resetIO, resetSystemIO, setIn, setIn, setNormalizeLineEndings, setSystemIn, setUp, setUseFuzzyStringComparisons, stringNormalizer, systemErr, systemOut, tearDown, uninstallExitHandler
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runTest, setName, toString
public final GObjectFilter.Operator where
where
operator from
GObjectFilter
so that it is available
in test methods without requiring a static import.public GraphicTestCase()
public GraphicTestCase(String name)
name
- The name of this test case.public <T extends acm.graphics.GObject> T getGObject(Class<T> type)
GObject
on the canvas of the GraphicsProgram
being tested by specifying its class. This method expects the given
class to identify a unique GObject, meaning that there should only
be one instance of the given class on the canvas.
If no matching GObject exists, the test case will fail with an
appropriate message. If more than one matching GObject exists,
the test case will fail with an appropriate message.T
- This method is a template method, and the type T used for
the return value is implicitly deduced from the provided
argument type
.type
- The type (class) of the GObject you wish to retrieve, and
also the way you specify the return type of this method.getFirstGObjectMatching(Class)
,
getAllGObjectsMatching(Class)
public <T extends acm.graphics.GObject> T getGObject(Class<T> type, GObjectFilter filter)
GObject
on the canvas of the GraphicsProgram
being tested by specifying its class and a GObjectFilter
.
This method expects exactly one GObject to match your criteria.
If no matching GObjecty exists, the test case will fail with an
appropriate message. If more than one matching GObject exists,
the test case will fail with an appropriate message.T
- This method is a template method, and the type T used for
the return value is implicitly deduced from the provided
argument type
.type
- The type (class) of the GObject you wish to retrieve, and
also the way you specify the return type of this method.filter
- The search criteria.getFirstGObjectMatching(Class, GObjectFilter)
,
getAllGObjectsMatching(Class, GObjectFilter)
public acm.graphics.GObject getGObject(GObjectFilter filter)
GObject
on the canvas of the GraphicsProgram
being tested, using a filter to specify which GObject you want. This
method is more general than getGObject(Class, GObjectFilter)
,
since no class needs to be specified, but that also means the return
type is less specific (it is always GObject
).
This method expects the given filter to identify a unique GObject. If
no matching GObject exists, the test case will fail with an appropriate
message. If more than one matching GObject exists, the test case will
fail with an appropriate message.filter
- The search criteria.getFirstGObjectMatching(GObjectFilter)
,
getAllGObjectsMatching(GObjectFilter)
public <T extends acm.graphics.GObject> T getFirstGObjectMatching(Class<T> type)
GObject
on the canvas of the GraphicsProgram
being tested by specifying its class.
This method expects the given class to identify at least one such
GObject. If no matching GObject exists, the test case will fail
with an appropriate message. If more than one matching GObject
exists, the first one found will be returned (although client code
should not expect a specific search order).T
- This method is a template method, and the type T used for
the return value is implicitly deduced from the provided
argument type
.type
- The type (class) of the GObject you wish to retrieve, and
also the way you specify the return type of this method.getGObject(Class)
,
getAllGObjectsMatching(Class)
public <T extends acm.graphics.GObject> T getFirstGObjectMatching(Class<T> type, GObjectFilter filter)
GObject
on the canvas of the GraphicsProgram
being tested by specifying its class and a GObjectFilter
.
This method expects the given criteria to identify at least one such
GObject. If no matching GObject exists, the test case will fail
with an appropriate message. If more than one matching GObject
exists, the first one found will be returned (although client code
should not expect a specific search order).T
- This method is a template method, and the type T used for
the return value is implicitly deduced from the provided
argument type
.type
- The type (class) of the GObject you wish to retrieve, and
also the way you specify the return type of this method.filter
- The search criteria.getGObject(Class, GObjectFilter)
,
getAllGObjectsMatching(Class, GObjectFilter)
public acm.graphics.GObject getFirstGObjectMatching(GObjectFilter filter)
GObject
on the canvas of the GraphicsProgram
being tested by specifying a GObjectFilter
.
This method is more general
than getFirstGObjectMatching(Class, GObjectFilter)
, since no
class needs to be specified, but that also means the return type
is less specific (it is always GObject
).
This method expects the given criteria to identify at least one such
GObject. If no matching GObject exists, the test case will fail
with an appropriate message. If more than one matching GObject
exists, the first one found will be returned (although client code
should not expect a specific search order).filter
- The search criteria.getGObject(GObjectFilter)
,
getAllGObjectsMatching(GObjectFilter)
public <T extends acm.graphics.GObject> List<T> getAllGObjectsMatching(Class<T> type)
GObject
s on the canvas of the
GraphicsProgram
being tested by specifying their
class. All matching objects are returned in a list.T
- This method is a template method, and the type T used as
the List
element type in
the return value is implicitly deduced from the provided
argument type
.type
- The type (class) of the GObjects you wish to retrieve,
and also the way you specify the type of elements in
the list returned by this method.getGObject(Class)
,
getFirstGObjectMatching(Class)
public <T extends acm.graphics.GObject> List<T> getAllGObjectsMatching(Class<T> type, GObjectFilter filter)
GObject
s on the canvas of the
GraphicsProgram
being tested by specifying their
class and a GObjectFilter
. All matching objects are returned in
a list.T
- This method is a template method, and the type T used as
the List
element type in
the return value is implicitly deduced from the provided
argument type
.type
- The type (class) of the GObjects you wish to retrieve,
and also the way you specify the type of elements in
the list returned by this method.filter
- The search criteria.getGObject(Class,GObjectFilter)
,
getAllGObjectsMatching(Class, GObjectFilter)
public List<acm.graphics.GObject> getAllGObjectsMatching(GObjectFilter filter)
GObject
s on the canvas of the
GraphicsProgram
being tested by specifying
a GObjectFilter
.
All matching objects are returned in a list.
This method is more general than
getAllGObjectsMatching(Class, GObjectFilter)
, since no
class needs to be specified, but that also means the return type
is less specific (it is always List<GObject>
).filter
- The search criteria.getGObject(GObjectFilter)
,
getAllGObjectsMatching(GObjectFilter)
protected acm.graphics.GCanvas getCanvas()
GCanvas
object associated
with the GraphicsProgram
being tested.