d3/test/geo/rotation-test.js

36 строки
1.0 KiB
JavaScript
Исходник Обычный вид История

var vows = require("vows"),
2013-03-14 10:21:23 +04:00
load = require("../load"),
2013-03-14 23:59:54 +04:00
assert = require("../assert");
var suite = vows.describe("d3.geo.rotation");
suite.addBatch({
2013-03-14 10:21:23 +04:00
"rotation": {
topic: load("geo/rotation").expression("d3.geo.rotation"),
2013-03-14 10:21:23 +04:00
"a rotation of [+90°, 0°]": {
topic: function(rotation) {
return rotation([90, 0]);
2013-03-14 10:21:23 +04:00
},
"only rotates longitude": function(rotation) {
assert.inDelta(rotation([0, 0]), [90, 0], 1e-6);
},
"wraps around when crossing the antimeridian": function(rotation) {
assert.inDelta(rotation([150, 0]), [-120, 0], 1e-6);
}
2013-03-12 01:49:54 +04:00
},
2013-03-14 10:21:23 +04:00
"a rotation of [-45°, -45°]": {
topic: function(rotation) {
return rotation([-45, 45]);
2013-03-14 10:21:23 +04:00
},
"rotates longitude and latitude": function(rotation) {
assert.inDelta(rotation([0, 0]), [-54.73561, 30], 1e-6);
},
"inverse rotation of longitude and latitude": function(rotation) {
assert.inDelta(rotation.invert([-54.73561, 30]), [0, 0], 1e-6);
}
}
}
});
suite.export(module);