mirror of
https://github.com/inf112-v20/Fiasko.git
synced 2025-06-28 04:04:42 +02:00
Sletter ubrukt kode og omstruktuerer klasser
Fjerner AppTest.java Fjerner HelloWorld.java Fjerner GameBoard.java Flytter alle filer fra inf112.skeleton.app til inf112.fiasko.roborally Flytter IDrawableGame og Game til en egen pakke Flytter IDrawableObject og DrawableObject til en egen pakke Flytter GameTexture til en egen pakke
This commit is contained in:
102
src/test/java/inf112/fiasko/roborally/DrawableObjectTest.java
Normal file
102
src/test/java/inf112/fiasko/roborally/DrawableObjectTest.java
Normal file
@ -0,0 +1,102 @@
|
||||
package inf112.fiasko.roborally;
|
||||
|
||||
import inf112.fiasko.roborally.objects.DrawableObject;
|
||||
import inf112.fiasko.roborally.abstractions.GameTexture;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class DrawableObjectTest {
|
||||
|
||||
DrawableObject testMinArg;
|
||||
DrawableObject testMaxArg;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
testMinArg = new DrawableObject(5,5, GameTexture.SLOW_TRANSPORT_BAND);
|
||||
testMaxArg = new DrawableObject(6, 6, GameTexture.ROBOT, 90, 50, 50, true, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getTextureMinArg() {
|
||||
assertSame(GameTexture.SLOW_TRANSPORT_BAND, testMinArg.getTexture());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getTextureMaxArg() {
|
||||
assertSame(GameTexture.ROBOT, testMaxArg.getTexture());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getXPositionMinArg() {
|
||||
assertEquals(5, testMinArg.getXPosition());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getXPositionMaxArg() {
|
||||
assertEquals(6, testMaxArg.getXPosition());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getYPositionMinArg() {
|
||||
assertEquals(5, testMinArg.getYPosition());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getYPositionMaxArg() {
|
||||
assertEquals(6, testMaxArg.getYPosition());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void getWidthMinArg() {
|
||||
assertEquals(64, testMinArg.getWidth());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getWidthMaxArg() {
|
||||
assertEquals(50, testMaxArg.getWidth());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getHeightMinArg() {
|
||||
assertEquals(64, testMinArg.getHeight());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getHeightMaxArg() {
|
||||
assertEquals(50, testMaxArg.getHeight());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void getRotationMinArg() {
|
||||
assertEquals(0, testMinArg.getRotation());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getRotationMaxArg() {
|
||||
assertEquals(90, testMaxArg.getRotation());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void flipXMinArg() {
|
||||
assertFalse(testMinArg.flipX());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void flipXMaxArg() {
|
||||
assertTrue(testMaxArg.flipX());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void flipYMinArg() {
|
||||
assertFalse(testMinArg.flipY());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void flipYMaxArg() {
|
||||
assertTrue(testMaxArg.flipY());
|
||||
}
|
||||
}
|
43
src/test/java/inf112/fiasko/roborally/GameTest.java
Normal file
43
src/test/java/inf112/fiasko/roborally/GameTest.java
Normal file
@ -0,0 +1,43 @@
|
||||
package inf112.fiasko.roborally;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import inf112.fiasko.roborally.game.Game;
|
||||
import inf112.fiasko.roborally.game.IDrawableGame;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class GameTest {
|
||||
IDrawableGame game;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
game = new Game();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void gameWidthPositiveTest() {
|
||||
assertTrue(game.getWidth() > 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void gameWidthMaximumFullHDTest() {
|
||||
assertTrue(game.getWidth() <= 1920);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void gameHeightPositiveTest() {
|
||||
assertTrue(game.getWidth() > 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void gameHeightMaximumFullHDTest() {
|
||||
assertTrue(game.getWidth() <= 1080);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getObjectsToRenderTest() {
|
||||
assertFalse(game.objectsToRender().isEmpty());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user