--no-video flag
This commit is contained in:
@@ -95,6 +95,69 @@ func TestValidateAudioArgsSkipsDisabledAudio(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateVideoArgsSkipsDisabledVideo(t *testing.T) {
|
||||
args := appArgs{
|
||||
noVideo: true,
|
||||
pattern: "not-a-pattern",
|
||||
videoWidth: 1,
|
||||
videoFPS: "unsupported",
|
||||
videoUUID: "not-a-uuid",
|
||||
}
|
||||
|
||||
if err := validateVideoArgs(&args); err != nil {
|
||||
t.Fatalf("validateVideoArgs: %v", err)
|
||||
}
|
||||
if args.videoUUID != "not-a-uuid" {
|
||||
t.Fatalf("video UUID changed while video is disabled: %q", args.videoUUID)
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateMediaSelection(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
args appArgs
|
||||
wantErrSub string
|
||||
}{
|
||||
{
|
||||
name: "no video with video definition",
|
||||
args: appArgs{noVideo: true, videoFlowDefFile: "video.json", audioChannels: 2},
|
||||
wantErrSub: "cannot be used with --video",
|
||||
},
|
||||
{
|
||||
name: "no flows",
|
||||
args: appArgs{noVideo: true},
|
||||
wantErrSub: "requires audio enabled",
|
||||
},
|
||||
{
|
||||
name: "generated audio only",
|
||||
args: appArgs{noVideo: true, audioChannels: 2},
|
||||
},
|
||||
{
|
||||
name: "external audio only",
|
||||
args: appArgs{noVideo: true, audioFlowDefFile: "audio.json"},
|
||||
},
|
||||
{
|
||||
name: "video enabled by default",
|
||||
args: appArgs{},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
err := validateMediaSelection(tc.args)
|
||||
if tc.wantErrSub == "" {
|
||||
if err != nil {
|
||||
t.Fatalf("validateMediaSelection: %v", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
if err == nil || !strings.Contains(err.Error(), tc.wantErrSub) {
|
||||
t.Fatalf("error = %v, want substring %q", err, tc.wantErrSub)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestListPatternsIsSorted(t *testing.T) {
|
||||
var output bytes.Buffer
|
||||
listPatterns(&output)
|
||||
@@ -126,6 +189,16 @@ func TestBuildVideoConfigFromArgs(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuildVideoConfigDisabled(t *testing.T) {
|
||||
cfg, err := buildVideoConfig(appArgs{noVideo: true})
|
||||
if err != nil {
|
||||
t.Fatalf("buildVideoConfig: %v", err)
|
||||
}
|
||||
if cfg != nil {
|
||||
t.Fatalf("config = %+v, want nil for disabled video", cfg)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuildVideoConfigFromFile(t *testing.T) {
|
||||
definition, err := flowdef.NewV210Video(
|
||||
"5fbec3b1-1b0f-417d-9059-8b94a47197ed",
|
||||
|
||||
Reference in New Issue
Block a user