MCPcopy
hub / github.com/EngoEngine/engo / TestCameraZoom

Function TestCameraZoom

common/camera_test.go:92–120  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

90}
91
92func 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
122func TestCameraMoveToX(t *testing.T) {
123 initialize()

Callers

nothing calls this directly

Calls 6

initializeFunction · 0.85
ZMethod · 0.80
moveXMethod · 0.80
EqualMethod · 0.80
moveYMethod · 0.80
zoomMethod · 0.80

Tested by

no test coverage detected