24 lines
671 B
JavaScript
24 lines
671 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]);
|
|
});
|
|
|
|
});
|