mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
Point tests: use string comparison where possible.
This commit is contained in:
parent
4b9a00a65c
commit
0e297e56ac
1 changed files with 8 additions and 16 deletions
|
@ -1,32 +1,27 @@
|
|||
module('Point');
|
||||
test('new Point(10, 20)', function() {
|
||||
var point = new Point(10, 20);
|
||||
equals(point.x, 10);
|
||||
equals(point.y, 20);
|
||||
equals(point.toString(), '{ x: 10, y: 20 }');
|
||||
});
|
||||
|
||||
test('new Point([10, 20])', function() {
|
||||
var point = new Point([10, 20]);
|
||||
equals(point.x, 10);
|
||||
equals(point.y, 20);
|
||||
equals(point.toString(), '{ x: 10, y: 20 }');
|
||||
});
|
||||
|
||||
test('new Point({x: 10, y: 20})', function() {
|
||||
var point = new Point({x: 10, y: 20});
|
||||
equals(point.x, 10);
|
||||
equals(point.y, 20);
|
||||
equals(point.toString(), '{ x: 10, y: 20 }');
|
||||
});
|
||||
|
||||
test('new Point(new Size(10, 20))', function() {
|
||||
var point = new Point(new Size(10, 20));
|
||||
equals(point.x, 10);
|
||||
equals(point.y, 20);
|
||||
equals(point.toString(), '{ x: 10, y: 20 }');
|
||||
});
|
||||
|
||||
test('new Point({ width: 10, height: 20})', function() {
|
||||
var point = new Point({width: 10, height: 20});
|
||||
equals(point.x, 10);
|
||||
equals(point.y, 20);
|
||||
equals(point.toString(), '{ x: 10, y: 20 }');
|
||||
});
|
||||
|
||||
test('new Point({ angle: 45, length: 20})', function() {
|
||||
|
@ -38,15 +33,13 @@ module('Point vector operations');
|
|||
|
||||
test('normalize(length)', function() {
|
||||
var point = new Point(0, 10).normalize(20)
|
||||
equals(point.x, 0);
|
||||
equals(point.y, 20);
|
||||
equals(point.toString(), '{ x: 0, y: 20 }');
|
||||
});
|
||||
|
||||
test('set length', function() {
|
||||
var point = new Point(0, 10);
|
||||
point.length = 20;
|
||||
equals(point.x, 0);
|
||||
equals(point.y, 20);
|
||||
equals(point.toString(), '{ x: 0, y: 20 }');
|
||||
});
|
||||
|
||||
test('get angle', function() {
|
||||
|
@ -61,8 +54,7 @@ test('getAngle(point)', function() {
|
|||
|
||||
test('rotate(degrees)', function() {
|
||||
var point = new Point(100, 50).rotate(90);
|
||||
equals(Math.round(point.x), -50);
|
||||
equals(Math.round(point.y), 100);
|
||||
equals(point.toString(), '{ x: -50, y: 100 }');
|
||||
});
|
||||
|
||||
test('set angle', function() {
|
||||
|
|
Loading…
Reference in a new issue