| 90 | } |
| 91 | |
| 92 | func TestCameraZoom(t *testing.T) { |
| 93 | initialize() |
| 94 | |
| 95 | currentZ := cam.Z() |
| 96 | |
| 97 | cam.moveX(0.5) |
| 98 | assert.Equal(t, cam.Z(), currentZ, "Moving in the X direction shouldn't change the zoom level") |
| 99 | |
| 100 | cam.moveX(-1) |
| 101 | assert.Equal(t, cam.Z(), currentZ, "Moving in the X direction shouldn't change the zoom level") |
| 102 | |
| 103 | cam.moveY(0.5) |
| 104 | assert.Equal(t, cam.Z(), currentZ, "Moving in the Y direction shouldn't change the zoom level") |
| 105 | |
| 106 | cam.moveY(-1) |
| 107 | assert.Equal(t, cam.Z(), currentZ, "Moving in the Y direction shouldn't change the zoom level") |
| 108 | |
| 109 | cam.zoom(0.5) |
| 110 | assert.Equal(t, cam.Z(), currentZ+0.5, "Should be zoomed in an additional 0.5") |
| 111 | |
| 112 | cam.zoom(-0.5) |
| 113 | assert.Equal(t, cam.Z(), currentZ, "Should be zoomed out to the starting zoom level") |
| 114 | |
| 115 | cam.zoom(-1000) |
| 116 | assert.Equal(t, cam.Z(), MinZoom, "Should be zoomed out to the minimum zoom level") |
| 117 | |
| 118 | cam.zoom(1000) |
| 119 | assert.Equal(t, cam.Z(), MaxZoom, "Should be zoomed in to the maximum zoom level") |
| 120 | } |
| 121 | |
| 122 | func TestCameraMoveToX(t *testing.T) { |
| 123 | initialize() |