From 27f866df61af468b463084862860cb6aa4bdf3b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Sun, 27 Mar 2016 13:45:55 -0700 Subject: [PATCH] Implement test for #1021. --- test/tests/Item_Bounds.js | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/test/tests/Item_Bounds.js b/test/tests/Item_Bounds.js index 5a46017b..41ec527a 100644 --- a/test/tests/Item_Bounds.js +++ b/test/tests/Item_Bounds.js @@ -186,8 +186,8 @@ test('path.strokeBounds with corners and miter limit', function() { var path = new Path({ pathData: 'M47,385c120,-100 120,-100 400,-40c-280,140 -280,140 -400,40z', strokeWidth: 5, - strokeJoin: "miter", - strokeColor: "black" + strokeJoin: 'miter', + strokeColor: 'black' }); equals(path.strokeBounds, new Rectangle(43.09488, 301.5525, 411.3977, 156.57543)); }); @@ -447,8 +447,8 @@ test('path.strokeBounds with corners and miter limit', function() { var path = new Path({ pathData: 'M47,385c120,-100 120,-100 400,-40c-280,140 -280,140 -400,40z', strokeWidth: 5, - strokeJoin: "miter", - strokeColor: "black" + strokeJoin: 'miter', + strokeColor: 'black' }); equals(path.strokeBounds, new Rectangle(43.09488, 301.5525, 411.3977, 156.57543)); }); @@ -667,3 +667,21 @@ test('path.internalBounds', function() { equals(path.internalBounds, new Rectangle(-100, -100, 200, 200), 'path.internalBounds'); }); + +test('compoundPath.strokeBounds', function() { + // #1021: + var data = { + pathData: 'M150 0 L75 200 L225 200 Z', + fillColor: 'blue', + strokeColor: 'red', + strokeWidth: 20 + }; + var path = new Path(data); + var compoundPath = new CompoundPath(data); + var bounds = new Rectangle(75, 0, 150, 200); + var strokeBounds = new Rectangle(60.57, -28.48001, 178.86001, 238.48001); + equals(function() { return compoundPath.bounds; }, bounds); + equals(function() { return compoundPath.strokeBounds; }, strokeBounds); + equals(function() { return path.bounds; }, bounds); + equals(function() { return path.strokeBounds; }, strokeBounds); +});