2013-03-03 03:09:02 +04:00
|
|
|
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");
|
2013-03-03 03:09:02 +04:00
|
|
|
|
|
|
|
var suite = vows.describe("d3.geo.rotation");
|
|
|
|
|
|
|
|
suite.addBatch({
|
2013-03-14 10:21:23 +04:00
|
|
|
"rotation": {
|
2013-03-14 20:41:29 +04:00
|
|
|
topic: load("geo/rotation").expression("d3.geo.rotation"),
|
2013-03-14 10:21:23 +04:00
|
|
|
"a rotation of [+90°, 0°]": {
|
2013-03-14 20:41:29 +04:00
|
|
|
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°]": {
|
2013-03-14 20:41:29 +04:00
|
|
|
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);
|
|
|
|
}
|
2013-03-03 03:09:02 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
suite.export(module);
|