photoprism/internal/config/config_ffmpeg_test.go
Michael Mayer 92e6c4fe1e Download: Add Disabled, Originals, MediaRaw & MediaSidecar Flags #2234
Extends DownloadSettings with 4 additional options:
- Name: File name pattern for downloaded files (existed)
- Disabled: Disables downloads
- Originals: Only download files stored in "originals" folder
- MediaRaw: Include RAW image files
- MediaSidecar: Include metadata sidecar files (JSON, XMP, YAML)
2022-04-15 09:42:07 +02:00

44 lines
1.2 KiB
Go

package config
import (
"testing"
"github.com/photoprism/photoprism/internal/ffmpeg"
"github.com/stretchr/testify/assert"
)
func TestConfig_FFmpegEncoder(t *testing.T) {
c := NewConfig(CliTestContext())
assert.Equal(t, ffmpeg.SoftwareEncoder, c.FFmpegEncoder())
c.options.FFmpegEncoder = "nvidia"
assert.Equal(t, ffmpeg.NvidiaEncoder, c.FFmpegEncoder())
c.options.FFmpegEncoder = "intel"
assert.Equal(t, ffmpeg.IntelEncoder, c.FFmpegEncoder())
c.options.FFmpegEncoder = "xxx"
assert.Equal(t, ffmpeg.SoftwareEncoder, c.FFmpegEncoder())
c.options.FFmpegEncoder = ""
assert.Equal(t, ffmpeg.SoftwareEncoder, c.FFmpegEncoder())
}
func TestConfig_FFmpegEnabled(t *testing.T) {
c := NewConfig(CliTestContext())
assert.Equal(t, true, c.FFmpegEnabled())
c.options.DisableFFmpeg = true
assert.Equal(t, false, c.FFmpegEnabled())
}
func TestConfig_FFmpegBitrate(t *testing.T) {
c := NewConfig(CliTestContext())
assert.Equal(t, 50, c.FFmpegBitrate())
c.options.FFmpegBitrate = 1000
assert.Equal(t, 960, c.FFmpegBitrate())
c.options.FFmpegBitrate = -5
assert.Equal(t, 50, c.FFmpegBitrate())
c.options.FFmpegBitrate = 800
assert.Equal(t, 800, c.FFmpegBitrate())
}