Kirika/audio/format/vorbis/vorbis_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

46 lines
802 B
Go

//go:build !disable_format_vorbis && !disable_codec_libvorbis && cgo
package vorbis
import (
"git.gammaspectra.live/S.O.N.G/Kirika/audio/format/flac"
"git.gammaspectra.live/S.O.N.G/Kirika/test"
"os"
"testing"
)
func TestEncodeVorbis(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_*.vorbis")
if err != nil {
t.Error(err)
return
}
defer func() {
name := target.Name()
target.Close()
os.Remove(name)
}()
options := make(map[string]interface{})
options["bitrate"] = "128k"
err = NewFormat().Encode(source, target, options)
if err != nil {
t.Error(err)
return
}
}