class Test(unittest.TestCase): def setUp(self): self.shape = Shape(T_TILE) def test_create_shape_creates_correct_set_of_initial_points(self): self.assertEqual([Point(0, 0), Point(0, -1), Point(-1, 0), Point(0, 1)], self.shape.get_points()) def test_shape_move_left(self): points = [Point(0, -1), Point(0, -2), Point(-1, -1), Point(0, 0)] self.shape.set_position(points) self.assertEqual(points, self.shape.get_points())
def draw_next_shape(self, screen): next_shape = Shape(self.game.get_next_shape()) for i in range(0, 2): next_shape.set_position(Translation().in_direction(next_shape.get_points(), DOWN)) pieces=[] color = TILE_COLORS[next_shape.get_tile()] for point in next_shape.get_points(): coords = ScreenCoords(row=point.row, col=point.col, tile_width=(screen.get_height()/20)) pieces.append(DrawableFactory().create_piece(coords, color, next_shape.get_tile().is_empty())) Center(start=screen.get_height()/2, end=screen.get_width()).pieces_along_x(pieces) for piece in pieces: piece.draw(screen)