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

Function TestAudioPlayerPlay

common/audio_test.go:252–280  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

250}
251
252func TestAudioPlayerPlay(t *testing.T) {
253 engo.Files.SetRoot("testdata")
254 if err := engo.Files.Load("1.ogg"); err != nil {
255 t.Errorf("Could not load file. Error was: %v\n", err)
256 }
257 p, err := LoadedPlayer("1.ogg")
258 if err != nil {
259 t.Errorf("Could not get player. Error was: %v\n", err)
260 }
261 if p.IsPlaying() {
262 t.Error("Player was playing before play was called.")
263 }
264 p.Play()
265 if !p.IsPlaying() {
266 t.Error("Player was not playing after play was called.")
267 }
268 p.Pause()
269 if p.IsPlaying() {
270 t.Error("Player was playing after pause was called.")
271 }
272 p.Seek(time.Second / 5)
273 if p.IsPlaying() {
274 t.Error("Player was playing after pause when seek was called, but play was not.")
275 }
276 p.Play()
277 if !p.IsPlaying() {
278 t.Error("Player was not playing after play was called, after pause and seek.")
279 }
280}
281
282func TestAudioPlayerSeek(t *testing.T) {
283 engo.Files.SetRoot("testdata")

Callers

nothing calls this directly

Calls 8

LoadedPlayerFunction · 0.85
IsPlayingMethod · 0.80
PlayMethod · 0.80
SetRootMethod · 0.65
LoadMethod · 0.65
ErrorMethod · 0.45
PauseMethod · 0.45
SeekMethod · 0.45

Tested by

no test coverage detected