summaryrefslogtreecommitdiffstats
path: root/test/jrummikub/control
diff options
context:
space:
mode:
authorJannis Harder <harder@informatik.uni-luebeck.de>2011-05-05 00:00:16 +0200
committerJannis Harder <harder@informatik.uni-luebeck.de>2011-05-05 00:00:16 +0200
commit16da68b0ae641f5c3050d4c2a723d2b46d97b8c7 (patch)
tree73ea6648ccfeb37f4e5ca610c85dab28199f5f8b /test/jrummikub/control
parent75f1382b8246e580ad49b8d3ccdb2d02a9570d37 (diff)
downloadJRummikub-16da68b0ae641f5c3050d4c2a723d2b46d97b8c7.tar
JRummikub-16da68b0ae641f5c3050d4c2a723d2b46d97b8c7.zip
Test initial display of hand stones
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@133 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'test/jrummikub/control')
-rw-r--r--test/jrummikub/control/TurnControlTest.java30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/jrummikub/control/TurnControlTest.java b/test/jrummikub/control/TurnControlTest.java
index 8a2416f..bc259d1 100644
--- a/test/jrummikub/control/TurnControlTest.java
+++ b/test/jrummikub/control/TurnControlTest.java
@@ -6,18 +6,23 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import jrummikub.model.MockHand;
import jrummikub.model.MockTable;
+import jrummikub.model.Position;
import jrummikub.model.Stone;
import jrummikub.model.StoneColor;
import jrummikub.model.StoneSet;
import jrummikub.util.Event;
import jrummikub.util.IEvent;
import jrummikub.util.IListener;
+import jrummikub.util.Pair;
import jrummikub.view.MockView;
import org.junit.Before;
import org.junit.Test;
+import static jrummikub.model.StoneColor.*;
+
public class TurnControlTest {
class MockTimer implements ITurnTimer {
@@ -45,6 +50,7 @@ public class TurnControlTest {
MockView mockView;
MockTimer mockTimer;
MockTable mockTable;
+ MockHand mockHand;
boolean eventFired;
@Before
@@ -52,6 +58,7 @@ public class TurnControlTest {
mockView = new MockView();
mockTimer = new MockTimer();
mockTable = new MockTable();
+ mockHand = new MockHand();
testControl = new TurnControl(null, mockTable, mockView, mockTimer);
}
@@ -59,6 +66,29 @@ public class TurnControlTest {
public void startTimer() {
assertTrue(mockTimer.timerRunning);
}
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void showInitialHand() {
+ mockView = new MockView();
+ mockTimer = new MockTimer();
+ mockTable = new MockTable();
+ mockHand = new MockHand();
+
+ List<Pair<Stone, Position>> stones = Arrays.asList(new Pair<Stone, Position>(new Stone(RED), new Position(0,0)),
+ new Pair<Stone, Position>(new Stone(BLACK), new Position(1,0)));
+
+ mockHand.iterable = stones;
+
+ testControl = new TurnControl(null, mockTable, mockView, mockTimer);
+
+ int i = 0;
+ for (Pair<Stone, Position> pair : mockView.playerPanel.handPanel.stones) {
+ assertSame(stones.get(i), pair);
+ i++;
+ }
+ assertEquals(stones.size(), i);
+ }
@Test
public void viewEndOfTurn() {