From ce982fcdaf1a15981419e7a88802bc225795e6a4 Mon Sep 17 00:00:00 2001 From: Jannis Harder Date: Tue, 10 May 2011 01:39:32 +0200 Subject: Tests for dropping on hand git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@206 72836036-5685-4462-b002-a69064685172 --- mock/jrummikub/model/MockHand.java | 11 +++++++++-- mock/jrummikub/model/MockTable.java | 5 ++--- mock/jrummikub/view/MockHandPanel.java | 5 +++-- 3 files changed, 14 insertions(+), 7 deletions(-) (limited to 'mock') diff --git a/mock/jrummikub/model/MockHand.java b/mock/jrummikub/model/MockHand.java index 994f7f5..f8388d0 100644 --- a/mock/jrummikub/model/MockHand.java +++ b/mock/jrummikub/model/MockHand.java @@ -1,8 +1,10 @@ package jrummikub.model; import java.util.ArrayList; +import java.util.HashSet; import java.util.Iterator; import java.util.List; +import java.util.Set; import jrummikub.util.Pair; @@ -10,6 +12,8 @@ public class MockHand implements IHand { public List> stones = new ArrayList>(); + public Set pickups = new HashSet(); + public Iterable> iterable; @Override @@ -29,13 +33,16 @@ public class MockHand implements IHand { } @Override - public void pickUp(Stone object) { - List> itList = new ArrayList(stones); + public boolean pickUp(Stone object) { + List> itList = new ArrayList>(stones); for (Pair entry : itList) { if (entry.getFirst() == object) { stones.remove(entry); + pickups.add(object); + return true; } } + return false; } @Override diff --git a/mock/jrummikub/model/MockTable.java b/mock/jrummikub/model/MockTable.java index 0bbbe0a..f17e5df 100644 --- a/mock/jrummikub/model/MockTable.java +++ b/mock/jrummikub/model/MockTable.java @@ -43,9 +43,8 @@ public class MockTable implements ITable { } @Override - public void pickUp(StoneSet object) { - // TODO Auto-generated method stub - + public boolean pickUp(StoneSet object) { + return false; } @Override diff --git a/mock/jrummikub/view/MockHandPanel.java b/mock/jrummikub/view/MockHandPanel.java index 6069019..cb97ef7 100644 --- a/mock/jrummikub/view/MockHandPanel.java +++ b/mock/jrummikub/view/MockHandPanel.java @@ -5,6 +5,7 @@ import java.util.List; import jrummikub.model.Position; import jrummikub.model.Stone; +import jrummikub.util.Event1; import jrummikub.util.Event2; import jrummikub.util.IEvent1; import jrummikub.util.IEvent2; @@ -14,6 +15,7 @@ public class MockHandPanel implements IHandPanel { public Event2 stoneClickEvent = new Event2(); public List> stones; public Event2 rangeClickEvent = new Event2(); + public Event1 clickEvent = new Event1(); @Override public IEvent2 getStoneClickEvent() { @@ -33,8 +35,7 @@ public class MockHandPanel implements IHandPanel { @Override public IEvent1 getClickEvent() { - // TODO Auto-generated method stub - return null; + return clickEvent; } @Override -- cgit v1.2.3