MCPcopy Index your code
hub / github.com/EngoEngine/engo / TestAnimationComponentSelectAnimationByName

Function TestAnimationComponentSelectAnimationByName

common/animation_test.go:49–81  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

47}
48
49func TestAnimationComponentSelectAnimationByName(t *testing.T) {
50 drawables := []Drawable{
51 &TestDrawable{0},
52 &TestDrawable{1},
53 &TestDrawable{2},
54 }
55 ac := NewAnimationComponent(drawables, 0.1)
56 firstFrames := []int{0, 1, 2}
57 secondFrames := []int{1, 2, 1, 0}
58 actions := []*Animation{
59 {
60 Name: "ZeroOneTwo",
61 Frames: firstFrames,
62 },
63 {
64 Name: "OneTwoOneZero",
65 Frames: secondFrames,
66 },
67 }
68 ac.AddAnimations(actions)
69 ac.SelectAnimationByName("ZeroOneTwo")
70 for i, frame := range ac.CurrentAnimation.Frames {
71 if frame != firstFrames[i] {
72 t.Errorf("Animation ZeroOneTwo was not set to current animation after SelectAnimationByName")
73 }
74 }
75 ac.SelectAnimationByName("OneTwoOneZero")
76 for i, frame := range ac.CurrentAnimation.Frames {
77 if frame != secondFrames[i] {
78 t.Errorf("Animation OneTwoOneZero was not set to current animation after SelectAnimationByName")
79 }
80 }
81}
82
83func TestAnimationComponentSelectAnimationByAction(t *testing.T) {
84 drawables := []Drawable{

Callers

nothing calls this directly

Calls 3

AddAnimationsMethod · 0.95
SelectAnimationByNameMethod · 0.95
NewAnimationComponentFunction · 0.85

Tested by

no test coverage detected