def test_rotation_4(self): """Check that graphic is rotated properly.""" graphic = Graphic(etree.parse("arrow.svg").getroot()) xml = graphic.get_xml() graphic.set_rotation(23.21) graphic.set_rotation(0) assert graphic.get_xml() == xml
def test_mirror_y(self): """Check that graphic is mirrored properly about the y axis.""" graphic = Graphic(etree.parse("arrow.svg").getroot()) graphic.set_mirror_y(True) f = open("out/arrow_%s.svg" % sys._getframe().f_code.co_name, "w") f.write(graphic.get_xml()) f.close()
def test_translate_2(self): """Check that graphic is translated properly.""" graphic = Graphic(etree.parse("arrow.svg").getroot()) graphic.set_position(500, 237.21) f = open("out/arrow_%s.svg" % sys._getframe().f_code.co_name, "w") f.write(graphic.get_xml()) f.close() assert map(lambda x: round(x, 10), graphic.get_position()) == [500, 237.21], "Position should be 500,237.21!"
def test_weedline(self): """Check a weedline is added correctly.""" graphic = Graphic(etree.parse("arrow.svg").getroot()) pos = graphic.get_position() graphic.set_weedline(True) f = open("out/arrow_%s.svg" % sys._getframe().f_code.co_name, "w") f.write(graphic.get_xml()) f.close() assert graphic.get_position() == pos
def test_rotation_3(self): """Check that graphic is rotated properly.""" graphic = Graphic(etree.parse("arrow.svg").getroot()) pos = graphic.get_position() graphic.set_rotation(23.21) f = open("out/arrow_%s.svg" % sys._getframe().f_code.co_name, "w") f.write(graphic.get_xml()) f.close() assert graphic.get_position() == pos
def test_translate_2(self): """Check that graphic is translated properly.""" graphic = Graphic(etree.parse("arrow.svg").getroot()) graphic.set_position(500, 237.21) f = open("out/arrow_%s.svg" % sys._getframe().f_code.co_name, "w") f.write(graphic.get_xml()) f.close() assert map(lambda x: round(x, 10), graphic.get_position()) == [ 500, 237.21 ], "Position should be 500,237.21!"
def test_weedline_3(self): """Check a weedline padding is added correctly.""" graphic = Graphic(etree.parse("arrow.svg").getroot()) h = graphic.get_height() w = graphic.get_width() graphic.set_weedline_padding(100) graphic.set_weedline(True) f = open("out/arrow_%s.svg" % sys._getframe().f_code.co_name, "w") f.write(graphic.get_xml()) f.close() assert graphic.get_height() == h + 200 assert graphic.get_width() == w + 200
def test_case_2(self): """Create a graphic from etree elements""" graphic = Graphic(etree.parse("arrow.svg").getroot()) f = open("out/arrow_%s.svg" % sys._getframe().f_code.co_name, "w") f.write(graphic.get_xml()) f.close()
def test_graphic_from_string(self): """Create a graphic from string""" graphic = Graphic(etree.tostring(etree.parse("arrow.svg"))) f = open("out/arrow_%s.svg" % sys._getframe().f_code.co_name, "w") f.write(graphic.get_xml()) f.close()