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

Function TestCameraMoveX

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

Source from the content-addressed store, hash-verified

30func (*CameraTestScene) Type() string { return "CameraTestScene" }
31
32func 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
62func TestCameraMoveY(t *testing.T) {
63 initialize()

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected