Kirika/audio/format/mp3/mp3_lame_test.go
DataHoarder bd069cdf05
Some checks failed
continuous-integration/drone/push Build is failing
General code inspection cleanup
2022-10-03 11:34:56 +02:00

43 lines
710 B
Go

//go:build !disable_format_mp3 && !disable_codec_lame && cgo
package mp3
import (
"git.gammaspectra.live/S.O.N.G/Kirika/audio/format/flac"
"git.gammaspectra.live/S.O.N.G/Kirika/test"
"os"
"testing"
)
func TestEncodeMP3(t *testing.T) {
fp, err := os.Open(test.SingleSample24)
if err != nil {
t.Error(err)
return
}
defer fp.Close()
source, err := flac.NewFormat().Open(fp)
if err != nil {
t.Error(err)
return
}
target, err := os.CreateTemp("/tmp", "encode_test_*.mp3")
if err != nil {
t.Error(err)
return
}
defer func() {
name := target.Name()
target.Close()
os.Remove(name)
}()
err = NewFormat().Encode(source, target, nil)
if err != nil {
t.Error(err)
return
}
}