mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
Add failing Path#hitTest(point) test.
This commit is contained in:
parent
2386743b39
commit
d61f70f443
1 changed files with 18 additions and 0 deletions
|
@ -281,6 +281,24 @@ test('hit testing stroke on segment point of a path', function() {
|
|||
equals(error == null, true, description);
|
||||
});
|
||||
|
||||
test('Hit testing a point that is extremely close to a curve', function() {
|
||||
var path = new Path.Rectangle([0, 0], [100, 100]);
|
||||
// A point whose x value is extremely close to 0:
|
||||
var point = new Point(2.842 / Math.pow(10, 14), 0);
|
||||
var error;
|
||||
try {
|
||||
var hitResult = path.hitTest(point, {
|
||||
stroke: true
|
||||
});
|
||||
} catch(e) {
|
||||
error = e;
|
||||
}
|
||||
var description = 'This hit test should not throw an error';
|
||||
if (error)
|
||||
description += ': ' + error;
|
||||
equals(error == null, true, description);
|
||||
});
|
||||
|
||||
test('hitting path ends', function() {
|
||||
var path = new Path([0, 0], [50, 50], [100, 0]);
|
||||
path.closed = true;
|
||||
|
|
Loading…
Reference in a new issue