def test_should_get_bounding_box_with_padding(self): porthole = Porthole() test_face = helper_make_face(100,100,6,8) porthole.set_face(test_face) porthole.set_padding(10) rect = porthole.get_bounding_box() self.assertTupleEqual(rect, helper_make_rect(88,89,30,30))
def test_should_clip_to_bottom_right_edges_of_image(self): porthole = Porthole(200, 100) test_face = helper_make_face(200,100,6,8) porthole.set_face(test_face) rect = porthole.get_bounding_box() self.assertTupleEqual(rect, helper_make_rect(190,90,10,10))
def test_should_clip_to_top_left_edges_of_image(self): porthole = Porthole() test_face = helper_make_face(-100,-100,6,8) porthole.set_face(test_face) rect = porthole.get_bounding_box() self.assertTupleEqual(rect, helper_make_rect(0,0,10,10))
def test_should_get_bounding_box(self): porthole = Porthole() test_face = helper_make_face(100,100,6,8) porthole.set_face(test_face) rect = porthole.get_bounding_box() self.assertTupleEqual(rect, helper_make_rect(98,99,10,10))