Beispiel #1
0
 def test_translate_1(self):
     """Check that graphic is translated properly."""
     graphic = Graphic(etree.parse("arrow.svg").getroot())
     graphic.set_position(0, 0)
     log.info(graphic.get_position())
     assert map(lambda x: round(x, 10),
                graphic.get_position()) == [0, 0], "Position should be 0,0!"
Beispiel #2
0
 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
Beispiel #3
0
 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
Beispiel #4
0
 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
Beispiel #5
0
 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
Beispiel #6
0
 def test_weedline_4(self):
     """Check a weedline padding is added correctly in reverse order."""
     graphic = Graphic(etree.parse("arrow.svg").getroot())
     h = graphic.get_height()
     w = graphic.get_width()
     pos = graphic.get_position()
     graphic.set_weedline(True)
     graphic.set_weedline_padding(10)
     assert graphic.get_height() == h + 20
     assert graphic.get_width() == w + 20
     assert graphic.get_position() == pos
Beispiel #7
0
 def test_weedline_4(self):
     """Check a weedline padding is added correctly in reverse order."""
     graphic = Graphic(etree.parse("arrow.svg").getroot())
     h = graphic.get_height()
     w = graphic.get_width()
     pos = graphic.get_position()
     graphic.set_weedline(True)
     graphic.set_weedline_padding(10)
     assert graphic.get_height() == h + 20
     assert graphic.get_width() == w + 20
     assert graphic.get_position() == pos
Beispiel #8
0
 def test_weedline_5(self):
     """Check a weedline padding is removed correctly."""
     graphic = Graphic(etree.parse("arrow.svg").getroot())
     h = graphic.get_height()
     w = graphic.get_width()
     pos = graphic.get_position()
     graphic.set_weedline_padding(10)
     graphic.set_weedline(True)
     graphic.set_weedline_padding(0)
     assert graphic.get_height() == h
     assert graphic.get_width() == w
     assert graphic.get_position() == pos
Beispiel #9
0
 def test_weedline_5(self):
     """Check a weedline padding is removed correctly."""
     graphic = Graphic(etree.parse("arrow.svg").getroot())
     h = graphic.get_height()
     w = graphic.get_width()
     pos = graphic.get_position()
     graphic.set_weedline_padding(10)
     graphic.set_weedline(True)
     graphic.set_weedline_padding(0)
     assert graphic.get_height() == h
     assert graphic.get_width() == w
     assert graphic.get_position() == pos
Beispiel #10
0
 def test_translate_3(self):
     """Check that graphic is translated properly twice."""
     graphic = Graphic(etree.parse("arrow.svg").getroot())
     graphic.set_position(500, 237.21)
     graphic.set_position(11, 32)
     assert map(lambda x: round(x, 10),
                graphic.get_position()) == [11,
                                            32], "Position should be 11,32!"
Beispiel #11
0
 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!"
Beispiel #12
0
 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!"
Beispiel #13
0
 def test_translate_3(self):
     """Check that graphic is translated properly twice."""
     graphic = Graphic(etree.parse("arrow.svg").getroot())
     graphic.set_position(500, 237.21)
     graphic.set_position(11, 32)
     assert map(lambda x: round(x, 10), graphic.get_position()) == [11, 32], "Position should be 11,32!"
Beispiel #14
0
 def test_translate_1(self):
     """Check that graphic is translated properly."""
     graphic = Graphic(etree.parse("arrow.svg").getroot())
     graphic.set_position(0, 0)
     log.info(graphic.get_position())
     assert map(lambda x: round(x, 10), graphic.get_position()) == [0, 0], "Position should be 0,0!"