Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update BlackjackTest.java #91

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 4 additions & 32 deletions src/edu/ucsb/cs56/projects/game/blackjack/BlackjackTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ public void test_EvaluateWinner1() {
Hand h2 = new Hand(c5, c6);
Hand h3 = new Hand(c7, c8);
Blackjack b = new Blackjack(dh, h1, h2, h3);
assertEquals('D',b.evaluateWinner(b.getPlayer(1)));
assertEquals(false,b.evaluateWinner(b.getPlayer(1)));
}

/** Test case for Blackjack.evaluateWinner()
Expand All @@ -273,7 +273,7 @@ public void test_EvaluateWinner2() {
Hand h2 = new Hand(c5, c6);
Hand h3 = new Hand(c7, c8);
Blackjack b = new Blackjack(dh, h1, h2, h3);
assertEquals('P',b.evaluateWinner(b.getPlayer(2)));
assertEquals(true,b.evaluateWinner(b.getPlayer(2)));
}


Expand All @@ -296,7 +296,7 @@ public void test_EvaluateWinner3() {
Hand h3 = new Hand(c7, c8);
Blackjack b = new Blackjack(dh, h1, h2, h3);
b.getDealer().drawCard(new Card(11, "Spades"));
assertEquals('P',b.evaluateWinner(b.getPlayer(3)));
assertEquals(true,b.evaluateWinner(b.getPlayer(3)));
}


Expand Down Expand Up @@ -543,35 +543,7 @@ public void test_DisplayDealerCardValue() {
*/
@Test
public void test_getMyImage() {
BlackjackGui gui = new BlackjackGui(new GuiModel());

Deck deck = new Deck();
Card currentCard = deck.draw();
ImageIcon myImage = gui.getMyImage(currentCard);

JFrame testFrame = new JFrame("test_getMyImage");
JLabel cardLabel = new JLabel("Current card: " + currentCard);
JLabel cardImage = new JLabel(myImage);

testFrame.add(cardLabel);
testFrame.add(cardImage);

testFrame.setLayout(new GridLayout(2,1));
testFrame.pack();
testFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
testFrame.setVisible(true);

while(deck.getDeckSize() != 0){
try{
Thread.sleep(1000);
currentCard = deck.draw();
myImage = gui.getMyImage(currentCard);
cardImage.setIcon(myImage);
cardLabel.setText("Current card: "+ currentCard);
} catch(InterruptedException ex){
testFrame.dispose();
}
}

}

}//end BlackjackTest