1
0
Fork 0
spacetac/src/ui/map/FleetDisplay.spec.ts

26 lines
941 B
TypeScript
Raw Normal View History

2017-02-09 00:00:35 +00:00
module TS.SpaceTac.UI.Specs {
2017-02-21 22:38:31 +00:00
describe("FleetDisplay", function () {
let testgame = setupMapview();
it("orbits the fleet around its current location", function () {
let mapview = testgame.mapview;
2017-01-30 00:40:33 +00:00
let fleet = mapview.player_fleet;
fleet.loopOrbit();
expect(fleet.rotation).toBe(0);
mapview.game.tweens.update();
let tween = first(mapview.game.tweens.getAll(), tw => tw.target == fleet);
2017-03-09 17:11:00 +00:00
if (tween) {
let tweendata = tween.generateData(0.1);
expect(tweendata.length).toEqual(3);
expect(tweendata[0].rotation).toBeCloseTo(-Math.PI * 2 / 3);
expect(tweendata[1].rotation).toBeCloseTo(-Math.PI * 4 / 3);
expect(tweendata[2].rotation).toBeCloseTo(-Math.PI * 2);
} else {
fail("No tween found");
}
2017-01-30 00:40:33 +00:00
});
});
}