Пример #1
0
    def test_set_current_piece_if_null_on_tick(self):
        """
        The current piece is the shape that the player moves around on the grid.
        If there is no piece set, it could mean that the game has just begun or
        that the current piece collided last round and was cemented onto the grid.
        In this case, the next_piece field becomes the current_piece and a new
        next_piece object is randomly generated. The drop counter should also be
        reset.
        """
        p = PlayerArea()
        piece = Piece(Piece.BLOCK_SHAPE)

        p.current_piece = None
        p.next_piece = piece

        p.tick()

        self.assertEqual(p.current_piece, piece)
        self.assertEqual(p.drop_counter, p.ticks_per_drop)
        self.assertIsNotNone(p.next_piece)
        self.assertNotEqual(p.next_piece, piece)