예제 #1
0
 def test_scale_3(self):
     """Check that graphic is scaled properly."""
     graphic = Graphic(etree.parse("arrow.svg").getroot())
     graphic.set_scale(2.72)
     e = 1
     w = 333.469 * 2.72
     assert w - e < graphic.get_width() < w + e, "Graphic width is wrong after scaling!"
     graphic.set_scale(1)
     w = 333.469
     assert w - e < graphic.get_width() < w + e, "Graphic width is wrong after scaling the second time!"
예제 #2
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
예제 #3
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
예제 #4
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
예제 #5
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
예제 #6
0
 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
예제 #7
0
 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
예제 #8
0
 def test_scale_3(self):
     """Check that graphic is scaled properly."""
     graphic = Graphic(etree.parse("arrow.svg").getroot())
     graphic.set_scale(2.72)
     e = 1
     w = 333.469 * 2.72
     assert w - e < graphic.get_width(
     ) < w + e, "Graphic width is wrong after scaling!"
     graphic.set_scale(1)
     w = 333.469
     assert w - e < graphic.get_width(
     ) < w + e, "Graphic width is wrong after scaling the second time!"
예제 #9
0
 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
예제 #10
0
 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
예제 #11
0
 def test_rotation_2(self):
     """Check that graphic is rotated properly."""
     graphic = Graphic(etree.parse("arrow.svg").getroot())
     h = graphic.get_height()
     graphic.set_rotation(270)
     f = open("out/arrow_%s.svg" % sys._getframe().f_code.co_name, "w")
     f.write(graphic.get_xml())
     f.close()
     assert graphic.get_width() == h
예제 #12
0
 def test_rotation_2(self):
     """Check that graphic is rotated properly."""
     graphic = Graphic(etree.parse("arrow.svg").getroot())
     h = graphic.get_height()
     graphic.set_rotation(270)
     f = open("out/arrow_%s.svg" % sys._getframe().f_code.co_name, "w")
     f.write(graphic.get_xml())
     f.close()
     assert graphic.get_width() == h
예제 #13
0
 def test_scale_y(self):
     """Check that graphic is scaled properly."""
     graphic = Graphic(etree.parse("arrow.svg").getroot())
     graphic.set_scale(3, 1)
     e = 1
     w = 333.469 * 3
     h = 170.563
     assert w - e < graphic.get_width() < w + e, "Graphic width is wrong after scaling!"
     assert h - e < graphic.get_height() < h + e, "Graphic height is wrong after scaling!"
예제 #14
0
 def test_scale_y(self):
     """Check that graphic is scaled properly."""
     graphic = Graphic(etree.parse("arrow.svg").getroot())
     graphic.set_scale(3, 1)
     e = 1
     w = 333.469 * 3
     h = 170.563
     assert w - e < graphic.get_width(
     ) < w + e, "Graphic width is wrong after scaling!"
     assert h - e < graphic.get_height(
     ) < h + e, "Graphic height is wrong after scaling!"
예제 #15
0
 def test_case_4(self):
     """Check the graphic width"""
     graphic = Graphic(etree.parse("arrow.svg").getroot())
     e = 1
     w = 333.469
     assert w - e < graphic.get_width() < w + e, "Graphic width is wrong!"
예제 #16
0
 def test_rotation_1(self):
     """Check that graphic is rotated properly."""
     graphic = Graphic(etree.parse("arrow.svg").getroot())
     h = graphic.get_height()
     graphic.set_rotation(90)
     assert graphic.get_width() == h
예제 #17
0
 def test_case_4(self):
     """Check the graphic width"""
     graphic = Graphic(etree.parse("arrow.svg").getroot())
     e = 1
     w = 333.469
     assert w - e < graphic.get_width() < w + e, "Graphic width is wrong!"
예제 #18
0
 def test_rotation_1(self):
     """Check that graphic is rotated properly."""
     graphic = Graphic(etree.parse("arrow.svg").getroot())
     h = graphic.get_height()
     graphic.set_rotation(90)
     assert graphic.get_width() == h