Esempio n. 1
0
 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()
Esempio n. 2
0
 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!"
Esempio n. 3
0
 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!"
Esempio n. 4
0
 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()
Esempio n. 5
0
 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!"
Esempio n. 6
0
 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!"
Esempio n. 7
0
 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!"
Esempio n. 8
0
 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!"