summaryrefslogtreecommitdiffstats
path: root/test/src/ch/asynk/gdx/boardgame
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2020-07-03 15:57:21 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2020-07-03 15:57:21 +0200
commitadf768f1c0635954b5278a46c6eab7ec9deb357c (patch)
treefdba91d8f6914e46dfa1eabcd4d8d83ec87b8acc /test/src/ch/asynk/gdx/boardgame
parent2205c61fee2d66d515e6fb3caa726fa0e2a7212f (diff)
downloadgdx-boardgame-adf768f1c0635954b5278a46c6eab7ec9deb357c.zip
gdx-boardgame-adf768f1c0635954b5278a46c6eab7ec9deb357c.tar.gz
Tests : add testCenter(…)
Diffstat (limited to 'test/src/ch/asynk/gdx/boardgame')
-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);