avocado/packages/topdown/test/camera.js
2021-01-06 02:49:16 -06:00

24 lines
666 B
JavaScript

import {expect} from 'chai';
import Camera from '../src/camera';
describe('Camera', () => {
it('clamps to dimensions', () => {
const camera = new Camera();
camera.viewSize = [20, 30];
camera.areaSize = [50, 50];
camera.position = [0, 0]
expect(camera.position).to.deep.equal([10, 15]);
camera.position = [-1000, 0]
expect(camera.position).to.deep.equal([10, 15]);
camera.position = [0, -1000]
expect(camera.position).to.deep.equal([10, 15]);
camera.position = [1000, 1000]
expect(camera.position).to.deep.equal([40, 35]);
camera.position = [25, 25]
expect(camera.position).to.deep.equal([25, 25]);
});
});