def test_symmetric_x(self): """Check that a symmetric graphic is mirrored x properly.""" graphic = Graphic(etree.parse("rectangle.svg").getroot()) graphic2 = Graphic(etree.parse("rectangle.svg").getroot()) graphic.set_mirror_x(True) assert graphic.get_bounding_box() == graphic2.get_bounding_box( ), "They should be the same!"
def test_double_mirror_y(self): """Check that graphic is mirrored y properly twice.""" graphic = Graphic(etree.parse("arrow.svg").getroot()) graphic2 = Graphic(etree.parse("arrow.svg").getroot()) graphic.set_mirror_y(True) graphic.set_mirror_y(False) assert graphic.get_bounding_box() == graphic2.get_bounding_box(), "They should be the same!"
def test_double_mirror_y(self): """Check that graphic is mirrored y properly twice.""" graphic = Graphic(etree.parse("arrow.svg").getroot()) graphic2 = Graphic(etree.parse("arrow.svg").getroot()) graphic.set_mirror_y(True) graphic.set_mirror_y(False) assert graphic.get_bounding_box() == graphic2.get_bounding_box( ), "They should be the same!"
def test_adjusted_bbox(self): """Check that get_bounding_box(adjusted=True) works correctly.""" graphic = Graphic(etree.parse("arrow.svg").getroot()) bbox = graphic.get_bounding_box() h = graphic.get_height() w = graphic.get_width() graphic.set_weedline_padding(10) graphic.set_weedline(True) assert graphic.get_width(adjusted=True) == w, "%s != %s" % (graphic.get_width(adjusted=True), w) assert graphic.get_height(adjusted=True) == h, "%s != %s" % (graphic.get_height(adjusted=True), h) log.debug(bbox) log.debug(graphic.get_bounding_box(adjusted=True)) assert graphic.get_bounding_box(adjusted=True) == bbox
def test_adjusted_bbox(self): """Check that get_bounding_box(adjusted=True) works correctly.""" graphic = Graphic(etree.parse("arrow.svg").getroot()) bbox = graphic.get_bounding_box() h = graphic.get_height() w = graphic.get_width() graphic.set_weedline_padding(10) graphic.set_weedline(True) assert graphic.get_width( adjusted=True) == w, "%s != %s" % (graphic.get_width( adjusted=True), w) assert graphic.get_height( adjusted=True) == h, "%s != %s" % (graphic.get_height( adjusted=True), h) log.debug(bbox) log.debug(graphic.get_bounding_box(adjusted=True)) assert graphic.get_bounding_box(adjusted=True) == bbox
def test_symmetric_x(self): """Check that a symmetric graphic is mirrored x properly.""" graphic = Graphic(etree.parse("rectangle.svg").getroot()) graphic2 = Graphic(etree.parse("rectangle.svg").getroot()) graphic.set_mirror_x(True) assert graphic.get_bounding_box() == graphic2.get_bounding_box(), "They should be the same!"