(t *testing.T)
| 47 | } |
| 48 | |
| 49 | func 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 | |
| 83 | func TestAnimationComponentSelectAnimationByAction(t *testing.T) { |
| 84 | drawables := []Drawable{ |
nothing calls this directly
no test coverage detected