From 62ffa8749c760bf26ac7198f3e1d49ebda9ea826 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Wed, 24 Apr 2013 18:35:44 -0700 Subject: [PATCH] Define failing tests for #208. --- test/tests/Item_Contains.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/test/tests/Item_Contains.js b/test/tests/Item_Contains.js index 2d70c1c0..c6cfe20e 100644 --- a/test/tests/Item_Contains.js +++ b/test/tests/Item_Contains.js @@ -17,7 +17,7 @@ function testPoint(item, point, inside) { + ' should be ' + (inside ? 'inside' : 'outside') + '.'); } -test('Path#contains (Regular Polygon)', function() { +test('Path#contains() (Regular Polygon)', function() { var path = new Path.RegularPolygon([0, 0], 6, 20); testPoint(path, new Point(0, -20), true); @@ -39,7 +39,7 @@ test('Path#contains (Regular Polygon)', function() { testPoint(path, new Point(10, 20), false); }); -test('CompoundPath#contains (Donut)', function() { +test('CompoundPath#contains() (Donut)', function() { var path = new CompoundPath([ new Path.Circle([0, 0], 50), new Path.Circle([0, 0], 25) @@ -71,7 +71,7 @@ test('CompoundPath#contains (Donut)', function() { 'The near bottom left point of bounding box should be outside the donut.'); }); -test('Shape#contains', function() { +test('Shape#contains()', function() { var shape = new Shape.Circle([0, 0], 100); testPoint(shape, new Point(0, 0), true); @@ -101,3 +101,11 @@ test('Shape#contains', function() { testPoint(shape, new Point(1, 0).multiply(half), true); testPoint(shape, new Point(1.1, 0).multiply(half), false); }); + +test('Path#contains() (Rectangle Contours)', function() { + var path = new Path.Rectangle(new Point(100, 100), [200, 200]), + curves = path.getCurves(); + + for (var i = 0; i < curves.length; i++) + testPoint(path, curves[i].getPoint(0.5), true); +});