use of com.relic.highflyer.screens.ScreenManager in project high-flyer by sangngh.
the class LandingDetectorTest method testDetect_hasLanding.
@Test
public void testDetect_hasLanding() {
GameState state = new GameState();
// state.setScore(110);
GameEngine game = new GameEngine(new GameSettings(800, 600), state, new ScreenManager());
Mockito.when(mockScreenManager.getScreen(Mockito.anyInt())).thenReturn(Mockito.mock(Screen.class));
List<Cell> nextCells = new ArrayList<>();
Cell landingCell = new Cell();
TiledMapTile mockTile = Mockito.mock(TiledMapTile.class);
MapProperties mapProperties = new MapProperties();
mapProperties.put("landing", true);
Mockito.when(mockTile.getProperties()).thenReturn(mapProperties);
landingCell.setTile(mockTile);
nextCells.add(landingCell);
subject.detect(game, nextCells, mockPlayer, 100, 100);
assertEquals("Mismatching game level", 2, game.getState().getLvl());
Mockito.verify(mockPlayer).setX(Mockito.eq(0f));
Mockito.verify(mockPlayer).setY(Mockito.eq(260f));
Mockito.verify(mockSoundPlayer).playSound(Mockito.eq("data/sounds/Finish.wav"));
// assertEquals("Mismatching game score", 10, state.getScore());
}
use of com.relic.highflyer.screens.ScreenManager in project high-flyer by sangngh.
the class PowerUpDetectorTest method testDetect_noCollistion.
@Test
public void testDetect_noCollistion() {
GameState state = new GameState();
state.setScore(100);
GameEngine game = new GameEngine(new GameSettings(800, 600), state, new ScreenManager());
List<Cell> nextCells = new ArrayList<>();
Cell collisionCell = new Cell();
TiledMapTile mockTile = Mockito.mock(TiledMapTile.class);
MapProperties mapProperties = new MapProperties();
mapProperties.put("notpower", "star");
Mockito.when(mockTile.getProperties()).thenReturn(mapProperties);
collisionCell.setTile(mockTile);
nextCells.add(collisionCell);
subject.detect(game, nextCells, mockPlayer, 100, 100);
Mockito.verifyZeroInteractions(mockSoundPlayer);
assertEquals("Mismatching game score", 100, state.getScore());
}
Aggregations