Example #1
0
 def test_weedline(self):
     """
     Test that a weedline graphic is added to the plot and that 0 padding
     doesn't change the bbox.
     """
     plot = Plot(90*12,90*12*4)
     plot.set_graphic(etree.tostring(etree.parse("arrow.svg")))
     plot.set_rotation(90)
     plot.set_copies(7)
     bbox = plot.get_bounding_box()
     plot.set_weedline(True)
     f = open("out/plot_%s.svg"%sys._getframe().f_code.co_name,"w")
     f.write(plot.get_preview_xml())
     f.close()
     assert len(plot._data) == 8, "len(plot._data) = %s, expect 8" %(len(plot._data))
     assert map(lambda x: round(x,10),plot.get_bounding_box()) == map(lambda x: round(x,10),bbox), "bbox before %s != bbox after weedline %s" % (bbox,plot.get_bounding_box())
Example #2
0
 def test_weedline_padding(self):
     """
     Test that a weedline graphic is added to the plot and that 35 padding
     only changes the width and height of the bbox by +=2*padding.
     """
     plot = Plot(90*12,90*12*4)
     plot.set_graphic(etree.tostring(etree.parse("arrow.svg")))
     plot.set_rotation(90)
     plot.set_copies(6)
     bbox = plot.get_bounding_box()
     plot.set_weedline(True)
     pad = 35
     plot.set_weedline_padding(pad)
     f = open("out/plot_%s.svg"%sys._getframe().f_code.co_name,"w")
     f.write(plot.get_preview_xml())
     f.close()
     assert len(plot._data) == 7, "len(plot._data) = %s, expect 7" %(len(plot._data))
     assert map(lambda x: round(x,10),plot.get_bounding_box()) == [0,bbox[1]+2*pad,35,bbox[3]+2*pad], "bbox before %s != bbox after weedline %s" % ([0,bbox[1]+35,35,bbox[3]+35],map(lambda x: round(x,10),plot.get_bounding_box()))
Example #3
0
 def test_weedline(self):
     """
     Test that a weedline graphic is added to the plot and that 0 padding
     doesn't change the bbox.
     """
     plot = Plot(90 * 12, 90 * 12 * 4)
     plot.set_graphic(etree.tostring(etree.parse("arrow.svg")))
     plot.set_rotation(90)
     plot.set_copies(7)
     bbox = plot.get_bounding_box()
     plot.set_weedline(True)
     f = open("out/plot_%s.svg" % sys._getframe().f_code.co_name, "w")
     f.write(plot.get_preview_xml())
     f.close()
     assert len(plot._data) == 8, "len(plot._data) = %s, expect 8" % (len(
         plot._data))
     assert map(lambda x: round(x, 10), plot.get_bounding_box()) == map(
         lambda x: round(x, 10),
         bbox), "bbox before %s != bbox after weedline %s" % (
             bbox, plot.get_bounding_box())
Example #4
0
 def test_weedline_padding(self):
     """
     Test that a weedline graphic is added to the plot and that 35 padding
     only changes the width and height of the bbox by +=2*padding.
     """
     plot = Plot(90 * 12, 90 * 12 * 4)
     plot.set_graphic(etree.tostring(etree.parse("arrow.svg")))
     plot.set_rotation(90)
     plot.set_copies(6)
     bbox = plot.get_bounding_box()
     plot.set_weedline(True)
     pad = 35
     plot.set_weedline_padding(pad)
     f = open("out/plot_%s.svg" % sys._getframe().f_code.co_name, "w")
     f.write(plot.get_preview_xml())
     f.close()
     assert len(plot._data) == 7, "len(plot._data) = %s, expect 7" % (len(
         plot._data))
     assert map(lambda x: round(x, 10), plot.get_bounding_box()) == [
         0, bbox[1] + 2 * pad, 35, bbox[3] + 2 * pad
     ], "bbox before %s != bbox after weedline %s" % ([
         0, bbox[1] + 35, 35, bbox[3] + 35
     ], map(lambda x: round(x, 10), plot.get_bounding_box()))