Added test case for terrain and fixed player box size
This commit is contained in:
parent
003e885cf7
commit
85ffe136d3
5 changed files with 97 additions and 39 deletions
|
|
@ -12,8 +12,8 @@ class BlockTest {
|
|||
Block block = new Block(0, 0);
|
||||
assertEquals(0, block.getBlockStartX());
|
||||
assertEquals(0, block.getBlockStartY());
|
||||
assertEquals(19, block.getBlockEndX());
|
||||
assertEquals(19, block.getBlockEndY());
|
||||
assertEquals(Block.BLOCK_SIZE-1, block.getBlockEndX());
|
||||
assertEquals(Block.BLOCK_SIZE-1, block.getBlockEndY());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
36
core/test/se/cookery/gfx/terrain/TerrainMeshTest.java
Normal file
36
core/test/se/cookery/gfx/terrain/TerrainMeshTest.java
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
package se.cookery.gfx.terrain;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class TerrainMeshTest {
|
||||
|
||||
@Test
|
||||
public void singleSquareTerrain(){
|
||||
TerrainMesh terrain = new TerrainMesh(1, 1, 1 ,1);
|
||||
|
||||
float[] index = terrain.generateVertexBuffer();
|
||||
assertEquals(3*4, index.length);
|
||||
assertArrayEquals(new float[]{
|
||||
0, 0, 0,
|
||||
0, 0, 1,
|
||||
1, 0, 1,
|
||||
1, 0, 0,
|
||||
}, index);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void fourSquareTerrain(){
|
||||
TerrainMesh terrain = new TerrainMesh(1, 1, 2 ,2);
|
||||
|
||||
float[] index = terrain.generateVertexBuffer();
|
||||
assertEquals(3*9, index.length);
|
||||
assertArrayEquals(new float[]{
|
||||
0, 0, 0,
|
||||
0, 0, 1,
|
||||
1, 0, 1,
|
||||
1, 0, 0,
|
||||
}, index);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue