Improve unit tests for CompoundPath#contains()

This commit is contained in:
Jürg Lehni 2014-04-28 16:42:34 +02:00
parent ad4f74a872
commit 42ab9bbda7

View file

@ -112,23 +112,22 @@ test('CompoundPath#contains() (Donut)', function() {
'The near bottom center point of the outer circle should be outside the donut.');
testPoint(path, new Point({ length: 50, angle: 30 }), true,
'A random point on the periphery of the outer circle should be inside the donut.');
// False positive and negatives.
// testPoint(path, new Point(0, 25), false,
// 'The bottom center point of the inner circle should be outside the donut.');
// testPoint(path, new Point({ length: 25, angle: 30 }), false,
// 'A random point on the periphery of the inner circle should be outside the donut.');
testPoint(path, new Point(-25, 0), true,
'The left center point of the inner circle should be inside the donut.');
testPoint(path, new Point(0, -25), true,
'The top center point of the inner circle should be inside the donut.');
testPoint(path, new Point(25, 0), true,
'The right center point of the inner circle should be inside the donut.');
testPoint(path, new Point(0, 25), true,
'The bottom center point of the inner circle should be inside the donut.');
testPoint(path, new Point({x: 21.654222720313882, y: 12.502112923650227}), true,
'A random point on the periphery of the inner circle should be inside the donut.');
testPoint(path, new Point(-50, -50), false,
'The top left point of bounding box should be outside the donut.');
testPoint(path, new Point(50, -50), false,
'The top right point of the bounding box should be inside the donut.');
'The top right point of the bounding box should be outside the donut.');
testPoint(path, new Point(-50, 50), false,
'The bottom left point of bounding box should be outside the donut.');
testPoint(path, new Point(50, 50), false,
'The bottom right point of the bounding box should be inside the donut.');
'The bottom right point of the bounding box should be outside the donut.');
testPoint(path, new Point(-45, 45), false,
'The near bottom left point of bounding box should be outside the donut.');
});