| 30 | func (*CameraTestScene) Type() string { return "CameraTestScene" } |
| 31 | |
| 32 | func TestCameraMoveX(t *testing.T) { |
| 33 | initialize() |
| 34 | |
| 35 | currentX := cam.X() |
| 36 | |
| 37 | cam.moveY(0.50) |
| 38 | assert.Equal(t, cam.X(), currentX, "Moving in the Y direction shouldn't change the X location") |
| 39 | |
| 40 | cam.moveY(-1) |
| 41 | assert.Equal(t, cam.X(), currentX, "Moving in the Y direction shouldn't change the X location") |
| 42 | |
| 43 | cam.zoom(0.50) |
| 44 | assert.Equal(t, cam.X(), currentX, "Zooming in should not change the X location") |
| 45 | |
| 46 | cam.zoom(-1) |
| 47 | assert.Equal(t, cam.X(), currentX, "Zooming out should not change the X location") |
| 48 | |
| 49 | cam.moveX(10) |
| 50 | assert.Equal(t, cam.X(), currentX+10, "Moving by 10 units, should have moved the camera by 10 units") |
| 51 | |
| 52 | cam.moveX(-10) |
| 53 | assert.Equal(t, cam.X(), currentX, "Moving by -10 units, should have moved the camera back by 10 units") |
| 54 | |
| 55 | cam.moveX(305) |
| 56 | assert.Equal(t, cam.X(), CameraBounds.Max.X, "Moving too many unit, should have moved the camera to the maximum") |
| 57 | |
| 58 | cam.moveX(-305) |
| 59 | assert.Equal(t, cam.X(), CameraBounds.Min.X, "Moving too many units back, should have moved the camera to the minimum") |
| 60 | } |
| 61 | |
| 62 | func TestCameraMoveY(t *testing.T) { |
| 63 | initialize() |