photoprism/internal/entity/markers_test.go
2021-05-31 15:40:52 +02:00

29 lines
987 B
Go

package entity
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestMarkers_Contains(t *testing.T) {
m1 := *NewMarker(1000000, "lt9k3pw1wowuy1c1", SrcImage, MarkerFace, 0.308333, 0.206944, 0.355556, 0.355556)
m2 := *NewMarker(1000000, "lt9k3pw1wowuy1c2", SrcImage, MarkerFace, 0.298133, 0.216944, 0.255556, 0.155556)
m3 := *NewMarker(1000000, "lt9k3pw1wowuy1c3", SrcImage, MarkerFace, 0.998133, 0.816944, 0.0001, 0.0001)
m := Markers{m1}
assert.True(t, m.Contains(m2))
assert.False(t, m.Contains(m3))
}
func TestMarkers_FaceCount(t *testing.T) {
m1 := *NewMarker(1000000, "lt9k3pw1wowuy1c1", SrcImage, MarkerFace, 0.308333, 0.206944, 0.355556, 0.355556)
m2 := *NewMarker(1000000, "lt9k3pw1wowuy1c2", SrcImage, MarkerFace, 0.298133, 0.216944, 0.255556, 0.155556)
m3 := *NewMarker(1000000, "lt9k3pw1wowuy1c3", SrcImage, MarkerFace, 0.998133, 0.816944, 0.0001, 0.0001)
m3.MarkerInvalid = true
m := Markers{m1, m2, m3}
assert.Equal(t, 2, m.FaceCount())
}