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

Function TestAudioLoaderUnload

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

Source from the content-addressed store, hash-verified

195}
196
197func TestAudioLoaderUnload(t *testing.T) {
198 engo.Files.SetRoot("testdata")
199 if err := engo.Files.Load("sfx_coin_double2.wav"); err != nil {
200 t.Errorf("Could not load file. Error was: %v\n", err)
201 }
202 if _, err := LoadedPlayer("sfx_coin_double2.wav"); err != nil {
203 t.Errorf("Coud not get player from loaded file. Error was: %v\n", err)
204 }
205 if err := engo.Files.Unload("sfx_coin_double2.wav"); err != nil {
206 t.Errorf("Could not unload file. Error was: %v\n", err)
207 }
208 if _, err := LoadedPlayer("sfx_coin_double2.wav"); err == nil {
209 t.Error("Loaded a previously unloaded player.")
210 } else {
211 if !strings.HasPrefix(err.Error(), "resource not loaded by `FileLoader`:") {
212 t.Errorf("Unexpected error while loading previously unloaded player. Error was: %v\n", err)
213 }
214 }
215}
216
217func TestAudioPlayerURL(t *testing.T) {
218 engo.Files.SetRoot("testdata")

Callers

nothing calls this directly

Calls 5

LoadedPlayerFunction · 0.85
SetRootMethod · 0.65
LoadMethod · 0.65
UnloadMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected