mirror of
https://github.com/asticode/go-astiav.git
synced 2025-10-21 15:19:25 +08:00
Added FrameData ToImage()
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package astiav_test
|
||||
|
||||
import (
|
||||
"image"
|
||||
"image/png"
|
||||
"os"
|
||||
"testing"
|
||||
@@ -12,10 +13,12 @@ import (
|
||||
func TestFrameData(t *testing.T) {
|
||||
for _, v := range []struct {
|
||||
ext string
|
||||
i image.Image
|
||||
name string
|
||||
}{
|
||||
{
|
||||
ext: "png",
|
||||
i: &image.NRGBA{},
|
||||
name: "image-rgba",
|
||||
},
|
||||
// TODO Find a way to test yuv and yuva even though result seems to change randomly
|
||||
@@ -39,9 +42,11 @@ func TestFrameData(t *testing.T) {
|
||||
|
||||
i1, err := fd.Image()
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, fd.ToImage(v.i))
|
||||
i2, err := png.Decode(f1)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, i1, i2)
|
||||
require.Equal(t, v.i, i2)
|
||||
}()
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user