|
|
|
@ -16,15 +16,31 @@ public class MediaStreamSelectorTests
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
|
[InlineData(true)]
|
|
|
|
|
[InlineData(false)]
|
|
|
|
|
public void GetDefaultAudioStreamIndex_WithoutDefault_NotNull(bool preferDefaultTrack)
|
|
|
|
|
[InlineData(new string[0], false, 1)]
|
|
|
|
|
[InlineData(new string[0], true, 1)]
|
|
|
|
|
[InlineData(new[] { "eng" }, false, 2)]
|
|
|
|
|
[InlineData(new[] { "eng" }, true, 1)]
|
|
|
|
|
[InlineData(new[] { "eng", "fre" }, false, 2)]
|
|
|
|
|
[InlineData(new[] { "fre", "eng" }, false, 1)]
|
|
|
|
|
[InlineData(new[] { "eng", "fre" }, true, 1)]
|
|
|
|
|
public void GetDefaultAudioStreamIndex_PreferredLanguage_SelectsCorrect(string[] preferredLanguages, bool preferDefaultTrack, int expectedIndex)
|
|
|
|
|
{
|
|
|
|
|
var streams = new[]
|
|
|
|
|
var streams = new MediaStream[]
|
|
|
|
|
{
|
|
|
|
|
new MediaStream()
|
|
|
|
|
new()
|
|
|
|
|
{
|
|
|
|
|
Index = 1,
|
|
|
|
|
Language = "fre",
|
|
|
|
|
IsDefault = true
|
|
|
|
|
},
|
|
|
|
|
new()
|
|
|
|
|
{
|
|
|
|
|
Index = 2,
|
|
|
|
|
Language = "eng",
|
|
|
|
|
IsDefault = false
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Assert.NotNull(MediaStreamSelector.GetDefaultAudioStreamIndex(streams, Array.Empty<string>(), preferDefaultTrack));
|
|
|
|
|
Assert.Equal(expectedIndex, MediaStreamSelector.GetDefaultAudioStreamIndex(streams, preferredLanguages, preferDefaultTrack));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|