| 250 | } |
| 251 | |
| 252 | func 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 | |
| 282 | func TestAudioPlayerSeek(t *testing.T) { |
| 283 | engo.Files.SetRoot("testdata") |