Point tests: use string comparison where possible.

This commit is contained in:
Jonathan Puckey 2011-05-21 21:01:36 +02:00
parent 4b9a00a65c
commit 0e297e56ac

View file

@ -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() {