mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2024-12-29 09:22:22 -05:00
Implement unit test for #610
This commit is contained in:
parent
da53bfe5a0
commit
c20b32f748
1 changed files with 26 additions and 2 deletions
|
@ -26,6 +26,30 @@ test('path.unite(); #609', function() {
|
|||
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');
|
||||
var result = path1.unite(path2);
|
||||
equals(result.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', 'result.pathData');
|
||||
});
|
||||
|
||||
test('ring.subtract(square); #610', function() {
|
||||
// https://github.com/paperjs/paper.js/issues/610
|
||||
var square = new Path.Rectangle({
|
||||
position: [140, 0],
|
||||
size: 300
|
||||
});
|
||||
|
||||
// Make a ring using subtraction of two circles:
|
||||
var inner = new Path.Circle({
|
||||
center: [0, 0],
|
||||
radius: 100
|
||||
});
|
||||
|
||||
var outer = new Path.Circle({
|
||||
center: [0, 0],
|
||||
radius: 132
|
||||
});
|
||||
|
||||
var ring = outer.subtract(inner);
|
||||
var result = ring.subtract(square);
|
||||
|
||||
equals(result.pathData, 'M-10,131.62689c-68.2302,-5.11075 -122,-62.08951 -122,-131.62689c0,-69.53737 53.7698,-126.51614 122,-131.62689l0,32.12064c-50.53323,5.01724 -90,47.65277 -90,99.50625c0,51.85348 39.46677,94.489 90,99.50625z');
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue