Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
asticode committed Jan 24, 2024
1 parent 3cd8177 commit 28e6b9d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
13 changes: 8 additions & 5 deletions astiav_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,17 @@ import (
var globalHelper = newHelper()

func TestMain(m *testing.M) {
// Run
m.Run()
// Make sure to exit with the proper code
var code int
defer func(code *int) {
os.Exit(*code)
}(&code)

// Make sure to close global helper
globalHelper.close()
defer globalHelper.close()

// Exit
os.Exit(0)
// Run
code = m.Run()
}

type helper struct {
Expand Down
9 changes: 4 additions & 5 deletions codec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,14 @@ func TestCodec(t *testing.T) {
require.Equal(t, "aac", c.Name())
require.Equal(t, "aac", c.String())

c = astiav.FindEncoder(astiav.CodecIDH264)
c = astiav.FindEncoder(astiav.CodecIDMjpeg)
require.NotNil(t, c)
require.False(t, c.IsDecoder())
require.True(t, c.IsEncoder())
require.Contains(t, c.PixelFormats(), astiav.PixelFormatNv12)
require.Contains(t, c.PixelFormats(), astiav.PixelFormatYuv420P)
require.Contains(t, c.PixelFormats(), astiav.PixelFormatYuvj420P)
require.Nil(t, c.SampleFormats())
require.Contains(t, c.Name(), "264")
require.Contains(t, c.String(), "264")
require.Contains(t, c.Name(), "mjpeg")
require.Contains(t, c.String(), "mjpeg")

c = astiav.FindEncoderByName("mjpeg")
require.NotNil(t, c)
Expand Down

0 comments on commit 28e6b9d

Please sign in to comment.