(t *testing.T)
| 81 | } |
| 82 | |
| 83 | func TestAnimationComponentSelectAnimationByAction(t *testing.T) { |
| 84 | drawables := []Drawable{ |
| 85 | &TestDrawable{0}, |
| 86 | &TestDrawable{1}, |
| 87 | &TestDrawable{2}, |
| 88 | } |
| 89 | ac := NewAnimationComponent(drawables, 0.1) |
| 90 | firstFrames := []int{0, 1, 2} |
| 91 | secondFrames := []int{1, 2, 1, 0} |
| 92 | actions := []*Animation{ |
| 93 | { |
| 94 | Name: "ZeroOneTwo", |
| 95 | Frames: firstFrames, |
| 96 | }, |
| 97 | { |
| 98 | Name: "OneTwoOneZero", |
| 99 | Frames: secondFrames, |
| 100 | }, |
| 101 | } |
| 102 | ac.AddAnimations(actions) |
| 103 | ac.SelectAnimationByAction(actions[0]) |
| 104 | for i, frame := range ac.CurrentAnimation.Frames { |
| 105 | if frame != firstFrames[i] { |
| 106 | t.Errorf("Animation ZeroOneTwo was not set to current animation after SelectAnimationByAction") |
| 107 | } |
| 108 | } |
| 109 | ac.SelectAnimationByAction(actions[1]) |
| 110 | for i, frame := range ac.CurrentAnimation.Frames { |
| 111 | if frame != secondFrames[i] { |
| 112 | t.Errorf("Animation OneTwoOneZero was not set to current animation after SelectAnimationByAction") |
| 113 | } |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | func TestAnimationComponentAddDefaultAnimation(t *testing.T) { |
| 118 | drawables := []Drawable{ |
nothing calls this directly
no test coverage detected