summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJannis Harder <harder@informatik.uni-luebeck.de>2011-05-27 18:55:17 +0200
committerJannis Harder <harder@informatik.uni-luebeck.de>2011-05-27 18:55:17 +0200
commitffeefad2579232c6057b383d75a9df4517f83aa6 (patch)
tree1ff7ddb95e5acaa56855482c7025dce92d127fac /test
parent2d198820a9634c30d62c77f6f310aa227ee29733 (diff)
downloadJRummikub-ffeefad2579232c6057b383d75a9df4517f83aa6.tar
JRummikub-ffeefad2579232c6057b383d75a9df4517f83aa6.zip
Added round control tests for checking whether redealing is allowed
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@289 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'test')
-rw-r--r--test/jrummikub/control/RoundControlTest.java38
1 files changed, 38 insertions, 0 deletions
diff --git a/test/jrummikub/control/RoundControlTest.java b/test/jrummikub/control/RoundControlTest.java
index 68ae825..8c8c67d 100644
--- a/test/jrummikub/control/RoundControlTest.java
+++ b/test/jrummikub/control/RoundControlTest.java
@@ -905,4 +905,42 @@ public class RoundControlTest {
view.playerPanel.redealEvent.emit();
assertTrue(roundRestarted);
}
+
+ /** */
+ @Test
+ public void testRedealDisallowed() {
+ testRound.startRound();
+ Hand hand = new Hand(gameSettings);
+ hand.drop(new Stone(1, RED), new Position(0, 0));
+ hand.drop(new Stone(1, BLACK), new Position(0, 0));
+ hand.drop(new Stone(1, BLUE), new Position(0, 0));
+ testRoundState.players.get(0).hand = hand;
+ view.startTurnEvent.emit();
+ assertTrue(view.playerPanel.inspectOnly);
+ assertFalse(view.playerPanel.mayRedeal);
+ for (int i = 0; i < 4; i++) {
+ view.playerPanel.endTurnEvent.emit();
+ view.startTurnEvent.emit();
+ }
+ assertFalse(view.playerPanel.inspectOnly);
+ }
+
+ /** */
+ @Test
+ public void testRedealAllowed() {
+ testRound.startRound();
+ Hand hand = new Hand(gameSettings);
+ for (int i = 0; i < 6; i++) {
+ hand.drop(new Stone(i / 2, RED), new Position(0, 0));
+ }
+ testRoundState.players.get(0).hand = hand;
+ view.startTurnEvent.emit();
+ assertTrue(view.playerPanel.inspectOnly);
+ assertTrue(view.playerPanel.mayRedeal);
+ for (int i = 0; i < 4; i++) {
+ view.playerPanel.endTurnEvent.emit();
+ view.startTurnEvent.emit();
+ }
+ assertFalse(view.playerPanel.inspectOnly);
+ }
}