CLI playlist support
This commit is contained in:
@@ -242,6 +242,62 @@ func TestPlayerPlaylistTimedEntryAdvances(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestShouldAutoStartPlaylist(t *testing.T) {
|
||||
playlist := playback.Playlist{Entries: []playback.PlaylistEntry{
|
||||
{Video: playback.PlaylistFeed{Domain: "domain", UUID: "video"}},
|
||||
}}
|
||||
tests := []struct {
|
||||
name string
|
||||
args appArgs
|
||||
playlist playback.Playlist
|
||||
want bool
|
||||
}{
|
||||
{
|
||||
name: "playlist only",
|
||||
args: appArgs{PlaylistPath: "playlist.json"},
|
||||
playlist: playlist,
|
||||
want: true,
|
||||
},
|
||||
{
|
||||
name: "direct video",
|
||||
args: appArgs{PlaylistPath: "playlist.json", VideoFlowId: "video"},
|
||||
playlist: playlist,
|
||||
},
|
||||
{
|
||||
name: "direct audio",
|
||||
args: appArgs{PlaylistPath: "playlist.json", AudioFlowId: "audio"},
|
||||
playlist: playlist,
|
||||
},
|
||||
{
|
||||
name: "both direct feeds",
|
||||
args: appArgs{
|
||||
PlaylistPath: "playlist.json",
|
||||
VideoFlowId: "video",
|
||||
AudioFlowId: "audio",
|
||||
},
|
||||
playlist: playlist,
|
||||
},
|
||||
{
|
||||
name: "empty playlist",
|
||||
args: appArgs{PlaylistPath: "playlist.json"},
|
||||
playlist: playback.Playlist{},
|
||||
},
|
||||
{
|
||||
name: "no playlist flag",
|
||||
args: appArgs{},
|
||||
playlist: playlist,
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
if got := shouldAutoStartPlaylist(test.args, test.playlist); got != test.want {
|
||||
t.Fatalf("shouldAutoStartPlaylist() = %v, want %v", got, test.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func newPlaylistTestPlayer(t *testing.T) *playerPlayback {
|
||||
t.Helper()
|
||||
return &playerPlayback{
|
||||
|
||||
Reference in New Issue
Block a user