def testNewCards(self):
        """Confirm newCards adds cards to hand"""
        test_state = ClientState(ruleset=None)
        wholeDeck = Card.getStandardDeck()
        test_state.newCards(wholeDeck)
        self.assertEqual(wholeDeck, test_state.hand_cards)

        drawn_cards = [Card(0, None), Card(0, None)]
        test_state.newCards(drawn_cards)
        self.assertEqual(Card.getJokerDeck(), test_state.hand_cards)
Ejemplo n.º 2
0
 def testDecks(self):
     """Confirm standard deck and joker deck aren't obviously wrong"""
     deck = Card.getStandardDeck()
     #length check
     self.assertEqual(len(deck), 52)
     #joker check
     self.assertFalse(Card(0, None) in deck)
     joker_deck = Card.getJokerDeck()
     #length check
     self.assertEqual(len(joker_deck), 54)
     #joker check
     self.assertTrue(Card(0, None) in joker_deck)
     #containsStandard check
     self.assertTrue(all(card in joker_deck for card in deck))
Ejemplo n.º 3
0
outline_width = 8 * scale
no_outline_color = (-1, -1, -1)  # flags there is no outline.
outline_colors = (no_outline_color, Yellow, Green, Bright_Green, Bright_Blue,
                  Bright_Blue, Gray, Gray, Red, Bright_Red)
'''
No_outline_color indicates clickable image (usually a card) not selected or prepared.
Yellow indicates not selected, but mouse is over clickable image.
green elements indicate card is 'selected'
bright green indicates mouse is over card,
blue indicates card is prepared (for play).
Since cannot change prepared cards status with mouse, don't highlight those cards when mouse is over them...
'''
# load image of back of card, and scale it.
Back_Img = pygame.image.load(
    os.path.join('bundle_data', 'cardimages', 'cardBack.png'))
Back_Img = pygame.transform.rotozoom(Back_Img, 0, scale)

# Load images for full deck of cards:
suit_letter = 'N'  # this doesn't distinguish between red & black Jokers
temp_deck = Card.getStandardDeck(0)
card_images = {}
card_images['0N'] = pygame.image.load(
    os.path.join('bundle_data', 'cardimages', 'card0N.png'))
for card in temp_deck:
    suit_letter = card.suit[0]
    image_index = str(card.number) + suit_letter
    card_string = 'card' + image_index
    image_file = os.path.join('bundle_data', 'cardimages',
                              card_string + '.png')
    card_images[image_index] = pygame.image.load(image_file)