def test_mirror_x(self): """Check that graphic is mirrored properly about the x axis.""" graphic = Graphic(etree.parse("arrow.svg").getroot()) graphic.set_mirror_x(True) f = open("out/arrow_%s.svg" % sys._getframe().f_code.co_name, "w") f.write(graphic.get_xml()) f.close()
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_x(self): """Check that graphic is mirrored x properly twice.""" graphic = Graphic(etree.parse("arrow.svg").getroot()) graphic2 = Graphic(etree.parse("arrow.svg").getroot()) graphic.set_mirror_x(True) graphic.set_mirror_x(False) assert graphic.get_bounding_box() == graphic2.get_bounding_box(), "They should be the same!"
def test_double_mirror_x(self): """Check that graphic is mirrored x properly twice.""" graphic = Graphic(etree.parse("arrow.svg").getroot()) graphic2 = Graphic(etree.parse("arrow.svg").getroot()) graphic.set_mirror_x(True) graphic.set_mirror_x(False) assert graphic.get_bounding_box() == graphic2.get_bounding_box( ), "They should be the same!"
def test_changed_flag(self): """Check that changed flag works correctly.""" graphic = Graphic(etree.parse("arrow.svg").getroot()) graphic.reset_changed_flag() graphic.set_mirror_x(True) assert graphic.get_changed_flag(), "Changed flag should be set!" graphic.reset_changed_flag() graphic.set_mirror_x(False) assert graphic.get_changed_flag(), "Changed flag should be set!" graphic.reset_changed_flag() graphic.set_scale(2) assert graphic.get_changed_flag(), "Changed flag should be set!" graphic.reset_changed_flag() graphic.set_rotation(2) assert graphic.get_changed_flag(), "Changed flag should be set!" graphic.reset_changed_flag() graphic.set_position(2, 500) assert not graphic.get_changed_flag(), "Changed flag should not be set!" graphic.reset_changed_flag() graphic.set_weedline(True) assert graphic.get_changed_flag(), "Changed flag should be set!"
def test_changed_flag(self): """Check that changed flag works correctly.""" graphic = Graphic(etree.parse("arrow.svg").getroot()) graphic.reset_changed_flag() graphic.set_mirror_x(True) assert graphic.get_changed_flag(), "Changed flag should be set!" graphic.reset_changed_flag() graphic.set_mirror_x(False) assert graphic.get_changed_flag(), "Changed flag should be set!" graphic.reset_changed_flag() graphic.set_scale(2) assert graphic.get_changed_flag(), "Changed flag should be set!" graphic.reset_changed_flag() graphic.set_rotation(2) assert graphic.get_changed_flag(), "Changed flag should be set!" graphic.reset_changed_flag() graphic.set_position(2, 500) assert not graphic.get_changed_flag( ), "Changed flag should not be set!" graphic.reset_changed_flag() graphic.set_weedline(True) assert graphic.get_changed_flag(), "Changed flag should be set!"
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!"