summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/src/ch/asynk/gdx/boardgame/test/Tests.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/src/ch/asynk/gdx/boardgame/test/Tests.java b/test/src/ch/asynk/gdx/boardgame/test/Tests.java
index 034bf65..eff7afa 100644
--- a/test/src/ch/asynk/gdx/boardgame/test/Tests.java
+++ b/test/src/ch/asynk/gdx/boardgame/test/Tests.java
@@ -29,9 +29,13 @@ public class Tests
private void runHexVertical()
{
+ System.err.println(" * Vertical HexBoard");
board = BoardFactory.getBoard(10, 9, BoardFactory.BoardType.HEX, 110, 50, 103, BoardFactory.BoardOrientation.VERTICAL, this::getTile);
tileStorage = new ArrayTileStorage(board.size());
check((board.size() == 86), "Vertical ", "size", board.size());
+ testCenter(5, 3, 812, 653);
+ testCenter(5, 2, 907, 488);
+ testCenter(6, 3, 1002, 653);
testTouch(899, 602, 5, 3, 812, 653, 32);
testTouch(906, 593, 5, 2, 907, 488, 23);
testTouch(916, 601, 6, 3, 1002, 653, 33);
@@ -39,14 +43,26 @@ public class Tests
private void runHexHorizontal()
{
+ System.err.println(" * Horizontal HexBoard");
board = BoardFactory.getBoard(9, 10, BoardFactory.BoardType.HEX, 110, 103, 50, BoardFactory.BoardOrientation.HORIZONTAL, this::getTile);
tileStorage = new ArrayTileStorage(board.size());
check((board.size() == 86), "Horizontal ", "size", board.size());
+ testCenter(3, 7, 653, 1193);
+ testCenter(3, 6, 653, 1002);
+ testCenter(4, 7, 818, 1097);
testTouch(705, 1103, 3, 7, 653, 1193, 34);
testTouch(707, 1092, 3, 6, 653, 1002, 33);
testTouch(715, 1096, 4, 7, 818, 1097, 43);
}
+ private void testCenter(int x, int y, int cx, int cy)
+ {
+ String title = String.format("[%d;%d] -> (%d;%d) ", x, y, cx, cy);
+ board.centerOf(x, y, v);
+ check(((int)v.x == cx), title, "cx", (int)v.x);
+ check(((int)v.y == cy), title, "cy", (int)v.y);
+ }
+
private void testTouch(int tx, int ty, int x, int y, int cx, int cy, int g)
{
String title = String.format("[%d;%d] -> [%d;%d] (%d;%d) %d : ", tx, ty, x, y, cx, cy, g);