diff --git a/test/tests/Path_Boolean.js b/test/tests/Path_Boolean.js new file mode 100644 index 00000000..5895e693 --- /dev/null +++ b/test/tests/Path_Boolean.js @@ -0,0 +1,31 @@ +/* + * Paper.js - The Swiss Army Knife of Vector Graphics Scripting. + * http://paperjs.org/ + * + * Copyright (c) 2011 - 2014, Juerg Lehni & Jonathan Puckey + * http://scratchdisk.com/ & http://jonathanpuckey.com/ + * + * Distributed under the MIT license. See LICENSE file for details. + * + * All rights reserved. + */ + +module('Path Boolean Operations'); + +test('path.unite(); #609', function() { + // https://github.com/paperjs/paper.js/issues/609 + // path1 and path2 are half circles, applying unite should result in a circle + + var path1 = new Path(); + path1.moveTo(new Point(100, 100)); + path1.arcTo(new Point(100, 200)); + path1.closePath(); + + var path2 = new Path(); + path2.moveTo(new Point(100, 200)); + path2.arcTo(new Point(100, 100)); + path2.closePath(); + + var path3 = path1.unite(path2); + equals(path3.pathData, 'M100,100c27.61424,0 50,22.38576 50,50c0,27.61424 -22.38576,50 -50,50z M100,200c-27.61424,0 -50,-22.38576 -50,-50c0,-27.61424 22.38576,-50 50,-50z', 'path3.pathData'); +}); diff --git a/test/tests/load.js b/test/tests/load.js index 7fb01db5..4b250c7a 100644 --- a/test/tests/load.js +++ b/test/tests/load.js @@ -36,6 +36,7 @@ /*#*/ include('Path_Bounds.js'); /*#*/ include('Path_Length.js'); /*#*/ include('Path_Intersections.js'); +/*#*/ include('Path_Boolean.js'); /*#*/ include('Curve.js'); /*#*/ include('CurveLocation.js');