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))
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))