Beispiel #1
0
 def test_apply_cutting_overlap(self):
     """Test Plugin.apply_cutting_overlap()!"""
     overlap = 20
     plugin = Plugin()
     g = Graphic("arrow.svg")
     g.set_scale(HPGL.HPGL_SCALE,HPGL.HPGL_SCALE)
     paths = g.get_polyline()
     lengths = []
     for path in paths:
         lengths.append(g.get_path_length(path=path))
     
     plugin.apply_cutting_overlap(paths,overlap)
     for path,length in zip(paths,lengths):
         if path_is_closed(path):
             new_length = g.get_path_length(path=path)
             assert round(length+overlap,10) == round(new_length,10), "%s != %s" % (round(length+overlap,10),round(new_length,10))
         else:
             assert round(length,10) == round(new_length,10), "%s != %s" % (round(length,10),round(new_length,10))
Beispiel #2
0
    def test_apply_cutting_overlap(self):
        """Test Plugin.apply_cutting_overlap()!"""
        overlap = 20
        plugin = Plugin()
        g = Graphic("arrow.svg")
        g.set_scale(HPGL.HPGL_SCALE, HPGL.HPGL_SCALE)
        paths = g.get_polyline()
        lengths = []
        for path in paths:
            lengths.append(g.get_path_length(path=path))

        plugin.apply_cutting_overlap(paths, overlap)
        for path, length in zip(paths, lengths):
            if path_is_closed(path):
                new_length = g.get_path_length(path=path)
                assert round(length + overlap,
                             10) == round(new_length, 10), "%s != %s" % (round(
                                 length + overlap, 10), round(new_length, 10))
            else:
                assert round(length,
                             10) == round(new_length, 10), "%s != %s" % (round(
                                 length, 10), round(new_length, 10))
Beispiel #3
0
 def test_get_polyline(self):
     """ Check that get polyline works correctly."""
     graphic = Graphic(etree.parse("fat-giraffes.svg"))
     f = open("pout.py", "w")
     f.write("poly = %s" % graphic.get_polyline())
     f.close()
Beispiel #4
0
 def test_get_polyline(self):
     """ Check that get polyline works correctly."""
     graphic = Graphic(etree.parse("fat-giraffes.svg"))
     f = open("pout.py", "w")
     f.write("poly = %s" % graphic.get_polyline())
     f.close()