use of com.b3dgs.lionengine.ViewerMock in project lionengine by b3dgs.
the class SelectorRefresherTest method prepare.
/**
* Prepare test.
*/
@BeforeEach
public void prepare() {
services.add(new ContextMock());
services.add(new Camera());
services.add(new ViewerMock());
cursor = services.create(Cursor.class);
cursor.setSync(mouse);
final Featurable featurable = new FeaturableModel(services, setup);
featurable.addFeature(new LayerableModel(services, setup));
featurable.addFeature(new TransformableModel(services, setup));
featurable.addFeature(new CollidableModel(services, setup));
refresher = new SelectorRefresher(services, model);
refresher.addListener(listener);
refresher.prepare(featurable);
}
use of com.b3dgs.lionengine.ViewerMock in project lionengine by b3dgs.
the class MinimapTest method testMinimap.
/**
* Test the minimap.
*/
@Test
void testMinimap() {
final MapTileGame map = new MapTileGame();
map.loadSheets(Arrays.asList(Drawable.loadSpriteTiled(new ImageBufferMock(80, 80), 40, 40)));
map.create(40, 40, 3, 3);
map.setTile(0, 0, 0);
final Minimap minimap = new Minimap(map);
final Media config = Medias.create("minimap.xml");
final Map<Integer, ColorRgba> tiles = new HashMap<>();
tiles.put(Integer.valueOf(0), ColorRgba.RED);
tiles.put(Integer.valueOf(1), ColorRgba.BLUE);
tiles.put(Integer.valueOf(0), ColorRgba.GREEN);
minimap.automaticColor(config);
minimap.loadPixelConfig(config);
minimap.setOrigin(Origin.BOTTOM_LEFT);
assertEquals(0.0, minimap.getX());
assertEquals(0.0, minimap.getY());
assertNull(minimap.getSurface());
assertFalse(minimap.isLoaded());
minimap.load();
minimap.prepare();
minimap.setLocation(1.0, 2.0);
minimap.load();
assertTrue(minimap.isLoaded());
assertEquals(1.0, minimap.getX());
assertEquals(-1.0, minimap.getY());
assertEquals(3, minimap.getWidth());
assertEquals(3, minimap.getHeight());
minimap.setLocation(new ViewerMock(), Geom.createLocalizable(2.0, 3.0));
assertEquals(2.0, minimap.getX());
assertEquals(234.0, minimap.getY());
minimap.dispose();
assertTrue(config.getFile().delete());
}
Aggregations