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

Function TestAnimationSystemIntegration

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

Source from the content-addressed store, hash-verified

386}
387
388func TestAnimationSystemIntegration(t *testing.T) {
389 var buf bytes.Buffer
390 log.SetOutput(&buf)
391 s := TestAnimationScene{}
392 engo.Run(engo.RunOptions{
393 HeadlessMode: true,
394 NoRun: true,
395 }, &s)
396 testSystem := &TestAnimationSystem{}
397 for _, sys := range s.w.Systems() {
398 if system, ok := sys.(*TestAnimationSystem); ok {
399 testSystem = system
400 }
401 }
402 // initial state
403 exp := []int{0, 3, 7, 10}
404 res := testSystem.GetCurrentFrameDrawables()
405 for i := 0; i < 4; i++ {
406 if exp[i] != res[i] {
407 t.Errorf("Incorrect initial frame!\nWanted: %v\nGot: %v\nIndex: %v", exp[i], res[i], i)
408 return
409 }
410 }
411 s.w.Update(1)
412 exp = []int{0, 3, 7, 10}
413 res = testSystem.GetCurrentFrameDrawables()
414 for i := 0; i < 4; i++ {
415 if exp[i] != res[i] {
416 t.Errorf("Incorrect first frame!\nWanted: %v\nGot: %v\nIndex: %v", exp[i], res[i], i)
417 return
418 }
419 }
420 s.w.Update(1)
421 exp = []int{0, 6, 7, 10}
422 res = testSystem.GetCurrentFrameDrawables()
423 for i := 0; i < 4; i++ {
424 if exp[i] != res[i] {
425 t.Errorf("Incorrect second frame!\nWanted: %v\nGot: %v\nIndex: %v", exp[i], res[i], i)
426 return
427 }
428 }
429 s.w.Update(1)
430 exp = []int{0, 4, 7, 10}
431 res = testSystem.GetCurrentFrameDrawables()
432 for i := 0; i < 4; i++ {
433 if exp[i] != res[i] {
434 t.Errorf("Incorrect third frame!\nWanted: %v\nGot: %v\nIndex: %v", exp[i], res[i], i)
435 return
436 }
437 }
438 s.w.Update(1)
439 exp = []int{1, 6, 8, 10}
440 res = testSystem.GetCurrentFrameDrawables()
441 for i := 0; i < 4; i++ {
442 if exp[i] != res[i] {
443 t.Errorf("Incorrect fourth frame!\nWanted: %v\nGot: %v\nIndex: %v", exp[i], res[i], i)
444 return
445 }

Callers

nothing calls this directly

Calls 3

RunFunction · 0.92
UpdateMethod · 0.65

Tested by

no test coverage detected