def test_add_coordinates(): coord1 = Coordinate(x=2.0, y=-4.0) coord2 = Coordinate(x=5.0, y=2.0) coord1 += coord2 assert coord1.x == 7.0 assert coord1.y == -2.0
def test_add_number_to_coordinate(): coord = Coordinate(x=4.0, y=2.0) coord += 5.0 assert coord.x == 9.0 assert coord.y == 7.0
def render(self, render_coordinate=None): if render_coordinate: render_coordinate.x += self.x render_coordinate.y += self.y else: render_coordinate = Coordinate(self.x, self.y) self.render_bg_color(render_coordinate) return render_coordinate
def test_trigger_state_events(self): self.event_manager.check_state_events(Coordinate( 10, 10)) # should print foo self.event_manager.check_state_events(Coordinate( 700, 10)) # should NOT print foo
def test_create_coordinate_with_values(): coord = Coordinate(x=2.0, y=6.0) assert coord.x == 2.0 assert coord.y == 6.0
def test_create_empty_coordinate(): coord = Coordinate() assert coord.x == 0 assert coord.y == 0
def get_mouse_coordinates(self): xmin, ymin, xmax, ymax = self.get_coordinates() mouse_x, mouse_y = Window.GetMouseCoords() return Coordinate(mouse_x - xmin, mouse_y - ymin)
def __init__(self, bbox=None): self.bottom_left = Coordinate(x=bbox[0], y=bbox[1]) self.top_right = Coordinate(x=bbox[3], y=bbox[4])