20 package net.sf.gridarta.model.mapmodel;
22 import java.awt.Point;
23 import java.awt.image.BufferedImage;
24 import javax.swing.ImageIcon;
56 import org.jetbrains.annotations.NotNull;
57 import org.junit.Assert;
75 private static final String[]
ICON_NAMES = {
ResourceIcons.
SQUARE_SELECTED_SQUARE,
ResourceIcons.
SQUARE_SELECTED_SQUARE_NORTH,
ResourceIcons.
SQUARE_SELECTED_SQUARE_EAST,
ResourceIcons.
SQUARE_SELECTED_SQUARE_SOUTH,
ResourceIcons.
SQUARE_SELECTED_SQUARE_WEST,
ResourceIcons.
SQUARE_PRE_SELECTED_SQUARE,
ResourceIcons.
SQUARE_CURSOR,
ResourceIcons.
SQUARE_EMPTY,
ResourceIcons.
SQUARE_UNKNOWN,
ResourceIcons.
SQUARE_NO_FACE,
ResourceIcons.
SQUARE_NO_ARCH,
ResourceIcons.
DEFAULT_ICON,
ResourceIcons.
DEFAULT_PREVIEW,
ResourceIcons.
SQUARE_WARNING, };
145 final ImageIcon imageIcon =
new ImageIcon(
new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB));
146 for (
final String iconName : ICON_NAMES) {
147 resourceIcons.addToCache(iconName, imageIcon);
153 faceObjectProviders.
setNormal(faceProvider);
199 mapModel.addGameObjectToMap(gameObject,
new Point(x, y), insertionMode);
210 gameObject.addLast(inv);
248 Assert.fail(ex.getMessage());
249 throw new AssertionError(ex);
290 return new TestMapModelHelper(topmostInsertionMode, gameObjectFactory, archetypeSet, faceObjectProviders, animationObjects);
A FaceObjects for regression tests.
MapModel< TestGameObject, TestMapArchObject, TestArchetype > newMapModel(final int w, final int h)
Creates a new MapModel instance.
A MapModel reflects the data of a map.
Reading and writing of maps, handling of paths.
This package contains classes related to matching GameObjects, so called GameObjectMatchers.
void insertGameObject(@NotNull final GameObject< TestGameObject, TestMapArchObject, TestArchetype > gameObject, @NotNull final String archetypeName, @NotNull final String name)
Inserts a game object into the inventory of another game object.
TestMapModelCreator(final boolean createIcons)
Creates a new instance.
ArchetypeSet< TestGameObject, TestMapArchObject, TestArchetype > getArchetypeSet()
Returns the ArchetypeSet.
Helper class for regression tests to create MapModel instances.
Helper class for creating MapModel instances for regression tests.
Gridarta can handle frame information of animations and allow the selection of an animation using a t...
An AnimationObjects for regression tests.
final GameObjectFactory< TestGameObject, TestMapArchObject, TestArchetype > gameObjectFactory
The GameObjectFactory instance.
This interface represents a lazy loader that provides images on demand.
Interface for classes that read or write GameObject instances.
static final String SQUARE_NO_ARCH
FaceObjectProviders getFaceObjectProviders()
Returns the FaceObjectProviders instance.
Base implementation of ArchetypeSet.
final GameObjectMatchers gameObjectMatchers
The GameObjectMatchers instance.
A MapArchObject implementation for testing purposes.
final MapViewSettings mapViewSettings
The MapViewSettings instance.
InsertionModeSet< TestGameObject, TestMapArchObject, TestArchetype > getInsertionModeSet()
Returns the InsertionModeSet instance.
final FaceObjectProviders faceObjectProviders
The FaceObjectProviders instance.
A factory for creating Archetype instances.
Base package of all Gridarta classes.
final InsertionModeSet< TestGameObject, TestMapArchObject, TestArchetype > insertionModeSet
The InsertionModeSet instance.
Reflects a game object (object on a map).
An Archetype implementation for testing purposes.
Abstract factory for creating GameObject instances.
R getArchetype(@NotNull String archetypeName)
Returns an Archetype by its name.
final AutojoinLists< TestGameObject, TestMapArchObject, TestArchetype > autojoinLists
The AutojoinLists instance.
An Exception indicating that an Archetype name is not unique.
TestGameObject newGameObject(@NotNull final String archetypeName, @NotNull final String objectName)
Creates a new game object.
Container for settings that affect the rendering of maps.
AnimationObjects is a container for AnimationObjects.
GameObjects are the objects based on Archetypes found on maps.
final ArchetypeSet< TestGameObject, TestMapArchObject, TestArchetype > archetypeSet
The ArchetypeSet instance.
final AnimationObjects animationObjects
The AnimationObjects instance.
void setNormal(@NotNull final FaceProvider normalFaceProvider)
Sets the normal FaceProvider.
static final String SQUARE_UNKNOWN
static final String DEFAULT_PREVIEW
The default map preview to use if no icon can be created.
A GameObjectFactory for regression tests.
Maintains GameObjectMatcher instances.
static final String SQUARE_NO_FACE
FaceObjects is a container for FaceObjects.
TestArchetype newArchetype(@NotNull final String archetypeName)
Creates a new TestArchetype instance but doesn't add it to the archetype set.
void addArchetype(@NotNull R archetype)
Adds an Archetype to this Set.
static final String DEFAULT_ICON
The default map icon to use if no icon can be created.
static final String SQUARE_SELECTED_SQUARE_NORTH
void setMapSize(@NotNull final Size2D mapSize)
Sets the map size.
TestArchetype getArchetype(@NotNull final String archetypeName)
Returns an archetype.
Exception thrown if an Archetype does not exist.
static final String [] ICON_NAMES
Predefined icon names.
An ArchetypeFactory implementation for testing purposes.
GameObjectParser< TestGameObject, TestMapArchObject, TestArchetype > newGameObjectParser()
Creates a new GameObjectParser instance.
static final String SQUARE_SELECTED_SQUARE_SOUTH
TestMapModelHelper newTestMapModelHelper()
Creates a new TestMapModelHelper instance.
Provider for faces of GameObjects and Archetypes.
The face is the appearance of an object.
The view of the archetype chooser.
final ArchetypeChooserModel< TestGameObject, TestMapArchObject, TestArchetype > archetypeChooserModel
The ArchetypeChooserModel instance.
Manages a mapping between archetypes to AutojoinLists.
ResourceIcons getResourceIcons()
Returns the ResourceIcons instance.
A MapViewSettings implementation for regression tests.
Creates ImageIcon instances from resources.
String NAME
The attribute name of the object's name.
final ResourceIcons resourceIcons
The ResourceIcons instance.
AutojoinLists< TestGameObject, TestMapArchObject, TestArchetype > getAutojoinLists()
Returns the AutojoinLists instance.
void addGameObjectToMap(@NotNull final MapModel< TestGameObject, TestMapArchObject, TestArchetype > mapModel, @NotNull final String archetypeName, @NotNull final String name, final int x, final int y, @NotNull final InsertionMode< TestGameObject, TestMapArchObject, TestArchetype > insertionMode)
Inserts a game object into a map.
static final String SQUARE_SELECTED_SQUARE_EAST
MapViewSettings getMapViewSettings()
Returns the MapViewSettings instance.
ArchetypeChooserModel< TestGameObject, TestMapArchObject, TestArchetype > getArchetypeChooserModel()
Returns the ArchetypeChooserModel instance.
An Archetype implementation for testing purposes.
static final String SQUARE_PRE_SELECTED_SQUARE
An GameObjectMatcher matching certain archetype types.
A GameObject implementation for testing purposes.
static final String SQUARE_EMPTY
Interface that captures similarities between different ArchetypeSet implementations.
GameObjectMatchers getGameObjectMatchers()
Returns the GameObjectMatchers instance.
InsertionMode< TestGameObject, TestMapArchObject, TestArchetype > getTopmostInsertionMode()
Returns the "topmost" insertion mode.
static final String SQUARE_SELECTED_SQUARE_WEST
static final String SQUARE_SELECTED_SQUARE
final InsertionMode< TestGameObject, TestMapArchObject, TestArchetype > topmostInsertionMode
The "topmost" InsertionMode instance.
A FaceProvider that does not return any faces.
GameObjectFactory< TestGameObject, TestMapArchObject, TestArchetype > getGameObjectFactory()
Returns the GameObjectFactory instance.
A GameObjectParser for regression tests.
static final String SQUARE_WARNING
static final String SQUARE_CURSOR
Implementation of MapModel that covers the similarities between crossfire and daimonin.
The class Size2D represents a 2d rectangular area.