Skip to content

Commit

Permalink
[melonjs#444] add a visibility test against a infinite camera positio…
Browse files Browse the repository at this point in the history
…n and size
  • Loading branch information
obiot committed Dec 4, 2021
1 parent 1e7def6 commit ede7381
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/spec/camera-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ describe("me.Camera2d", function () {
it("isVisible function test", function () {
// default camera
var camera = new me.Camera2d(0, 0, 1000, 1000);
var infiniteCamera = new me.Camera2d(-Infinity, -Infinity, Infinity, Infinity);

// object to test for visibility
var obj = new me.Renderable(0, 0, 10, 10);

// make it easier by setting anchor point to 0, 0
Expand All @@ -59,5 +62,12 @@ describe("me.Camera2d", function () {
// should be visible again
expect(camera.isVisible(obj)).toEqual(true);

// should always be visible if camera size is Infinite
obj.floating = false;
expect(infiniteCamera.isVisible(obj)).toEqual(true);
// should always be visible if camera size is Infinite
obj.floating = true;
expect(infiniteCamera.isVisible(obj)).toEqual(true);

});
});

0 comments on commit ede7381

Please sign in to comment.