-
Notifications
You must be signed in to change notification settings - Fork 58
/
Copy pathframe_side_data_test.go
61 lines (56 loc) · 1.31 KB
/
frame_side_data_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package astiav
import (
"testing"
"github.com/stretchr/testify/require"
)
func testFrameSideData(sd *FrameSideData, t *testing.T) {
rois1 := []RegionOfInterest{
{
Bottom: 1,
Left: 2,
QuantisationOffset: NewRational(3, 4),
Right: 5,
Top: 6,
},
{
Bottom: 7,
Left: 8,
QuantisationOffset: NewRational(9, 10),
Right: 11,
Top: 12,
},
}
require.NoError(t, sd.RegionsOfInterest().Add(rois1))
rois2, ok := sd.RegionsOfInterest().Get()
require.True(t, ok)
require.Equal(t, rois1, rois2)
}
func TestFrameSideData(t *testing.T) {
f := AllocFrame()
require.NotNil(t, f)
defer f.Free()
sd := f.SideData()
rois1, ok := sd.RegionsOfInterest().Get()
require.False(t, ok)
require.Nil(t, rois1)
rois1 = []RegionOfInterest{
{
Bottom: 1,
Left: 2,
QuantisationOffset: NewRational(3, 4),
Right: 5,
Top: 6,
},
{
Bottom: 7,
Left: 8,
QuantisationOffset: NewRational(9, 10),
Right: 11,
Top: 12,
},
}
require.NoError(t, sd.RegionsOfInterest().Add(rois1))
rois2, ok := sd.RegionsOfInterest().Get()
require.True(t, ok)
require.Equal(t, rois1, rois2)
}