Browse Source

test: collect candidate audio streams if no audio index is specified

To be consistent with the logic of StreamBuilder.
Dmitry Lyzo 1 year ago
parent
commit
47b583456a
1 changed files with 10 additions and 2 deletions
  1. 10 2
      tests/Jellyfin.Model.Tests/Dlna/StreamBuilderTests.cs

+ 10 - 2
tests/Jellyfin.Model.Tests/Dlna/StreamBuilderTests.cs

@@ -459,8 +459,16 @@ namespace Jellyfin.Model.Tests
                         // Audio stream not specified
                         else
                         {
-                            // TODO: Fixme
-                            Assert.All(audioStreams, stream =>
+                            bool isDefault = targetAudioStream?.IsDefault == true;
+                            var language = targetAudioStream?.Language;
+
+                            // Collect candidate audio streams
+                            var candidateAudioStreams = audioStreams.Where(stream =>
+                            {
+                                return isDefault ? stream.IsDefault : (stream.Language == language);
+                            });
+
+                            Assert.All(candidateAudioStreams, stream =>
                             {
                                 if (!stream.IsExternal)
                                 {