From b5c753f23d3c0b2f91a7b32eca9a453a563eceb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Wed, 19 Jun 2019 22:05:26 +0200 Subject: [PATCH] Improve test for #1651 Move to the right place and simplify to only test against a non-invertible matrix. --- test/tests/Item.js | 19 ------------------- test/tests/PathItem_Contains.js | 8 +++++++- 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/test/tests/Item.js b/test/tests/Item.js index d8b679a3..0f751996 100644 --- a/test/tests/Item.js +++ b/test/tests/Item.js @@ -877,25 +877,6 @@ test('Item#pivot', function() { 'Changing position of an item with applyMatrix = true should change pivot'); }); -test('Item#contains', function() { - var point = new Point(50,50); - var path1 = new Path({matrix: new Matrix(0,0,0,0,0,0)}); - - equals(path1.contains(point), false, - 'An irregularly shaped item cannot contain a point'); - - var path2 = new Path.Rectangle({ - point: [50, 50], - size: [100, 100] - }); - equals(path2.contains(point), true, - 'A regularly shaped item with a point inside it, contains that point'); - - var point2 = new Point(0,0); - equals(path2.contains(point2), false, - 'A regularly shaped item with a point outside it, does not contain that point'); -}); - test('Item#position with irregular shape, #pivot and rotation', function() { var path1 = new Path([ [0, 0], [200, 100], [0, 100] ]); var path2 = path1.clone(); diff --git a/test/tests/PathItem_Contains.js b/test/tests/PathItem_Contains.js index 34787374..4a07f48e 100644 --- a/test/tests/PathItem_Contains.js +++ b/test/tests/PathItem_Contains.js @@ -394,4 +394,10 @@ test('Path#contains() with Path#interiorPoint: #854, #1064', function() { } }); - +test('IPathtem#contains() with non-invertible matrices (#1651)', function() { + var path = new Path({ + matrix: new Matrix(0, 0, 0, 0, 0, 0) + }); + equals(path.contains(path.position), false, + 'A path with a non-invertible matrix cannot contain its position'); +});