mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2024-12-29 09:22:22 -05:00
Improve test for #1651
Move to the right place and simplify to only test against a non-invertible matrix.
This commit is contained in:
parent
32aff8e895
commit
b5c753f23d
2 changed files with 7 additions and 20 deletions
|
@ -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();
|
||||
|
|
|
@ -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');
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue