Gridarta Editor
net.sf.gridarta.model.mapmodel.TestMapModelHelper Class Reference

Helper class for creating MapModel instances for regression tests. More...

+ Collaboration diagram for net.sf.gridarta.model.mapmodel.TestMapModelHelper:

Public Member Functions

TestGameObject insertArchetype (@NotNull final MapModel< TestGameObject, TestMapArchObject, TestArchetype > mapModel, final int x, final int y, @NotNull final BaseObject< TestGameObject, TestMapArchObject, TestArchetype, ?> archetype, final boolean join)
 Inserts an archetype game object into a map model. More...
 
TestGameObject insertArchetype (@NotNull final MapModel< TestGameObject, TestMapArchObject, TestArchetype > mapModel, @NotNull final Point point, @NotNull final BaseObject< TestGameObject, TestMapArchObject, TestArchetype, ?> archetype, final boolean join)
 Inserts an archetype game object into a map model. More...
 
TestGameObject insertArchetype (@NotNull final GameObjectContainer< TestGameObject, TestMapArchObject, TestArchetype > gameObject, @NotNull final BaseObject< TestGameObject, TestMapArchObject, TestArchetype, ?> archetype)
 Inserts an archetype into a game object. More...
 
TestGameObject insertExit (@NotNull final MapModel< TestGameObject, TestMapArchObject, TestArchetype > mapModel, @NotNull final Point point)
 Inserts an exitArchetype game object into a map model. More...
 
TestGameObject insertExit (@NotNull final GameObjectContainer< TestGameObject, TestMapArchObject, TestArchetype > gameObject)
 Inserts an exitArchetype game object into a game object. More...
 
TestGameObject insertFloor (@NotNull final MapModel< TestGameObject, TestMapArchObject, TestArchetype > mapModel, @NotNull final Point point)
 Inserts a floorArchetype game object into a map model. More...
 
TestGameObject insertMob21 (@NotNull final MapModel< TestGameObject, TestMapArchObject, TestArchetype > mapModel, @NotNull final Point point)
 Inserts a mob21Archetype game object into a map model. More...
 
TestGameObject insertMob21 (@NotNull final GameObjectContainer< TestGameObject, TestMapArchObject, TestArchetype > gameObject)
 Inserts a mob21Archetype game object into a game object. More...
 
 TestMapModelHelper (@NotNull final InsertionMode< TestGameObject, TestMapArchObject, TestArchetype > topmostInsertionMode, @NotNull final GameObjectFactory< TestGameObject, TestMapArchObject, TestArchetype > gameObjectFactory, @NotNull final ArchetypeSet< TestGameObject, TestMapArchObject, TestArchetype > archetypeSet, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects) throws DuplicateArchetypeException
 Creates a new instance. More...
 

Static Public Member Functions

static void checkContents (@NotNull final Iterable< TestGameObject > mapSquare, @NotNull final BaseObject<?, ?, ?, ?>... gameObjects)
 Checks that a MapSquare contains the given game objects. More...
 
static void checkMapContents (@NotNull final MapModel< TestGameObject, TestMapArchObject, TestArchetype > mapModel, @NotNull final String... lines)
 Checks for expected MapModel's contents. More...
 

Static Public Attributes

static final int EXIT_TYPE = 1
 The archetype type used for "exit" game objects. More...
 

Static Private Member Functions

static void checkContentsString (@NotNull final MapSquare< TestGameObject, TestMapArchObject, TestArchetype > mapSquare, @NotNull final String... gameObjects)
 Checks that a MapSquare contains the given game objects. More...
 

Private Attributes

final TestArchetype exitArchetype
 The archetype to create exit game objects. More...
 
final TestArchetype floorArchetype
 The archetype to create floor game objects. More...
 
final GameObjectFactory< TestGameObject, TestMapArchObject, TestArchetypegameObjectFactory
 The GameObjectFactory instance. More...
 
final TestArchetype mob21Archetype
 The archetype to create 2x1 mob game objects. More...
 
final InsertionMode< TestGameObject, TestMapArchObject, TestArchetypetopmostInsertionMode
 The "topmost" InsertionMode instance. More...
 

Static Private Attributes

static final String [] EMPTY_STRING_ARRAY = new String[0]
 An empty array of strings. More...
 
static final int FLOOR_TYPE = 2
 The archetype type used for "floor" game objects. More...
 
static final int MOB_TYPE = 3
 The archetype type used for "mob" game objects. More...
 

Detailed Description

Helper class for creating MapModel instances for regression tests.

Author
Andreas Kirschbaum

Definition at line 45 of file TestMapModelHelper.java.

Constructor & Destructor Documentation

◆ TestMapModelHelper()

net.sf.gridarta.model.mapmodel.TestMapModelHelper.TestMapModelHelper ( @NotNull final InsertionMode< TestGameObject, TestMapArchObject, TestArchetype topmostInsertionMode,
@NotNull final GameObjectFactory< TestGameObject, TestMapArchObject, TestArchetype gameObjectFactory,
@NotNull final ArchetypeSet< TestGameObject, TestMapArchObject, TestArchetype archetypeSet,
@NotNull final FaceObjectProviders  faceObjectProviders,
@NotNull final AnimationObjects  animationObjects 
) throws DuplicateArchetypeException

Creates a new instance.

Parameters
topmostInsertionModethe "topmost" insertion mode instance
gameObjectFactorythe game object factory to use
archetypeSetthe archetype set to use
faceObjectProvidersthe face object providers to use
animationObjectsthe animation objects to use
Exceptions
DuplicateArchetypeExceptionif an internal error occurs

Definition at line 107 of file TestMapModelHelper.java.

References net.sf.gridarta.model.mapmodel.TestMapModelHelper.gameObjectFactory, net.sf.gridarta.model.archetype.Archetype< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.setMultiX(), net.sf.gridarta.model.mapmodel.TestMapModelHelper.topmostInsertionMode, and net.sf.gridarta.model.baseobject.BaseObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R, T extends BaseObject< G, A, R, T >.TYPE.

+ Here is the call graph for this function:

Member Function Documentation

◆ checkContents()

static void net.sf.gridarta.model.mapmodel.TestMapModelHelper.checkContents ( @NotNull final Iterable< TestGameObject mapSquare,
@NotNull final BaseObject<?, ?, ?, ?>...  gameObjects 
)
static

Checks that a MapSquare contains the given game objects.

Parameters
mapSquarethe map square
gameObjectsthe game object

Definition at line 277 of file TestMapModelHelper.java.

Referenced by net.sf.gridarta.gui.copybuffer.CopyBufferTest.testCutPaste1(), net.sf.gridarta.action.SelectedSquareActionsTest.testDoMoveSquareBottomMulti(), net.sf.gridarta.action.SelectedSquareActionsTest.testDoMoveSquareBottomSingle(), net.sf.gridarta.action.SelectedSquareActionsTest.testDoMoveSquareDownMulti(), net.sf.gridarta.action.SelectedSquareActionsTest.testDoMoveSquareDownSingle(), net.sf.gridarta.action.SelectedSquareActionsTest.testDoMoveSquareEnvMulti3(), net.sf.gridarta.action.SelectedSquareActionsTest.testDoMoveSquareEnvMulti4(), net.sf.gridarta.action.SelectedSquareActionsTest.testDoMoveSquareEnvSingle1(), net.sf.gridarta.action.SelectedSquareActionsTest.testDoMoveSquareEnvSingle2(), net.sf.gridarta.action.SelectedSquareActionsTest.testDoMoveSquareEnvSingle3(), net.sf.gridarta.action.SelectedSquareActionsTest.testDoMoveSquareInvIntoHead1(), net.sf.gridarta.action.SelectedSquareActionsTest.testDoMoveSquareInvMulti1(), net.sf.gridarta.action.SelectedSquareActionsTest.testDoMoveSquareInvSingle1(), net.sf.gridarta.action.SelectedSquareActionsTest.testDoMoveSquareTopMulti(), net.sf.gridarta.action.SelectedSquareActionsTest.testDoMoveSquareTopSingle(), net.sf.gridarta.action.SelectedSquareActionsTest.testDoMoveSquareUpMulti(), and net.sf.gridarta.action.SelectedSquareActionsTest.testDoMoveSquareUpSingle().

+ Here is the caller graph for this function:

◆ checkContentsString()

static void net.sf.gridarta.model.mapmodel.TestMapModelHelper.checkContentsString ( @NotNull final MapSquare< TestGameObject, TestMapArchObject, TestArchetype mapSquare,
@NotNull final String...  gameObjects 
)
staticprivate

◆ checkMapContents()

static void net.sf.gridarta.model.mapmodel.TestMapModelHelper.checkMapContents ( @NotNull final MapModel< TestGameObject, TestMapArchObject, TestArchetype mapModel,
@NotNull final String...  lines 
)
static

Checks for expected MapModel's contents.

Parameters
mapModelthe map model
linesthe expected contents

Definition at line 230 of file TestMapModelHelper.java.

References net.sf.gridarta.model.mapmodel.TestMapModelHelper.checkContentsString(), net.sf.gridarta.model.mapmodel.TestMapModelHelper.EMPTY_STRING_ARRAY, net.sf.gridarta.utils.Size2D.getHeight(), net.sf.gridarta.utils.Size2D.getWidth(), and net.sf.gridarta.utils.StringUtils.PATTERN_COMMA.

Referenced by net.sf.gridarta.gui.copybuffer.CopyBufferTest.testCutPaste1(), net.sf.gridarta.action.SelectedSquareActionsTest.testDoMoveSquareInvIntoHead1(), net.sf.gridarta.actions.UndoActionsTest.testInsert1(), net.sf.gridarta.model.autojoin.AutojoinListsTest.testInsert1(), net.sf.gridarta.model.autojoin.AutojoinListsTest.testInsertAlt1(), net.sf.gridarta.model.autojoin.AutojoinListsTest.testInsertAlt2(), net.sf.gridarta.model.autojoin.AutojoinListsTest.testInsertAlt3(), net.sf.gridarta.model.autojoin.AutojoinListsTest.testInsertDuplicate1(), net.sf.gridarta.model.autojoin.AutojoinListsTest.testInsertReplace1(), net.sf.gridarta.action.SelectedSquareActionsTest.testMoveEnvIntoSelectedMapSquare(), net.sf.gridarta.action.SelectedSquareActionsTest.testMoveTailPart(), net.sf.gridarta.model.autojoin.AutojoinListsTest.testRemove1(), net.sf.gridarta.model.autojoin.AutojoinListsTest.testRemoveAlt1(), net.sf.gridarta.model.autojoin.AutojoinListsTest.testRemoveAlt2(), net.sf.gridarta.model.autojoin.AutojoinListsTest.testRemoveAlt3(), and net.sf.gridarta.model.mapmanager.DefaultMapManagerTest.testRevertResizedMap().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insertArchetype() [1/3]

TestGameObject net.sf.gridarta.model.mapmodel.TestMapModelHelper.insertArchetype ( @NotNull final MapModel< TestGameObject, TestMapArchObject, TestArchetype mapModel,
final int  x,
final int  y,
@NotNull final BaseObject< TestGameObject, TestMapArchObject, TestArchetype, ?>  archetype,
final boolean  join 
)

◆ insertArchetype() [2/3]

TestGameObject net.sf.gridarta.model.mapmodel.TestMapModelHelper.insertArchetype ( @NotNull final MapModel< TestGameObject, TestMapArchObject, TestArchetype mapModel,
@NotNull final Point  point,
@NotNull final BaseObject< TestGameObject, TestMapArchObject, TestArchetype, ?>  archetype,
final boolean  join 
)

Inserts an archetype game object into a map model.

Parameters
mapModelthe map model to insert into
pointthe position to insert at
archetypethe archetype to insert
joinwhether to perform autojoining
Returns
the inserted game object

Definition at line 184 of file TestMapModelHelper.java.

◆ insertArchetype() [3/3]

TestGameObject net.sf.gridarta.model.mapmodel.TestMapModelHelper.insertArchetype ( @NotNull final GameObjectContainer< TestGameObject, TestMapArchObject, TestArchetype gameObject,
@NotNull final BaseObject< TestGameObject, TestMapArchObject, TestArchetype, ?>  archetype 
)

Inserts an archetype into a game object.

Parameters
gameObjectthe game object
archetypethe archetype to insert
Returns
the inserted game object

Definition at line 219 of file TestMapModelHelper.java.

◆ insertExit() [1/2]

TestGameObject net.sf.gridarta.model.mapmodel.TestMapModelHelper.insertExit ( @NotNull final MapModel< TestGameObject, TestMapArchObject, TestArchetype mapModel,
@NotNull final Point  point 
)

Inserts an exitArchetype game object into a map model.

Parameters
mapModelthe map model to insert into
pointthe position to insert at
Returns
the inserted game object

Definition at line 146 of file TestMapModelHelper.java.

References net.sf.gridarta.model.mapmodel.TestMapModelHelper.insertArchetype().

Referenced by net.sf.gridarta.action.SelectedSquareActionsTest.testDoMoveSquareBottomSingle(), net.sf.gridarta.action.SelectedSquareActionsTest.testDoMoveSquareDownSingle(), net.sf.gridarta.action.SelectedSquareActionsTest.testDoMoveSquareEnvMulti3(), net.sf.gridarta.action.SelectedSquareActionsTest.testDoMoveSquareEnvMulti4(), net.sf.gridarta.action.SelectedSquareActionsTest.testDoMoveSquareEnvSingle1(), net.sf.gridarta.action.SelectedSquareActionsTest.testDoMoveSquareEnvSingle2(), net.sf.gridarta.action.SelectedSquareActionsTest.testDoMoveSquareEnvSingle3(), net.sf.gridarta.action.SelectedSquareActionsTest.testDoMoveSquareInvMulti1(), net.sf.gridarta.action.SelectedSquareActionsTest.testDoMoveSquareInvSingle1(), net.sf.gridarta.model.gameobject.GameObjectFactoryTest.testDoMoveSquareTopSingle(), net.sf.gridarta.action.SelectedSquareActionsTest.testDoMoveSquareTopSingle(), net.sf.gridarta.action.SelectedSquareActionsTest.testDoMoveSquareUpSingle(), net.sf.gridarta.actions.ExitConnectorActionsTest.testExitConnect1(), net.sf.gridarta.actions.ExitConnectorActionsTest.testExitPaste1(), net.sf.gridarta.action.SelectedSquareActionsTest.testMoveTailPart(), and net.sf.gridarta.actions.ExitConnectorActionsTest.testPath().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insertExit() [2/2]

TestGameObject net.sf.gridarta.model.mapmodel.TestMapModelHelper.insertExit ( @NotNull final GameObjectContainer< TestGameObject, TestMapArchObject, TestArchetype gameObject)

Inserts an exitArchetype game object into a game object.

Parameters
gameObjectthe game object
Returns
the inserted game object

Definition at line 198 of file TestMapModelHelper.java.

References net.sf.gridarta.model.mapmodel.TestMapModelHelper.insertArchetype().

+ Here is the call graph for this function:

◆ insertFloor()

TestGameObject net.sf.gridarta.model.mapmodel.TestMapModelHelper.insertFloor ( @NotNull final MapModel< TestGameObject, TestMapArchObject, TestArchetype mapModel,
@NotNull final Point  point 
)

◆ insertMob21() [1/2]

◆ insertMob21() [2/2]

TestGameObject net.sf.gridarta.model.mapmodel.TestMapModelHelper.insertMob21 ( @NotNull final GameObjectContainer< TestGameObject, TestMapArchObject, TestArchetype gameObject)

Inserts a mob21Archetype game object into a game object.

Parameters
gameObjectthe game object
Returns
the inserted game object

Definition at line 208 of file TestMapModelHelper.java.

References net.sf.gridarta.model.mapmodel.TestMapModelHelper.insertArchetype().

+ Here is the call graph for this function:

Member Data Documentation

◆ EMPTY_STRING_ARRAY

final String [] net.sf.gridarta.model.mapmodel.TestMapModelHelper.EMPTY_STRING_ARRAY = new String[0]
staticprivate

An empty array of strings.

Definition at line 66 of file TestMapModelHelper.java.

Referenced by net.sf.gridarta.model.mapmodel.TestMapModelHelper.checkMapContents().

◆ EXIT_TYPE

final int net.sf.gridarta.model.mapmodel.TestMapModelHelper.EXIT_TYPE = 1
static

◆ exitArchetype

final TestArchetype net.sf.gridarta.model.mapmodel.TestMapModelHelper.exitArchetype
private

The archetype to create exit game objects.

Definition at line 90 of file TestMapModelHelper.java.

◆ FLOOR_TYPE

final int net.sf.gridarta.model.mapmodel.TestMapModelHelper.FLOOR_TYPE = 2
staticprivate

The archetype type used for "floor" game objects.

Definition at line 55 of file TestMapModelHelper.java.

◆ floorArchetype

final TestArchetype net.sf.gridarta.model.mapmodel.TestMapModelHelper.floorArchetype
private

The archetype to create floor game objects.

Definition at line 84 of file TestMapModelHelper.java.

◆ gameObjectFactory

final GameObjectFactory<TestGameObject, TestMapArchObject, TestArchetype> net.sf.gridarta.model.mapmodel.TestMapModelHelper.gameObjectFactory
private

◆ mob21Archetype

final TestArchetype net.sf.gridarta.model.mapmodel.TestMapModelHelper.mob21Archetype
private

The archetype to create 2x1 mob game objects.

Definition at line 96 of file TestMapModelHelper.java.

◆ MOB_TYPE

final int net.sf.gridarta.model.mapmodel.TestMapModelHelper.MOB_TYPE = 3
staticprivate

The archetype type used for "mob" game objects.

Definition at line 60 of file TestMapModelHelper.java.

◆ topmostInsertionMode

final InsertionMode<TestGameObject, TestMapArchObject, TestArchetype> net.sf.gridarta.model.mapmodel.TestMapModelHelper.topmostInsertionMode
private

The "topmost" InsertionMode instance.

Definition at line 72 of file TestMapModelHelper.java.

Referenced by net.sf.gridarta.model.mapmodel.TestMapModelHelper.TestMapModelHelper().


The documentation for this class was generated from the following file: