26ca084699
This is a follow-up improvement for the following feature requests that have already shipped with our stable release: - Live Photos: Add support for Samsung Motion Photos #439 - Live Photos: Add support for Google Camera Motion Photos #1739 Signed-off-by: Michael Mayer <michael@photoprism.app>
44 lines
1.1 KiB
Go
44 lines
1.1 KiB
Go
package video
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"github.com/photoprism/photoprism/pkg/fs"
|
|
)
|
|
|
|
func TestInfo(t *testing.T) {
|
|
t.Run("VideoSize", func(t *testing.T) {
|
|
info := NewInfo()
|
|
info.FileSize = 1005000
|
|
info.VideoOffset = 5000
|
|
assert.Equal(t, int64(1000000), info.VideoSize())
|
|
})
|
|
t.Run("VideoBitrate", func(t *testing.T) {
|
|
info := NewInfo()
|
|
info.FileSize = 1005000
|
|
info.VideoOffset = 5000
|
|
info.Duration = time.Second
|
|
assert.Equal(t, float64(8), info.VideoBitrate())
|
|
})
|
|
t.Run("VideoContentType", func(t *testing.T) {
|
|
info := NewInfo()
|
|
info.VideoMimeType = fs.MimeTypeMP4
|
|
info.VideoCodec = CodecAVC
|
|
assert.Equal(t, ContentTypeAVC, info.VideoContentType())
|
|
})
|
|
t.Run("VideoFileExt", func(t *testing.T) {
|
|
info := NewInfo()
|
|
info.VideoMimeType = fs.MimeTypeMP4
|
|
info.VideoCodec = CodecAVC
|
|
assert.Equal(t, fs.ExtMP4, info.VideoFileExt())
|
|
})
|
|
t.Run("VideoFileType", func(t *testing.T) {
|
|
info := NewInfo()
|
|
info.VideoMimeType = fs.MimeTypeMP4
|
|
info.VideoCodec = CodecAVC
|
|
assert.Equal(t, fs.VideoMP4, info.VideoFileType())
|
|
})
|
|
}
|