Search in sources :

Example 11 with ViewerMock

use of com.b3dgs.lionengine.ViewerMock in project lionengine by b3dgs.

the class HudTest method before.

/**
 * Prepare test.
 */
@BeforeEach
public void before() {
    services.add(new ContextMock());
    services.add(new Handler(services));
    services.add(new Factory(services));
    services.add(new ViewerMock());
    services.add(new Cursor(services));
    services.add(new ComponentCollision());
}
Also used : ViewerMock(com.b3dgs.lionengine.ViewerMock) Handler(com.b3dgs.lionengine.game.feature.Handler) Factory(com.b3dgs.lionengine.game.feature.Factory) ComponentCollision(com.b3dgs.lionengine.game.feature.collidable.ComponentCollision) ContextMock(com.b3dgs.lionengine.ContextMock) Cursor(com.b3dgs.lionengine.game.Cursor) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 12 with ViewerMock

use of com.b3dgs.lionengine.ViewerMock in project lionengine by b3dgs.

the class MapTileRasteredModelTest method prepare.

/**
 * Prepare test.
 */
@BeforeEach
public void prepare() {
    services.add(new Camera());
    viewer = services.add(new ViewerMock());
    viewer.set(-20, -20);
    map = services.add(new MapTileGame());
    mapViewer = new MapTileViewerModel(services);
    mapViewer.prepare(map);
    mapRastered = new MapTileRasteredModel();
    mapRastered.prepare(map);
}
Also used : ViewerMock(com.b3dgs.lionengine.ViewerMock) MapTileGame(com.b3dgs.lionengine.game.feature.tile.map.MapTileGame) Camera(com.b3dgs.lionengine.game.feature.Camera) MapTileViewerModel(com.b3dgs.lionengine.game.feature.tile.map.viewer.MapTileViewerModel) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 13 with ViewerMock

use of com.b3dgs.lionengine.ViewerMock in project lionengine by b3dgs.

the class MapTileViewerModelTest method prepare.

/**
 * Prepare test.
 */
@BeforeEach
public void prepare() {
    services.add(new Camera());
    viewer = services.add(new ViewerMock());
    viewer.set(-20, -20);
    map = services.add(new MapTileGame());
    mapViewer = new MapTileViewerModel(services);
    mapViewer.prepare(map);
}
Also used : ViewerMock(com.b3dgs.lionengine.ViewerMock) MapTileGame(com.b3dgs.lionengine.game.feature.tile.map.MapTileGame) Camera(com.b3dgs.lionengine.game.feature.Camera) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 14 with ViewerMock

use of com.b3dgs.lionengine.ViewerMock in project lionengine by b3dgs.

the class SpriteDigitTest method testSetLocationViewer.

/**
 * Test set location with viewer.
 */
@Test
void testSetLocationViewer() {
    final SpriteDigitImpl sprite = new SpriteDigitImpl(Graphics.createImageBuffer(64, 32), 1, 1, 1);
    final ViewerMock viewer = new ViewerMock();
    sprite.setLocation(viewer, Geom.createLocalizable(1.5, 2.5));
    assertEquals(1.5, sprite.getX());
    assertEquals(237.5, sprite.getY());
    viewer.set(10, 20);
    sprite.setLocation(viewer, Geom.createLocalizable(1.5, 2.5));
    assertEquals(-8.5, sprite.getX());
    assertEquals(257.5, sprite.getY());
}
Also used : ViewerMock(com.b3dgs.lionengine.ViewerMock) Test(org.junit.jupiter.api.Test)

Example 15 with ViewerMock

use of com.b3dgs.lionengine.ViewerMock in project lionengine by b3dgs.

the class SpriteTiledTest method testSetLocationViewer.

/**
 * Test set location with viewer.
 */
@Test
void testSetLocationViewer() {
    final SpriteTiledImpl sprite = new SpriteTiledImpl(Graphics.createImageBuffer(64, 32), 16, 8);
    final ViewerMock viewer = new ViewerMock();
    sprite.setLocation(viewer, Geom.createLocalizable(1.5, 2.5));
    assertEquals(1.5, sprite.getX());
    assertEquals(237.5, sprite.getY());
    assertEquals(2, sprite.getRenderX());
    assertEquals(238, sprite.getRenderY());
    viewer.set(10, 20);
    sprite.setLocation(viewer, Geom.createLocalizable(1.5, 2.5));
    assertEquals(-8.5, sprite.getX());
    assertEquals(257.5, sprite.getY());
    assertEquals(-8, sprite.getRenderX());
    assertEquals(258, sprite.getRenderY());
}
Also used : ViewerMock(com.b3dgs.lionengine.ViewerMock) Test(org.junit.jupiter.api.Test)

Aggregations

ViewerMock (com.b3dgs.lionengine.ViewerMock)22 Test (org.junit.jupiter.api.Test)13 Test (org.junit.Test)5 BeforeEach (org.junit.jupiter.api.BeforeEach)4 Media (com.b3dgs.lionengine.Media)3 Camera (com.b3dgs.lionengine.game.feature.Camera)3 ContextMock (com.b3dgs.lionengine.ContextMock)2 Xml (com.b3dgs.lionengine.Xml)2 Configurer (com.b3dgs.lionengine.game.Configurer)2 Cursor (com.b3dgs.lionengine.game.Cursor)2 Featurable (com.b3dgs.lionengine.game.feature.Featurable)2 FeaturableModel (com.b3dgs.lionengine.game.feature.FeaturableModel)2 Services (com.b3dgs.lionengine.game.feature.Services)2 Setup (com.b3dgs.lionengine.game.feature.Setup)2 TransformableModel (com.b3dgs.lionengine.game.feature.TransformableModel)2 MapTileGame (com.b3dgs.lionengine.game.feature.tile.map.MapTileGame)2 Animation (com.b3dgs.lionengine.Animation)1 Animatable (com.b3dgs.lionengine.game.feature.Animatable)1 AnimatableModel (com.b3dgs.lionengine.game.feature.AnimatableModel)1 Factory (com.b3dgs.lionengine.game.feature.Factory)1