summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2020-07-13 08:37:28 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2020-07-13 08:37:28 +0200
commit8c20d6d938d1f6fe5f3277dc3cb28f875af82085 (patch)
tree716875e8d577e236fb85b44bdca2f1923b988a2c /test
parent7c879d254a0aba68f1245740c70c2f9964ac087d (diff)
downloadgdx-boardgame-8c20d6d938d1f6fe5f3277dc3cb28f875af82085.zip
gdx-boardgame-8c20d6d938d1f6fe5f3277dc3cb28f875af82085.tar.gz
Tests : add Orientation tests
Diffstat (limited to 'test')
-rw-r--r--test/src/ch/asynk/gdx/boardgame/test/Tests.java19
1 files changed, 19 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 a02c67f..8b52c87 100644
--- a/test/src/ch/asynk/gdx/boardgame/test/Tests.java
+++ b/test/src/ch/asynk/gdx/boardgame/test/Tests.java
@@ -7,6 +7,7 @@ import ch.asynk.gdx.boardgame.tilestorages.TileStorage;
import ch.asynk.gdx.boardgame.tilestorages.ArrayTileStorage;
import ch.asynk.gdx.boardgame.boards.Board;
import ch.asynk.gdx.boardgame.boards.BoardFactory;
+import ch.asynk.gdx.boardgame.Orientation;
public class Tests
{
@@ -51,6 +52,12 @@ public class Tests
testTouch(1851, 59, 9, 0, 1859, 158, 9);
testTouch(1779, 99, 9, 0, 1859, 158, 9);
testTouch(1768, 115, 9, 0, 1859, 158, 9);
+ testOrientation(5, 5, 0);
+ testOrientation(5, 6, 60);
+ testOrientation(4, 6, 120);
+ testOrientation(3, 5, 180);
+ testOrientation(3, 4, 240);
+ testOrientation(4, 4, 300);
}
private void runHexHorizontal()
@@ -77,6 +84,12 @@ public class Tests
testTouch(1421, 64, 8, 4, 1478, 145, 76);
testTouch(1380, 130, 8, 4, 1478, 145, 76);
testTouch(1386, 161, 8, 4, 1478, 145, 76);
+ testOrientation(5, 6, 30);
+ testOrientation(4, 6, 90);
+ testOrientation(3, 5, 150);
+ testOrientation(3, 4, 210);
+ testOrientation(4, 4, 270);
+ testOrientation(5, 5, 330);
}
private void testCenter(int x, int y, int cx, int cy)
@@ -100,6 +113,12 @@ public class Tests
check((g == k), title, "Key", k);
}
+ private void testOrientation(int tx, int ty, int a)
+ {
+ Orientation o = Orientation.fromTiles(board.getTile(4, 5), board.getTile(tx, ty));
+ check((o.r()== a), "Orientation : ", String.format("[4, 5] -> [%d;%d] -> %d°", tx, ty, a), o.r());
+ }
+
private Tile getTile(int x, int y, boolean isOnBoard)
{
if (isOnBoard)